Theano 从 0.7 升级到 bleeding edge 后的错误

Errors after Theano upgrade from 0.7 to bleeding edge

我安装并使用了 Theano 0.7,一切正常。但是现在为了以后的工作,我需要最前沿的版本,安装很顺利。

但是当我 运行 这个 little test (found into the Theano documentation), it generates many errors (see here for the full list).

Using gpu device 0: GeForce GT 650M (CNMeM is enabled with initial size: 65.0% of memory, CuDNN not available)

ImportError: ('The following error happened while compiling the node', <theano.sandbox.cuda.DnnVersion object at 0x114d32710>(), '\n', 'dlopen(/Users/FiReTiTi/.theano/compiledir_Darwin-13.4.0-x86_64-i386-64bit-i386-2.7.11-64/tmpwmA_hw/265abc51f7c376c224983485238ff1a5.so, 2): Library not loaded: @rpath/libcudnn.4.dylib\n Referenced from: /Users/FiReTiTi/.theano/compiledir_Darwin-13.4.0-x86_64-i386-64bit-i386-2.7.11-64/tmpwmA_hw/265abc51f7c376c224983485238ff1a5.so\n Reason: image not found', '[<theano.sandbox.cuda.DnnVersion object at 0x114d32710>()]')

我检查过 cudnn.h 仍在 /Developer/NVIDIA/CUDA-7.5/include/ 中,在 /Developer/NVIDIA/CUDA-7.5/lib/ 中我们仍然发现 libcudnn.dylib 是 libcudnn 的符号 link。 4.dylib,/usr/local/cuda 中的所有内容都指向 /Developer/NVIDIA/CUDA-7.5/

有什么想法吗?

[编辑] 在我的 .profile 中我们发现:

export DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-7.5/lib:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH

/usr/local/cuda/lib 中有一个符号 link 到 cudnn 库,它实际上在 /Developer/NVIDIA/CUDA-7.5/lib.

这是命令 tool -L libcudnn.4.dylib:

的结果
libcudnn.4.dylib:
@rpath/libcudnn.4.dylib (compatibility version 0.0.0, current version 4.0.7)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.14.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

这里是 link:/usr/local/cuda/lib/libcudnn.dylib -> /Developer/NVIDIA/CUDA-7.5/lib/libcudnn.dylib,在 /Developer/NVIDIA/CUDA-7.5/lib 我有 libcudnn.dylib -> libcudnn.4.dylib

[编辑 2]

$ echo $DYLD_LIBRARY_PATH
/usr/local/xuggler/lib:/usr/local/cuda/lib:/Applications/IMOD/lib:

$ echo $LD_LIBRARY_PATH
/usr/local/cuda/lib:

[编辑 3] Here is the last error 显示。至少有一部分,因为这个错误出现在每个epoch。

ls -la /usr/local/cuda/lib:

lrwxr-xr-x   1 root  wheel    45B 22 fév 11:42 libcudnn.dylib -> /Developer/NVIDIA/CUDA-7.5/lib/libcudnn.dylib
lrwxr-xr-x   1 root  wheel    48B 26 fév 01:01 libcudnn_static.a -> /Developer/NVIDIA/CUDA-7.5/lib/libcudnn_static.a

这看起来像是 Theano 中的一个错误。如果他们将 ["-Wl,-rpath,%s" % l for l in c_lib_dirs()] 添加到编译参数,它可能会起作用。你应该报告上游 here.

如果您将 libcudnn.4.dylib 的路径添加到您的 LD_LIBRARY_PATH(或者 DYLD_LIBRARY_PATH)环境变量中,它可能会作为一种解决方法,因为那是 @rpath 的位置也会看看,这样路径@rpath/libcudnn.4.dylib就可以解决了