vlfeat / matconvnet

MatConvNet: CNNs for MATLAB
Other
1.4k stars 753 forks source link

Error while compiling with GPU support #940

Open s-bl opened 7 years ago

s-bl commented 7 years ago

Hey,

i can't get matconvnet compiled with gpu support. Maybe someone can point me in the right direction

Setup:

CUDADevice with properties:

Name: 'GeForce GTX TITAN Black'
Index: 1
ComputeCapability: '3.5'
SupportsDouble: 1
DriverVersion: 8
ToolkitVersion: 7
>> version

ans =

8.6.0.267246 (R2015b)

I use the following command to launch matlab LD_LIBRARY_PATH=/home/software/cuda64-7.5/lib64:$LD_LIBRARY_PATH LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtiff.so.5" /home/software/matlabR2015b-64/bin/matlab -nodesktop

Compiling with vl_compilenn('enableGpu', true, 'cudaRoot', '/home/software/cuda64-7.5/', 'verbose', 2)

results in the following error:

Verbose mode is on.
... Looking for compiler 'nvcc' ...
... Looking for environment variable 'MW_NVCC_PATH' ...Yes ('/home/software/cuda64-7.5/bin/nvcc').
... Looking for folder '/home/software/cuda64-7.5/bin' ...Yes.
... Looking for file '/home/software/cuda64-7.5/bin/nvcc' ...Yes.
... Executing command 'which g++' ...Yes ('/usr/bin/g++').
... Executing command 'g++ -print-file-name=libstdc++.so' ...Yes ('/usr/lib/gcc/x86_64-linux-gnu/5/libstdc++.so').
Found installed compiler 'nvcc'.
Options file details
-------------------------------------------------------------------
        Compiler location: /home/software/cuda64-7.5/bin/nvcc
        Options file: /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/src/config/mex_CUDA_glnxa64.xml
        CMDLINE1 : /home/software/cuda64-7.5/bin/nvcc -c -DNDEBUG  -DENABLE_GPU  -DENABLE_DOUBLE   --compiler-options=-D_GNU_SOURCE,-DMATLAB_MEX_FILE -I"/home/software/matlabR2015b-64/extern/include" -I"/home/software/matlabR2015b-64/simulink/include" -I"/home/software/matlabR2015b-64/toolbox/distcomp/gpu/extern/include/" -D_FORCE_INLINES -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=\"sm_30,compute_30\" $NVCC_FLAGS --compiler-options=-ansi,-fexceptions,-fPIC,-fno-omit-frame-pointer,-pthread  -gencode=arch=compute_35,code=\"sm_35,compute_35\"  -O3 -Xcompiler -fPIC -D_FORCE_INLINES -O -DNDEBUG -Xcompiler -mssse3,-ftree-vect-loop-version,-ffast-math,-funroll-all-loops /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/src/bits/impl/im2row_gpu.cu -o /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/impl/im2row_gpu.o
        CMDLINE2 : /usr/bin/g++ -pthread -Wl,--no-undefined  -shared -O -Wl,--version-script,"/home/software/matlabR2015b-64/extern/lib/glnxa64/mexFunction.map" /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/impl/im2row_gpu.o   -Wl,-rpath-link,/home/software/matlabR2015b-64/bin/glnxa64 -L"/home/software/matlabR2015b-64/bin/glnxa64" -lmx -lmex -lmat -lm -lmwgpu /home/software/matlabR2015b-64/bin/glnxa64/libcudart.so.[0-9].[0-9] -o /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/impl/im2row_gpu.mexa64
        CMDLINE3 : rm -f /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/impl/im2row_gpu.o
        CXX : /home/software/cuda64-7.5/bin/nvcc
        DEFINES : -DNDEBUG  -DENABLE_GPU  -DENABLE_DOUBLE   --compiler-options=-D_GNU_SOURCE,-DMATLAB_MEX_FILE
        MATLABMEX : -DMATLAB_MEX_FILE
        NVCCFLAGS : -D_FORCE_INLINES -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=\"sm_30,compute_30\" $NVCC_FLAGS
        CXXFLAGS : --compiler-options=-ansi,-fexceptions,-fPIC,-fno-omit-frame-pointer,-pthread  -gencode=arch=compute_35,code=\"sm_35,compute_35\"  -O3 -Xcompiler -fPIC -D_FORCE_INLINES
        INCLUDE : -I"/home/software/matlabR2015b-64/extern/include" -I"/home/software/matlabR2015b-64/simulink/include" -I"/home/software/matlabR2015b-64/toolbox/distcomp/gpu/extern/include/"
        CXXOPTIMFLAGS : -O -DNDEBUG -Xcompiler -mssse3,-ftree-vect-loop-version,-ffast-math,-funroll-all-loops
        CXXDEBUGFLAGS : -g
        LDXX : /usr/bin/g++
        LDFLAGS : -pthread -Wl,--no-undefined 
        LDTYPE : -shared
        LINKEXPORT : -Wl,--version-script,"/home/software/matlabR2015b-64/extern/lib/glnxa64/mexFunction.map"
        LINKLIBS : -Wl,-rpath-link,/home/software/matlabR2015b-64/bin/glnxa64 -L"/home/software/matlabR2015b-64/bin/glnxa64" -lmx -lmex -lmat -lm -lmwgpu /home/software/matlabR2015b-64/bin/glnxa64/libcudart.so.[0-9].[0-9]
        LDOPTIMFLAGS : -O
        LDDEBUGFLAGS : -g
        OBJEXT : .o
        LDEXT : .mexa64
        NVCC : /home/software/cuda64-7.5/bin/nvcc
        GCC : /usr/bin/g++
        CPPLIB_DIR : /usr/lib/gcc/x86_64-linux-gnu/5/libstdc++.so
        MATLABROOT : /home/software/matlabR2015b-64
        ARCH : glnxa64
        SRC : /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/src/bits/impl/im2row_gpu.cu
        OBJ : /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/impl/im2row_gpu.o
        OBJS : /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/impl/im2row_gpu.o 
        SRCROOT : /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/src/bits/impl/im2row_gpu
        DEF : /tmp/mex_35120949799581353_1886/im2row_gpu.def
        EXP : /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/impl/im2row_gpu.exp
        LIB : /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/impl/im2row_gpu.lib
        EXE : /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/impl/im2row_gpu.mexa64
        ILK : /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/impl/im2row_gpu.ilk
        MANIFEST : /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/impl/im2row_gpu.mexa64.manifest
        TEMPNAME : /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/impl/im2row_gpu
        EXEDIR : /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/impl/
        EXENAME : im2row_gpu
        OPTIM : -O -DNDEBUG -Xcompiler -mssse3,-ftree-vect-loop-version,-ffast-math,-funroll-all-loops
        LINKOPTIM : -O
