我正在尝试使用Nvidia提供的cublas工具包。我尝试了一个简单的代码,以确保它首先工作
#include <cuda_runtime.h>
#include "cublas_v2.h"
int main(){
cublasHandle_t handle;
cublasCreate_v2(&handle);
cublasDestroy_v2(handle);
}
它给了我一个错误链接
1>------ Build started: Project: trial_cuda_basic_las, Configuration: Debug Win32 ------
1> Compiling CUDA source file kernel.cu...
1>
1> E:\GPU\Trials\trial_cuda_basic_las\trial_cuda_basic_las>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --use-local-env --cl-version 2012 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" -G --keep-dir Debug -maxrregcount=0 --machine 32 --compile -cudart static -g -DWIN32 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd " -o Debug\kernel.cu.obj "E:\GPU\Trials\trial_cuda_basic_las\trial_cuda_basic_las\kernel.cu"
1> kernel.cu
1>kernel.cu.obj : error LNK2019: unresolved external symbol _cublasCreate_v2@4 referenced in function _main
1>kernel.cu.obj : error LNK2019: unresolved external symbol _cublasDestroy_v2@4 referenced in function _main
1>E:\GPU\Trials\trial_cuda_basic_las\Debug\trial_cuda_basic_las.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
N.B。:我在项目属性链接中链接了cublas.lib