使用CUSPARSE时遇到问题 [英] Trouble working with CUSPARSE
问题描述
当我想编译我的程序(使用Cusparse)时,出现以下行:
As I wanted to compile my program (using Cusparse) the following lines appeared:
tmp / tmpxft_00001048_00000000-13_matvec.o:在函数 main':
cusparseCreate'
tmpxft_00001048_00000000-1_matvec.cudafe1.cpp :(。text + 0x6d5):未定义引用
tmp/tmpxft_00001048_00000000-13_matvec.o: In function main':
tmpxft_00001048_00000000-1_matvec.cudafe1.cpp:(.text+0x6d5): undefined reference to
cusparseCreate'
同样出来不仅为cusparseCreate,而且为cusparseCreateMatDescr,cusparseSetMatType,cusparseSetMatIndexBase,cusparseXcoo2csr,cusparseDsctr,
cusparseDcsrmv_v2,cusparseDestroyMatDescr和cusparseDestroy。
The same came out not only for cusparseCreate, but also for cusparseCreateMatDescr, cusparseSetMatType, cusparseSetMatIndexBase, cusparseXcoo2csr, cusparseDsctr, cusparseDcsrmv_v2, cusparseDestroyMatDescr and cusparseDestroy. What does it mean?
推荐答案
您需要链接到cuSPARSE库。由于您使用的是Linux,因此在您的nvcc命令行中添加 -lcusparse
就足够了。
You need to link with the cuSPARSE library. Since you're using Linux, adding -lcusparse
to your nvcc command line should be sufficient.
如果系统在执行时无法找到链接库,则可能还需要将CUDA库路径添加到LD_LIBRARY_PATH环境变量。
Note that you may also need to add the CUDA libraries path to your LD_LIBRARY_PATH environment variable if the system fails to find the linked libraries when executing.
这篇关于使用CUSPARSE时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!