Hello.
I am trying to compile the GPUmat toolbox in matlab. I have cuda 9.1 on Ubuntu 16.04 amd64, matlab 2017b and gcc 5.4.0. When I try to compile the library I initially had the following error message:
../../include/GPUtype.hh:165:3: note: candidate expects 2 arguments, 4
provided
For the following command:
'mex -DMATLAB -DUNIX -outdir . ./GPUtypeDelete.cpp -I"../../../include"
-I"../../cuda/latest/cudalib" -I"/usr/local/cuda-9.1/include" -I"."
-L"../../lib" -L"../../cuda/latest/cudalib" -L"/usr/local/cuda-9.1/lib64"
-lcublas -lcuda -lcudart -lgputype -lcudalib -lcufft'
I added the tag “-DMX_COMPAT_32” (for 32 bits compatibility) to the command line and that seemed to fix the problem. Then I had a series of about 50 errors about undefined references similar to this:
GPUnumeric.cpp:(.text+0x1b16): undefined reference to `cufftDestroy'
I changed the order of the library tags (-lcufft …) and matlab was able to compile some libraries. But I am still having errors about undefined references such as:
../../lib/libgputype.a(GPUmanager.o): In function
`GPUmanager::initStreams()':
GPUmanager.cpp:(.text+0x4ce): undefined reference to `cudaStreamCreate'
../../lib/libgputype.a(GPUmanager.o): In function
`GPUmanager::registerUserModule(char*, char*)':
GPUmanager.cpp:(.text+0x10ac): undefined reference to `cuModuleLoadData'
../../lib/libgputype.a(GPUmanager.o): In function
`GPUmanager::deleteUserModule(char*)':
GPUmanager.cpp:(.text+0x13d4): undefined reference to `cuModuleUnload'
../../lib/libgputype.a(GPUmanager.o): In function
`GPUmanager::registerUserFunction(char*, char*)':
GPUmanager.cpp:(.text+0x164a): undefined reference to `cuModuleGetFunction'
../../lib/libgputype.a(GPUmanager.o): In function `GPUmanager::cleanup()':
GPUmanager.cpp:(.text+0x212d): undefined reference to `cudaStreamDestroy'
../../lib/libgputype.a(GPUop.o): In function `GPUopAllocVector(GPUtype&)':
GPUop.cpp:(.text+0x185b): undefined reference to `cuMemGetInfo_v2'
GPUop.cpp:(.text+0x18c3): undefined reference to `cuMemGetInfo_v2'
GPUop.cpp:(.text+0x198d): undefined reference to `cudaMalloc'
GPUop.cpp:(.text+0x19ac): undefined reference to `cudaMalloc'
[...]
../../lib/libgputype.a(GPUnumeric.o): In function
`GPUsetKernelTextureB(GPUtype&, CUfunc_st**, int)':
GPUnumeric.cpp:(.text+0xee8): undefined reference to `cuTexRefSetAddress_v2'
GPUnumeric.cpp:(.text+0xf36): undefined reference to `cuParamSetTexRef'
GPUnumeric.cpp:(.text+0xf82): undefined reference to `cuTexRefSetFormat'
[...]
../../cuda/latest/cudalib/libcudalib.a(cudalib.o): In function
`mat_REALIMAG':
cudalib.cpp:(.text+0x2586): undefined reference to `cuFuncSetBlockShape'
cudalib.cpp:(.text+0x259b): undefined reference to `cuFuncSetSharedSize'
cudalib.cpp:(.text+0x25b3): undefined reference to `cuParamSeti'
cudalib.cpp:(.text+0x25d1): undefined reference to `cuParamSetv'
cudalib.cpp:(.text+0x25ef): undefined reference to `cuParamSetv'
cudalib.cpp:(.text+0x260d): undefined reference to `cuParamSetv'
cudalib.cpp:(.text+0x2625): undefined reference to `cuParamSeti'
cudalib.cpp:(.text+0x263d): undefined reference to `cuParamSeti'
cudalib.cpp:(.text+0x2659): undefined reference to `cuParamSeti'
cudalib.cpp:(.text+0x266e): undefined reference to `cuParamSetSize'
cudalib.cpp:(.text+0x2687): undefined reference to `cuLaunchGridAsync'
collect2: error: ld returned 1 exit status
Is this still related to the order in which libraries are being called? If yes, what’s the proper order? I’ve tried many different orders and none fixed the problem.
Thanks,
Baptiste