-------------------------------------------------------------------
Building with 'nvcc'.
/home/software/cuda64-7.5/bin/nvcc -c -DNDEBUG  -DENABLE_GPU  -DENABLE_DOUBLE   --compiler-options=-D_GNU_SOURCE,-DMATLAB_MEX_FILE -I"/home/software/matlabR2015b-64/extern/include" -I"/home/software/matlabR2015b-64/simulink/include" -I"/home/software/matlabR2015b-64/toolbox/distcomp/gpu/extern/include/" -D_FORCE_INLINES -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=\"sm_30,compute_30\" $NVCC_FLAGS --compiler-options=-ansi,-fexceptions,-fPIC,-fno-omit-frame-pointer,-pthread  -gencode=arch=compute_35,code=\"sm_35,compute_35\"  -O3 -Xcompiler -fPIC -D_FORCE_INLINES -O -DNDEBUG -Xcompiler -mssse3,-ftree-vect-loop-version,-ffast-math,-funroll-all-loops /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/src/bits/impl/im2row_gpu.cu -o /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/impl/im2row_gpu.o
Error using mex
In file included from /home/software/cuda64-7.5/bin/..//include/cuda_runtime.h:76:0,
                 from <command-line>:0:
/home/software/cuda64-7.5/bin/..//include/host_config.h:115:2: error: #error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
 #error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
  ^

Error in vl_compilenn>mex_compile (line 529)
mex(mopts{:}) ;

Error in vl_compilenn (line 487)
      mex_compile(opts, srcs{i}, objfile, flags.mexcu) ;

compiling with vl_compilenn('enableGpu', true, 'cudaMethod', 'nvcc', 'cudaRoot', '/home/software/cuda64-7.5/', 'verbose', 2)

results in

