我在互联网上找到了KMLib,我发现它非常有趣。但是在运行示例应用程序时会出现错误:“GASS.CUDA.CUDAException”“Error Invalid Source”。
方法中发生异常:
protected void InitCudaModule ()
{
deviceNr int = 0;
cuda = new CUDA (deviceNr, true);
cuCtx = cuda.CreateContext (deviceNr, CUCtxFlags.MapHost);
/ / cuda.SetCurrentContext (cuCtx);
/ / var ctx = cuda.PopCurrentContext ();
/ / var CTX2 cuda.PopCurrentContext = ();
/ / var ctx3 cuda.PopCurrentContext = ();
modluePath String = Path.Combine (Environment.CurrentDirectory, cudaModuleName);
if (! File.Exists (modluePath))
throw new ArgumentException ("Failed to access cuda module" + modluePath);
cuModule = cuda.LoadModule (modluePath); / / ERROR!
cuFunc = cuda.GetModuleFunction (cudaProductKernelName);
}
我正在使用GTX770,Visual Studio 2010 Ultimate,Cuda SDK 5.5和Windows 7 64位。
可能导致错误的原因是什么?
答案 0 :(得分:0)
我不得不经历一些你经历过的相同问题,但我的工作在我的GTX 650 + CUDA 6.5设置上。
我将描述我必须对KMLIB的构建/依赖项所做的更改:
您遇到的具体GASS.CUDA.CUDAException实际记录在KMLib's web-page上,虽然有点模糊:
-arch=sm_21 or -arch=sm_30 – indicates compute capability, former if for Fermi
cards(e.g Geforce 470), latter is for Kepler cards (e.g. GeForce 690), it
is very important to set this switch depending on yours card compute capability
因此,您遇到的问题与GFX卡的架构(Fermi / Kepler / Maxwell)在构建后步骤中与nvcc命令行不一致。我不知道作者指定的sm_30是否适用于770卡,但我最终使用了以下命令行,更改了计算模型,shader-moderl和visual-studio路径(因为CUDA 6.5 usus) VS 2013,和我一样):
nvcc -I./ KernelsEllpackCol2.cu KernelsCSR.cu KernelsEllpack.cu KernelsSlicedEllpack.cu gpuFanSmoSolver.cu gpuFOSmoSolver.cu -ccbin "%VS120COMNTOOLS%../../VC/bin" -m64 -cubin -gencode=arch=compute_30,code=sm_30 -Xptxas="-v"
您需要更改port-build以反映您的构建系统。