我是使用CUDA的新手,正在尝试编写代码,但是仍然遇到麻烦。
CPU代码正常。但不是GNU代码。
我在编译代码时收到的错误是:
{
"jsonrpc": "2.0",
"id": "123",
"result": {
"columns": [
"Unit Number",
"Tank Number",
"Volume",
"Volume Percent",
"Description",
"Capacity",
"Status",
"Last Updated"
],
"values": [
[
null,
null,
"0",
"0",
"Tank 1",
"50000",
"N/A",
"1970-01-01 09:30:00"
],
[
"3376",
"1",
"18490",
"68.4815",
"SmartFill 3376 Tank 1",
"27000",
"Offline",
"2018-06-06 14:28:20"
]
]
}
}
和警告:先前的语法错误后,解析将在此处重新开始
ejemplo.cu(59): error: argument of type "double" is incompatible with parameter of type "const void *"
ejemplo.cu(61): error: argument of type "double" is incompatible with parameter of type "const void *"
ejemplo.cu(66): error: identifier "__global__void" is undefined
ejemplo.cu(67): error: expected a ";"
答案 0 :(得分:-1)
您可能想在下划线后面写上 __ global__ void 。对于不兼容错误,您需要在cudamemcpy中传递指针。 尝试:
cudaMemcpy(SUMAd, &SUMA, sizeof(double), cudaMemcpyHostToDevice);
cudamemcpy参考:http://horacio9573.no-ip.org/cuda/group__CUDART__MEMORY_g48efa06b81cc031b2aa6fdc2e9930741.html