vl_compilenn: * CUDA configuration *
vl_compilenn:   CUDA: using CUDA Devkit '/home/software/cuda64-7.5/'.
vl_compilenn:   CUDA: using NVCC '/home/software/cuda64-7.5/bin/nvcc' (70517).
vl_compilenn:   CUDA: determining GPU compute capability (use the 'CudaArch' option to override)
vl_compilenn:   CUDA: NVCC architecture string: '-gencode=arch=compute_35,code=\"sm_35,compute_35\" '.
vl_compilenn:   CUDA: MEX config file: '/home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/src/config/mex_CUDA_glnxa64.xml'
vl_compilenn: * Compiler and linker configurations *
vl_compilenn:   intermediate build products directory: /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build
vl_compilenn:   MEX files: /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/
vl_compilenn:   MEX options [CC CPU]: -v -DNDEBUG -DENABLE_GPU -DENABLE_DOUBLE -largeArrayDims CXXFLAGS=$CXXFLAGS  CXXOPTIMFLAGS=$CXXOPTIMFLAGS -mssse3 -ftree-vect-loop-version -ffast-math -funroll-all-loops -cxx
vl_compilenn:   MEX options [LINK]: -v -DNDEBUG -DENABLE_GPU -DENABLE_DOUBLE -lmwblas -L"/home/software/cuda64-7.5/lib64" -lcudart -lcublas -lmwgpu -largeArrayDims LDFLAGS=$LDFLAGS -Wl,-rpath -Wl,"/home/software/cuda64-7.5/lib64" LINKLIBS=-lrt -ljpeg $LINKLIBS
vl_compilenn:   MEX options [CC GPU]: -f /home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/src/config/mex_CUDA_glnxa64.xml -v -DNDEBUG -DENABLE_GPU -DENABLE_DOUBLE -largeArrayDims CXXFLAGS=$CXXFLAGS  -gencode=arch=compute_35,code=\"sm_35,compute_35\"  -O3 -Xcompiler -fPIC -D_FORCE_INLINES CXXOPTIMFLAGS=$CXXOPTIMFLAGS -Xcompiler -mssse3,-ftree-vect-loop-version,-ffast-math,-funroll-all-loops
vl_compilenn:   NVCC options [CC GPU]: -v -DNDEBUG -DENABLE_GPU -DENABLE_DOUBLE -gencode=arch=compute_35,code=\"sm_35,compute_35\"  -I"/home/software/matlabR2015b-64/extern/include" -I"/home/software/matlabR2015b-64/toolbox/distcomp/gpu/extern/include"  -Xcompiler -mssse3,-ftree-vect-loop-version,-ffast-math,-funroll-all-loops -gencode=arch=compute_35,code=\"sm_35,compute_35\"  -O3 -Xcompiler -fPIC -D_FORCE_INLINES
vl_compilenn: * Reading images *
vl_compilenn:   vl_imreadjpeg enabled
vl_compilenn:   image library: libjpeg
vl_compilenn:   image library compile flags: 
vl_compilenn:   image library link flags: -ljpeg
vl_compilenn: NVCC CC: "/home/software/cuda64-7.5/bin/nvcc" -c "/home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/src/bits/data.cu" -v -DNDEBUG -DENABLE_GPU -DENABLE_DOUBLE -gencode=arch=compute_35,code=\"sm_35,compute_35\"  -I"/home/software/matlabR2015b-64/extern/include" -I"/home/software/matlabR2015b-64/toolbox/distcomp/gpu/extern/include"  -Xcompiler -mssse3,-ftree-vect-loop-version,-ffast-math,-funroll-all-loops -gencode=arch=compute_35,code=\"sm_35,compute_35\"  -O3 -Xcompiler -fPIC -D_FORCE_INLINES -o "/home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/data.o"
#$ _SPACE_= 
#$ _CUDART_=cudart
#$ _HERE_=/home/software/cuda64-7.5/bin
#$ _THERE_=/home/software/cuda64-7.5/bin
#$ _TARGET_SIZE_=
#$ _TARGET_DIR_=
#$ _TARGET_SIZE_=64
#$ TOP=/home/software/cuda64-7.5/bin/..
#$ NVVMIR_LIBRARY_DIR=/home/software/cuda64-7.5/bin/../nvvm/libdevice
#$ LD_LIBRARY_PATH=/home/software/cuda64-7.5/bin/../lib:/home/software/matlabR2015b-64/sys/opengl/lib/glnxa64:/home/software/matlabR2015b-64/sys/os/glnxa64:/home/software/matlabR2015b-64/bin/glnxa64:/home/software/matlabR2015b-64/extern/lib/glnxa64:/home/software/matlabR2015b-64/runtime/glnxa64:/home/software/matlabR2015b-64/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/home/software/matlabR2015b-64/sys/java/jre/glnxa64/jre/lib/amd64/server:/home/software/cuda64-7.5/lib64:/home/blaes/.local/cudnn-6.5-v2/lib64:/home/blaes/.local/usr/local/lib:/home/blaes/.local/usr/lib64:/home/blaes/.local/usr/lib:/home/blaes/.local/torch/install/lib:/home/software/cuda64-6.5/lib64
#$ PATH=/home/software/cuda64-7.5/bin/../open64/bin:/home/software/cuda64-7.5/bin/../nvvm/bin:/home/software/cuda64-7.5/bin:/home/software/cuda64-7.5/bin:/home/blaes/.local/torch/install/bin:/home/software/cuda64-6.5/bin:/home/blaes/.local/usr/bin:/home/blaes/.local/torch/install/bin:/home/blaes/torch/install/bin:/home/blaes/.local/torch/install/bin:/home/software/cuda64-6.5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
#$ INCLUDES="-I/home/software/cuda64-7.5/bin/..//include"  
#$ LIBRARIES=  "-L/home/software/cuda64-7.5/bin/..//lib64/stubs" "-L/home/software/cuda64-7.5/bin/..//lib64"
#$ CUDAFE_FLAGS=
#$ PTXAS_FLAGS=
#$ gcc -D__CUDA_ARCH__=350 -E -x c++     -DCUDA_DOUBLE_MATH_FUNCTIONS  -D__CUDACC__ -D__NVCC__  -mssse3 -ftree-vect-loop-version -ffast-math -funroll-all-loops -fPIC -O3 -I"/home/software/matlabR2015b-64/extern/include" -I"/home/software/matlabR2015b-64/toolbox/distcomp/gpu/extern/include" "-I/home/software/cuda64-7.5/bin/..//include"   -D"__CUDACC_VER__=70517" -D"__CUDACC_VER_BUILD__=17" -D"__CUDACC_VER_MINOR__=5" -D"__CUDACC_VER_MAJOR__=7" -D"NDEBUG" -D"ENABLE_GPU" -D"ENABLE_DOUBLE" -D"_FORCE_INLINES" -include "cuda_runtime.h" -m64 "/home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/src/bits/data.cu" > "/tmp/tmpxft_000022e7_00000000-7_data.cpp1.ii" 
In file included from /home/software/cuda64-7.5/bin/..//include/cuda_runtime.h:76:0,
                 from <command-line>:0:
