vendredi 3 avril 2015

Problems trying to install theano on Windows (Server 2012 R2 64 bit)

I am following the instructions on http://ift.tt/1anDGua to install theano on windows (server 2012 R2). I have vs2013 installed and the test script on http://ift.tt/1anDGua executes fine in cpu mode. However, when I try to execute it on the gpu using following config:



[global]
device = gpu
floatX = float32

[nvcc]
flags = --use-local-env --cl-version=2013


I get this error:



LINK : fatal error LNK1181: cannot open input file 'cublas.lib'


I searched and my cuda libs are located at C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\lib. I copied the lib files to a folder under my theano installation and modified .theanorc as follows:



[nvcc]
flags = --use-local-env --cl-version=2013 -LC=c:\theano\theano\lib


Now I got a different error:



unresolved external symbol _cudaGetLastError@0


After some searching, looks like cudaGetLastError is defined in cudart.lib and this file does exist under c:\theano\theano\lib on my machine. Then I saw CUDA - linking errors with convolution example post and I think it gave me a hint. Under C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\lib I see two folders: a Win32 and a x64. I had copied the x64 libs to c:\theano\theano\lib. Now I created two folders under c:\theano\theano and named them cuda_x86 and cuda_x64 and copied C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\lib\Win32 and C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\lib\x64 to them respectively. The Win32 folder does not have any cublas.lib in it and if I just specify the cuda_x86 to LC I get same error as before:



LINK : fatal error LNK1181: cannot open input file 'cublas.lib'


So I tried modifying LC like this:



[nvcc]
flags = --use-local-env --cl-version=2013 -LC=c:\theano\theano\cuda_x86;c:\theano\theano\cuda_x64


but this is giving me same error again:



LINK : fatal error LNK1181: cannot open input file 'cublas.lib'

['nvcc', '-shared', '-O3', '--use-local-env', '--cl-version=2013', '-LC=c:\\thea
no\\theano\\cuda_x86;c:\\theano\\theano\\cuda_x64', '-Xlinker', '/DEBUG', '-D HA
VE_ROUND', '-m32', '-Xcompiler', '-DCUDA_NDARRAY_CUH=a3b91bcc073b1a31c64309dda48
cf321,-D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD', '-Ic:\\theano\\Thea
no\\theano\\sandbox\\cuda', '-IC:\\Python27\\lib\\site-packages\\numpy\\core\\in
clude', '-IC:\\Python27\\include', '-o', 'C:\\Users\\morpheus\\AppData\\Local\\T
heano\\compiledir_Windows-2012Server-6.2.9200-Intel64_Family_6_Model_45_Stepping
_7_GenuineIntel-2.7.5-32\\cuda_ndarray\\cuda_ndarray.pyd', 'mod.cu', '-LC:\\Pyth
on27\\libs', '-LC:\\Python27', '-lpython27', '-lcublas', '-lcudart']
ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: ('nvcc return st
atus', 2, 'for cmd', 'nvcc -shared -O3 --use-local-env --cl-version=2013 -LC=c:\
\theano\\theano\\cuda_x86;c:\\theano\\theano\\cuda_x64 -Xlinker /DEBUG -D HAVE_R
OUND -m32 -Xcompiler -DCUDA_NDARRAY_CUH=a3b91bcc073b1a31c64309dda48cf321,-D NPY_
NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD -Ic:\\theano\\Theano\\theano\\sand
box\\cuda -IC:\\Python27\\lib\\site-packages\\numpy\\core\\include -IC:\\Python2
7\\include -o C:\\Users\\morpheus\\AppData\\Local\\Theano\\compiledir_Windows-20
12Server-6.2.9200-Intel64_Family_6_Model_45_Stepping_7_GenuineIntel-2.7.5-32\\cu
da_ndarray\\cuda_ndarray.pyd mod.cu -LC:\\Python27\\libs -LC:\\Python27 -lpython
27 -lcublas -lcudart')


Looks like its not searching the cuda_x64 folder for cublas.lib. Is this a syntax issue? How can I fix this? I also read Installing theano on Windows 8 with GPU enabled but it didn't help.


OK, as I write this post, looks like changing to:



flags = --use-local-env --cl-version=2013 -LC=c:\theano\theano\cuda_x86 -LC=c:\theano\theano\cuda_x64


helped get rid of previous error but I get a new one now:



error LNK2019: unresolved external symbol
_cublasCreate_v2@4 referenced in function "int __cdecl cublas_init(void)" (?cubl
as_init@@YAHXZ)


this method is defined in cublas.lib as far as I can tell from this link (although it doesn't have the v2, could that be it?) and I am linking to cublas. How to fix this error?


Another issue: Also, when I try to run nvcc on a .cu file I get this error:



nvcc pc_sampling.cu
nvcc fatal : nvcc cannot find a supported version of Microsoft Visual Studio.
Only the versions 2010, 2012, and 2013 are supported


and if I try specifying the cl-version I get this:



C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\extras\CUPTI\sample\pc_s
ampling>nvcc pc_sampling.cu --cl-version=2013
nvcc fatal : Microsoft Visual Studio configuration file 'vcvars64.bat' could n
ot be found for installation at 'f:/.../bin/x86/../../..'


Yes I cannot find any vcvars64.bat on my system. But I have already executed vcvarsall.bat amd as instructed on http://ift.tt/1anDGua


Aucun commentaire:

Enregistrer un commentaire