与nvrtc相关的样本的CUDA未定义符号错误

时间:2018-11-16 23:58:38

标签: cuda pytorch nvrtc

当我尝试对安装随附的CUDA安装示例(例如vectorAdd_nvrtc)进行测试时,发生以下错误:

clang++ -I../../common/inc -I/Developer/NVIDIA/CUDA-9.2/include  -arch x86_64  -o vectorAdd.o -c vectorAdd.cpp
clang++  -rpath /Developer/NVIDIA/CUDA-9.2/lib -o vectorAdd_nvrtc 
vectorAdd.o  -L/Developer/NVIDIA/CUDA-9.2/lib -lnvrtc
Undefined symbols for architecture x86_64:
  "_cuCtxCreate_v2", referenced from:
      loadPTX(char*, int, char**) in vectorAdd.o
  "_cuCtxSynchronize", referenced from:
      _main in vectorAdd.o
  "_cuDeviceGet", referenced from:
      loadPTX(char*, int, char**) in vectorAdd.o
      findCudaDeviceDRV(int, char const**) in vectorAdd.o
      gpuDeviceInitDRV(int, char const**) in vectorAdd.o
  "_cuDeviceGetAttribute", referenced from:
      loadPTX(char*, int, char**) in vectorAdd.o
      gpuGetMaxGflopsDeviceIdDRV() in vectorAdd.o
      void getCudaAttribute<int>(int*, CUdevice_attribute_enum, int) in vectorAdd.o
  "_cuDeviceGetCount", referenced from:
      gpuDeviceInitDRV(int, char const**) in vectorAdd.o
      gpuGetMaxGflopsDeviceIdDRV() in vectorAdd.o
  "_cuDeviceGetName", referenced from:
      loadPTX(char*, int, char**) in vectorAdd.o
      findCudaDeviceDRV(int, char const**) in vectorAdd.o
      gpuDeviceInitDRV(int, char const**) in vectorAdd.o
  "_cuInit", referenced from:
      loadPTX(char*, int, char**) in vectorAdd.o
      gpuDeviceInitDRV(int, char const**) in vectorAdd.o
      gpuGetMaxGflopsDeviceIdDRV() in vectorAdd.o
  "_cuLaunchKernel", referenced from:
      _main in vectorAdd.o
  "_cuMemAlloc_v2", referenced from:
      _main in vectorAdd.o
  "_cuMemFree_v2", referenced from:
      _main in vectorAdd.o
  "_cuMemcpyDtoH_v2", referenced from:
      _main in vectorAdd.o
  "_cuMemcpyHtoD_v2", referenced from:
      _main in vectorAdd.o
  "_cuModuleGetFunction", referenced from:
      _main in vectorAdd.o
  "_cuModuleLoadDataEx", referenced from:
      loadPTX(char*, int, char**) in vectorAdd.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [vectorAdd_nvrtc] Error 1

但是,只有在使用运行时库nvrtc时才会发生这种情况,即vectorAdd会很好地构建。我尝试了几种不同的样本(例如clockclock_nvrtc等),并得出了相同的结果。

我在网上进行了一些研究,似乎与某些头文件包含问题有关,但是我对c ++不太熟悉,也不知道如何解决此问题。我确实在Makefile中看到它指出nvrtc系统上不支持ARMv7,但是由于我的体系结构是x86_64,我不认为这是问题所在。任何帮助将不胜感激!

(CUDA的版本为9.2。我在Xcode 9.2,Apple LLVM版本为9.0.0的MAC OS 10.13.6上运行。我需要CUDA作为pytorch,但不确定是否是相关问题。)

0 个答案:

没有答案