麻烦使用CUSPARSE

时间:2012-03-12 21:16:31

标签: cuda

由于我想编译我的程序(使用Cusparse),出现了以下行:

tmp / tmpxft_00001048_00000000-13_matvec.o:在函数main': tmpxft_00001048_00000000-1_matvec.cudafe1.cpp:(.text+0x6d5): undefined reference to cusparseCreate'

同样出现的不仅是cusparseCreate,还有cusparseCreateMatDescr,cusparseSetMatType,cusparseSetMatIndexBase,cusparseXcoo2csr,cusparseDsctr, cusparseDcsrmv_v2,cusparseDestroyMatDescr和cusparseDestroy。这是什么意思?

1 个答案:

答案 0 :(得分:3)

您需要链接cuSPARSE库。由于您使用的是Linux,因此将-lcusparse添加到您的nvcc命令行就足够了。

请注意,如果系统在执行时无法找到链接库,您可能还需要将CUDA库路径添加到LD_LIBRARY_PATH环境变量中。

相关问题