On Fri, Sep 8, 2017 at 11:43 PM, Sylvain Jeaugey <sjeau...@nvidia.com> wrote: > To solve the undefined references to cudaMalloc and cudaFree, you need to > link the CUDA runtime. So you should replace -lcuda by -lcudart.
If I compile with the following option: ./mpicc -I/usr/local/cuda-8.0.61/include -lOpenCL test_cuda_aware.c -o myapp I get: ./mpicc: /usr/local/cuda-8.0.61/lib64/libOpenCL.so.1: no version information available (required by /home/kokanen/opt/lib/libopen-pal.so.20) /tmp/cceiNnHc.o: In function `main': test_cuda_aware.c:(.text+0x5b): undefined reference to `cudaMalloc' test_cuda_aware.c:(.text+0xd3): undefined reference to `cudaFree' collect2: error: ld returned 1 exit status And the movement I try compiling giving the option /usr/local/cuda-8.0.61 : ./mpicc -I/usr/local/cuda-8.0.61/include -lOpenCL -L/usr/local/cuda-8.0.61/lib64 -lcudart test_cuda_aware.c -o myapp I get: /tmp/cchauUBT.o: In function `main': test_cuda_aware.c:(.text+0x5b): undefined reference to `cudaMalloc' test_cuda_aware.c:(.text+0xd3): undefined reference to `cudaFree' /home/kokanen/opt/lib/libopen-pal.so.20: undefined reference to `clGetPlatformInfo@OPENCL_1.0' /home/kokanen/opt/lib/libopen-pal.so.20: undefined reference to `clGetPlatformIDs@OPENCL_1.0' /home/kokanen/opt/lib/libopen-pal.so.20: undefined reference to `clGetDeviceInfo@OPENCL_1.0' /home/kokanen/opt/lib/libopen-pal.so.20: undefined reference to `clGetDeviceIDs@OPENCL_1.0' collect2: error: ld returned 1 exit status So my inference is if it tries to link the nvidia opencl this issue arises. Also the application is not able to link the -lcudart. I back checked and made sure that I have libcudart. /usr/local/cuda-8.0.61/lib64/libcudart.so.8.0.61 any clue? > For the OPENCL undefined references, I don't know where those are coming > from ... could it be that hwloc is compiling OpenCL support but not adding > -lOpenCL to the mpicc command, thus causing this issue ? Could be. > To work around the issue, I would try to uninstall the opencl libraries > before recompiling Open MPI. Another way could be to add manually the OpenCL > library with -lOpenCL. Yes, if I dont give the option -L/usr/local/cuda-8.0.61 opencl linking goes off as it links to the system one, but error like test_cuda_aware.c:(.text+0x5b): undefined reference to `cudaMalloc' test_cuda_aware.c:(.text+0xd3): undefined reference to `cudaFree' giving -lcudart doesn't help. -- Regards, Nilesh Kokane _______________________________________________ users mailing list users@lists.open-mpi.org https://lists.open-mpi.org/mailman/listinfo/users