Cuda 5.0 Linking Issue

前端 未结 1 1773
心在旅途
心在旅途 2020-12-11 13:01

I\'m just trying to build an old project of mine using cuda 5.0 preview. I get an Error when linking, telling me that certain cuda functions can not be found. For example:

相关标签:
1条回答
  • 2020-12-11 13:55

    You have your linking statements in the incorrect order. It should be something more like this:

    /home/myhome/nullmpi-0.7/bin/mpicxx -CC=g++ -I. -I/home/myhome/nullmpi-0.7/src \
        -I/usr/lib/openmpi/include -L/usr/local/cuda/lib64  \
        -L/home/myhome/NVIDIA_CUDA_Samples/C/lib \ 
        -L/home/myhome/NVIDIA_CUDA_Samples/C/common/lib/linux \ 
        -o TARGET_APPLICATION x86_64/Objectfiles.o \
         /home/myhome/nullmpi-0.7/lib/libnullpmpi.a -llapack -lblas -lm -lcudart
    

    The source of your problem is that you have specified the CUDA runtime library before the object file that contains a dependency to it. The linker simply discards libcudart.so from the linkage because there are no dependencies to it at the point when it is processed. Golden rule in POSIX style compilation statements: linkage statements are parsed left-to-right; so objects containing external dependencies first, libraries satisfying those dependencies afterwards.

    0 讨论(0)
提交回复
热议问题