gpt4 book ai didi

c++ - Ptx 程序集因错误而中止

转载 作者:行者123 更新时间:2023-11-28 06:56:31 27 4
gpt4 key购买 nike

<分区>

我曾尝试在 MS Visual Studio 2012 中的 C/CUDA 5.5 上编写用于乘法 CSR 矩阵和 vector 的程序,但遇到了 ptx 错误。我的代码 list :

__global__ void multKernelSymm(double* s, double* u, double* val, int* rowPtr, int* colInd)
{
int l = 0, jl, i;
int idx = blockDim.x*blockIdx.x;

l = rowPtr[idx] - 1;
for ( i = 0; i < (rowPtr[idx + 1] - rowPtr[idx]); i++){
jl = colInd[l] - 1;
s[idx] = s[idx] + val[l] * u[jl];
l+=1;
}

l = 0;
l = rowPtr[idx] - 1;
for (int i = 0; i < (rowPtr[idx + 1] - rowPtr[idx]); i++){
jl = colInd[l] - 1;
if(jl > idx)
atomicAdd(&s[jl], val[l] * u[idx]);
//s[jl] = s[jl] + val[l] * u[idx];
l+=1;
}


}

__device__ double atomicAdd(double* address, double val)
{
unsigned long long int* address_as_ull =
(unsigned long long int*)address;
unsigned long long int old = *address_as_ull, assumed;
do {
assumed = old;
old = atomicCAS(address_as_ull, assumed, __double_as_longlong(val + __longlong_as_double(assumed)));
} while (assumed != old);
return __longlong_as_double(old);
}

这是我在 VS 中得到的:

 C:\Users\Дмитрий\Documents\Visual Studio 2012\Projects\matrix mult simple\matrix mult simple>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --use-local-env --cl-version 2012 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64"  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include"  -G   --keep-dir x64\Debug -maxrregcount=0  --machine 64 --compile -cudart static  -g   -DWIN64 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd  " -o x64\Debug\kernel.cu.obj "C:\Users\Дмитрий\Documents\Visual Studio 2012\Projects\matrix mult simple\matrix mult simple\kernel.cu" 
1> ptxas C:/Users/AACE~1/AppData/Local/Temp/tmpxft_00001b88_00000000-4_kernel.ptx, line 479; : fatal error : Parsing error near '-': syntax error
1>ptxas : fatal error : Ptx assembly aborted due to errors
1> kernel.cu
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\BuildCustomizations\CUDA 6.0.targets(597,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_20,compute_20\" --use-local-env --cl-version 2012 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -g -DWIN64 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd " -o x64\Debug\kernel.cu.obj "C:\Users\Дмитрий\Documents\Visual Studio 2012\Projects\matrix mult simple\matrix mult simple\kernel.cu"" exited with code -1.
1>
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

我能修好吗?

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com