我需要从命令行使用 nvcc 编译一个 cuda .cu 文件。该文件是“vectorAdd_kernel.cu”,包含以下代码:
extern "C" __global__ void VecAdd_kernel(const float* A, const float* B, float* C, int N)
{
int i = blockDim.x * blockIdx.x + threadIdx.x;
if (i < N)
C[i] = A[i] + B[i];
}
我使用了以下命令(我需要获取一个 .cubin 文件):
nvcc --cubin --use-local-env --cl-version 2010 -keep -I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include" vectorAdd_kernel.cu
编译器创建文件 vectorAdd_kernel.cpp4.ii 和 vectorAdd_kernel.cpp1.ii 然后它停止并输出以下输出:
C:\Users\Massimo\Desktop\Pluto>nvcc --cubin --use-local-env --cl-version 2010 vectorAdd_kernel.cu -keep -I "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include"
vectorAdd_kernel.cu
vectorAdd_kernel.cu
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(29): error: invalid redeclaration of type name "size_t"
C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/include\new(51): error: first parameter of allocation function must be of type## Heading ## "size_t"
C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/include\new(55): error: first parameter of allocation function must be of type "size_t"
你能帮我解决这个问题吗?