2D行列で拡散をシミュレートする簡単なCUDA C++プログラムを作成しました。私はToolkitで提供されているライブラリのいくつかを使用しようとしたときに困っていました。私は非常に効率の悪い行列の転置カーネルをcuBlasからのものと置き換え、また、implCUは線形システムを解くcuSolversの実装で置き換えたいと思います。問題は、関数の使用方法やコンパイル方法がわかりません。 Nvidiaが提供するサンプルコードでMakefileを使用しています。誰かが私を助けてくれたら、.cuファイルを書くときにこれらの関数がどのように使われているのかを私に見せてもらえたら、感謝します。ここで ツールキットで提供されているライブラリでCUDAプログラムをコンパイルする
はコードです: http://pastebin.com/UKhJZQBz私はUbuntuの16.04で午前公式ガイドに書かれているように私には、PATH変数をエクスポートした(そう、彼らは/usr/local/cuda-8.0/bin含めます)。ここで
はあなたが明示的にCUBLASとcusolverライブラリをリンクする必要がありますnvcc -I /usr/local/cuda-8.0/samples/common/inc/ difusion2d.cu
/tmp/tmpxft_00001c09_00000000-16_difusion2d.o: In function `csr_mat_norminf(int, int, int, cusparseMatDescr*, double const*, int const*, int const*)':
undefined reference to `cusparseGetMatIndexBase'
/tmp/tmpxft_00001c09_00000000-16_difusion2d.o: In function `display_matrix(int, int, int, cusparseMatDescr*, double const*, int const*, int const*)':
undefined reference to `cusparseGetMatIndexBase'
/tmp/tmpxft_00001c09_00000000-16_difusion2d.o: In function `main':
undefined reference to `cusolverDnCreate'
undefined reference to `cublasCreate_v2'
undefined reference to `cusolverDnSetStream'
undefined reference to `cublasSetStream_v2'
collect2: error: ld returned 1 exit status
それは私のために働いた方法は NVCC -I /usr/local/cuda-8.0/samples/common/inc/ -lcusolver -lcublas -lcusparse difusion2d.cu –