separate compilaton in CUDA

前端 未结 1 889
心在旅途
心在旅途 2020-12-07 04:50

System specs: laptop with nvidia optimus support (geforce 740m, supports compute capability 2.0), ubuntu 13.10, cuda 5.0, optirun (Bumblebee) 3.2.1.

Im\' trying to c

相关标签:
1条回答
  • 2020-12-07 05:32

    This is not right:

    nvcc –arch=sm_20 –dc main.cu defines.cu
    nvcc –arch=sm_20 main.cu defines.cu
    

    The first command performs compilation (but no linking) in separate compilation mode. The second command performs compilation and linking in one step, but without using separate compilation mode.

    Try just this:

    nvcc -arch=sm_20 -rdc=true main.cu defines.cu
    

    The relevant nvcc documentation is here

    Alternatively, and following the example you linked, you could also do this:

    nvcc –arch=sm_20 –dc main.cu defines.cu
    nvcc –arch=sm_20 main.o defines.o
    

    As @JackOLantern points out, you may wish to replace sm_20 in the above commands with sm_30 to match your device, but that is not the reason for the failure you are observing. Code compiled for -arch=sm_20 will run on a cc 3.0 device.

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