CUDA似乎没有编译2

时间:2014-09-13 13:48:27

标签: c++ visual-studio-2012 cuda

作为here

上一个问题的后续跟进

我正在按照建议在我的Visual Studio 2012 Express上运行CUDA 6.5 Toolkit,但问题仍然存在。

我试图编译:

    //CUDA.cu
    #include <iostream>
    #include <cuda.h>
    #include <cuda_runtime.h>
    #include <device_launch_parameters.h>

    using namespace std;

    __global__ void Add(int* a, int* b)
    {
    a[0] += b[0];
    }

int main()
{
    int a = 5, b = 9;
    int *d_a, *d_b;

    cudaMalloc(&d_a, sizeof(int));
    cudaMalloc(&d_b, sizeof(int));

    cudaMemcpy(d_a, &a, sizeof(int), cudaMemcpyHostToDevice);
    cudaMemcpy(d_b, &b, sizeof(int), cudaMemcpyHostToDevice);

    Add<<< 1 , 1 >>>(d_a, d_b);

    cudaMemcpy(&a, d_a, sizeof(int) , cudaMemcpyDeviceToHost);

    cout << a << endl;

    return 0;
}

编译器在行

中显示错误
Add<<< 1 , 1 >>>(d_a, d_b);

它所说的"Error:expected an expression"

任何编译此代码的尝试都会导致成功。但是没有找到.exe因此我无法进行任何调试。

Unable to start program 'C:\Users\...\CUDATest3.exe'
The system cannot find the file specified

我在Visual Studio上编译.cu的方法是搜索高低,但无济于事。

任何帮助都非常感谢。感谢

CK

0 个答案:

没有答案