无法执行cudafy(BLAS)样本。
在线失败: GPGPUBLAS blas = GPGPUBLAS.Create(gpu);
消息:不支持指定的方法。
堆栈追踪:
at Cudafy.Maths.BLAS.CudaBLAS..ctor(GPGPU gpu)
at Cudafy.Maths.BLAS.GPGPUBLAS.Create(GPGPU gpu)
at CUDAFY_Samples.Program.Main(String[] args) in d:\@Igor\SW\GPU\CUDAFY-Samples\Program.cs:line 22
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
测试从http://cudafy.codeplex.com/discussions/331743
复制的来源static void Main(string[] args)
{
// Get GPU device
GPGPU gpu = CudafyHost.GetDevice(CudafyModes.Target);
// Create GPGPUBLAS (CUBLAS Wrapper)
GPGPUBLAS blas = GPGPUBLAS.Create(gpu);
// Prepare sample data
Random rand = new Random();
int n = 500;
double[] cpuVectorX = new double[n];
double[] cpuVectorY = new double[n];
double[] cpuMatrixA = new double[n * n];
for (int i = 0; i < n; i++)
{
cpuVectorX[i] = rand.Next(100);
cpuVectorY[i] = rand.Next(100);
}
for (int i = 0; i < n * n; i++)
{
cpuMatrixA[i] = rand.Next(100);
}
// Copy CPU to GPU memory
// Before using GPGPUBLAS, You have to copy data from cpu to gpu.
double[] gpuVectorX = gpu.CopyToDevice(cpuVectorX);
double[] gpuVectorY = gpu.CopyToDevice(cpuVectorY);
double[] gpuMatrixA = gpu.CopyToDevice(cpuMatrixA);
// BLAS1 sample : y = x + y
blas.AXPY(1.0, gpuVectorX, gpuVectorY);
// BLAS2 sample : y = Ax + y
blas.GEMV(n, n, 1.0, gpuMatrixA, gpuVectorX, 1.0, gpuVectorY);
// Get result from GPU
gpu.CopyFromDevice<double>(gpuVectorY, cpuVectorY);
// And you can use result cpuVectorY for any other purpose.
}
UPDATE1 设置平台x64(而不是“任何CPU”),现在显示下一个错误:
无法加载DLL'cublas64_70':指定的模块不能 找到。 (HRESULT异常:0x8007007E)
但是我的电脑上安装了v7.5。 所以,我将安装v7.0并再次检查问题。
答案 0 :(得分:1)