/home/software/cuda64-7.5/bin/..//include/host_config.h:115:2: error: #error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
 #error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
  ^
# --error 0x1 --
Error using vl_compilenn>nvcc_compile (line 540)
Command "/home/software/cuda64-7.5/bin/nvcc" -c "/home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/src/bits/data.cu" -v -DNDEBUG -DENABLE_GPU -DENABLE_DOUBLE -gencode=arch=compute_35,code=\"sm_35,compute_35\"
-I"/home/software/matlabR2015b-64/extern/include" -I"/home/software/matlabR2015b-64/toolbox/distcomp/gpu/extern/include"  -Xcompiler -mssse3,-ftree-vect-loop-version,-ffast-math,-funroll-all-loops
-gencode=arch=compute_35,code=\"sm_35,compute_35\"  -O3 -Xcompiler -fPIC -D_FORCE_INLINES -o "/home/blaes/Repos/ping_/Labs/ext/matconvnet/matlab/mex/.build/bits/data.o" failed.

Error in vl_compilenn (line 485)
      nvcc_compile(opts, srcs{i}, objfile, flags.nvcc) ;`

I also tried cuda64-6.5 which results in the same errors.

Thank you in advance and sorry for the somewhat vague title.

s-bl

lenck commented 7 years ago

You need newer CUDA, no? Or an older GCC...

 #error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
s-bl commented 7 years ago

@lenck Thanks for the suggestion.

>> !which gcc
/usr/bin/gcc
$ /usr/bin/gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4

I have an older gcc version anyway, but also not much control over the environment.

s-bl commented 7 years ago

Sry, my last comment was not entirely correct and maybe a little bit confusing (maybe I was a little bit confused). My local machine has gcc/g++-4.8 installed while on the cluster (with the gpus) gcc/g++-5.4 is installed which causes the compile error. I was able to compile matconvnet locally and with gpu support but execute it on the cluster.

lenck commented 7 years ago

Just many random suggestion, not sure if any will be useful: