Cudafy (BLAS) 样本无法执行

Cudafy (BLAS) samples cannot be executed with

无法执行 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.
}

更新1 设置平台 x64(而不是 "Any CPU"),现在显示下一个错误:

Unable to load DLL 'cublas64_70': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

但是我的电脑上安装了v7.5。 所以,我准备安装v7.0再检查一下问题。

  • 项目的目标平台应该是x64.
  • 已复制到 bin\DEBUG 文件夹 2 个文件:cublas64_70.dll 和 cufft64_70.dll。
  • blas.Dispose() 应在 blas 用法的末尾添加。