当我想编译我的程序(使用 Cusparse)时,出现了以下几行:
tmp/tmpxft_00001048_00000000-13_matvec.o:在函数中main':
tmpxft_00001048_00000000-1_matvec.cudafe1.cpp:(.text+0x6d5): undefined reference to
cusparse创建'
同样的结果不仅适用于 cusparseCreate,还适用于 cusparseCreateMatDescr、cusparseSetMatType、cusparseSetMatIndexBase、cusparseXcoo2csr、cusparseDsctr、
cusparseDcsrmv_v2、cusparseDestroyMatDescr 和 cusparseDestroy。这是什么意思?
您需要链接 cuSPARSE 库。由于您使用的是 Linux,因此添加-lcusparse
您的 nvcc 命令行应该足够了。
请注意,如果系统在执行时无法找到链接库,您可能还需要将 CUDA 库路径添加到 LD_LIBRARY_PATH 环境变量中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)