Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/soumith/cudnn.torch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsoumith <soumith@fb.com>2016-09-08 01:14:00 +0300
committersoumith <soumith@fb.com>2016-09-08 01:14:00 +0300
commit8c112dfe7adb26cad7f10c3f0919234a3ffd7b70 (patch)
tree7589ab44fd77bb391683419acf4163b32b70975b
parent4536a4b09ae3d814793769291b3b761909ad8ca5 (diff)
adding environment variable option
-rw-r--r--ffi.lua32
1 files changed, 22 insertions, 10 deletions
diff --git a/ffi.lua b/ffi.lua
index cf56341..d5b5f8c 100644
--- a/ffi.lua
+++ b/ffi.lua
@@ -1586,18 +1586,30 @@ cudnnStatus_t cudnnActivationBackward_v4(
]]
-local libnames = {'libcudnn.so.5', 'libcudnn.5.dylib'}
-local ok = false
-for i=1,#libnames do
- ok = pcall(function () cudnn.C = ffi.load(libnames[i]) end)
- if ok then break; end
-end
-
-if not ok then
- error([['libcudnn (R5) not found in library path.
+local CUDNN_PATH = os.getenv('CUDNN_PATH')
+if CUDNN_PATH then
+ print('Found Environment variable CUDNN_PATH = ' .. CUDNN_PATH)
+ cudnn.C = ffi.load(CUDNN_PATH)
+else
+
+ local libnames = {'libcudnn.so.5', 'libcudnn.5.dylib'}
+ local ok = false
+ for i=1,#libnames do
+ ok = pcall(function () cudnn.C = ffi.load(libnames[i]) end)
+ if ok then break; end
+ end
+
+ if not ok then
+ error([['libcudnn (R5) not found in library path.
Please install CuDNN from https://developer.nvidia.com/cuDNN
-Then make sure files named as libcudnn.so.5 or libcudnn.5.dylib are placed in your library load path (for example /usr/local/lib , or manually add a path to LD_LIBRARY_PATH)
+Then make sure files named as libcudnn.so.5 or libcudnn.5.dylib are placed in
+your library load path (for example /usr/local/lib , or manually add a path to LD_LIBRARY_PATH)
+
+Alternatively, set the path to libcudnn.so.5 or libcudnn.5.dylib
+to the environment variable CUDNN_PATH and rerun torch.
+For example: export CUDNN_PATH = "/usr/local/cuda/lib64/libcudnn.so.5"
]])
+ end
end
-- check cuDNN version