当我想编译我的程序(使用 Cusparse)时,出现了以下几行:
tmp/tmpxft_00001048_00000000-13_matvec.o:在函数main':
tmpxft_00001048_00000000-1_matvec.cudafe1.cpp:(.text+0x6d5): undefined reference tocusparseCreate中
同样的结果不仅适用于 cusparseCreate,也适用于 cusparseCreateMatDescr、cusparseSetMatType、cusparseSetMatIndexBase、cusparseXcoo2csr、cusparseDsctr、cusparseDcsrmv_v2、cusparseDestroyMatDescr 和 cusparseDestroy。这是什么意思?
您需要链接 cuSPARSE 库。由于您使用的是 Linux,因此添加-lcusparse到 nvcc 命令行应该就足够了。
请注意,如果系统在执行时无法找到链接库,您可能还需要将 CUDA 库路径添加到 LD_LIBRARY_PATH 环境变量中。
| 归档时间: |
|
| 查看次数: |
3085 次 |
| 最近记录: |