我有以下代码导致更大代码库的上下文中出错:
struct Quadruple
{
double _sum;
double _corr;
// Fast multiply by -1, 0 or +1 (doesn't need extended precision operations).
__device__ inline Quadruple& MulSign(const int8_t sign);
};
// ...
__device__ inline Quadruple& Quadruple::MulSign(const int8_t sign)
{
__assume(-1 <= sign && sign <= 1); // enable more optimization premises
_sum *= sign;
_corr *= sign;
return *this;
}
// ...
int8_t y = /* ... read from memory ... */;
Quadruple a = /* ... computed here ... */;
Quadruple b = Quadruple(a).MulSign(y);
使用CUDA 8RC + MSVC ++ 2013编译代码时出现以下错误:
1> Compiling CUDA source file Example.gpu.cu...
1>
1> D:\ExDir>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_21,compute_20\" --use-local-env --cl-version 2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart static -D_DENSE_REP -DWIN32 -DWIN64 -DNDEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W4 /nologo /Ox /Zi /MD " -o x64\Release\Example.gpu.cu.obj "D:\ExDir\Example.gpu.cu"
1>ptxas C : /Users/ExUser/AppData/Local/Temp/tmpxft_00002ffc_00000000-4_CuSvm.gpu.ptx, line 2513; error : Call has wrong number of parameters
1> ptxas fatal : Ptx assembly aborted due to errors
1> Example.gpu.cu
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\CUDA 8.0.targets(599,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_21,compute_20\" --use-local-env --cl-version 2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart static -D_DENSE_REP -DWIN32 -DWIN64 -DNDEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W4 /nologo /Ox /Zi /MD " -o x64\Release\Example.gpu.cu.obj "D:\ExDir\Example.gpu.cu"" exited with code 255.
注释掉__assume(-1 <= sign && sign <= 1);
后,代码编译好了。
它是NVCC中的错误,还是NVCC不支持MSVC ++的__assume
,或者我做错了什么?是否有解决方法(当然要保留__assume
或等效内容)?
答案 0 :(得分:4)
angular.element(document).ready(function(){
var arrays = document.getElementsByClassName("x");
console.log(arrays[2]);
});
是Microsoft(以及随后的英特尔icc)编译器内在函数。它不是C ++语言的一部分,并且在CUDA(或GCC或Clang)中不受支持。