问题
我正在尝试将int
数组复制到设备的常量内存中,但我不断收到以下错误:
[错误]'无效参数'(11)在'main.cu'第'386行'
代码
开发了很多代码,所以我将简化我的工作.
我在__constant__
main.cu文件的顶部声明了一个设备变量,在任何函数之外.
__device__ __constant__ int* dic;
Run Code Online (Sandbox Code Playgroud)
我也有一个宿主变量,flatDic
它是以下面的方式进行malloc,内部main()
:
int* flatDic = (int *)malloc(num_codewords*(bSizeY*bSizeX)*sizeof(int));
Run Code Online (Sandbox Code Playgroud)
然后我尝试的内容复制flatDic
到dic
通过这样做,也是在main()
:
cudaMemcpyToSymbol(dic, flatDic, num_codewords*(bSizeY*bSizeX)*sizeof(int));
Run Code Online (Sandbox Code Playgroud)
这cudaMemcpyToSymbol()
称它为main.cu的第386行,它就是抛出上述错误的地方.
我试过的
这是我迄今为止尝试解决问题的方法:
我已经尝试了以下所有内容,总是返回相同的错误:
cudaMemcpyToSymbol(dic, &flatDic, num_codewords*(bSizeY*bSizeX)*sizeof(int));
cudaMemcpyToSymbol(dic, flatDic, num_codewords*(bSizeY*bSizeX)*sizeof(int));
cudaMemcpyToSymbol(dic, &flatDic, num_codewords*(bSizeY*bSizeX)*sizeof(int), 0, cudaMemcpyHostToDevice);
cudaMemcpyToSymbol(dic, flatDic, num_codewords*(bSizeY*bSizeX)*sizeof(int), 0, cudaMemcpyHostToDevice);
Run Code Online (Sandbox Code Playgroud)
在调用之前我也尝试过cudaMalloc()
这个dic
变量cudaMemcpyToSymbol()
.不会引发任何错误cudaMalloc()
,但cudaMemcpyToSymbol()
错误仍然存在.
cudaMalloc((void **) &dic, num_codewords*(bSizeY*bSizeX)*sizeof(int));
Run Code Online (Sandbox Code Playgroud)
我也广泛搜索网络,文档,论坛,示例等,但都无济于事.
有人看到我的代码有什么问题吗?提前致谢.
我想做这样的事情:
create table NEW_TABLE (select * from OLD_TABLE where id=3582)
Run Code Online (Sandbox Code Playgroud)
并从该select语句的结果列创建一个新表.
我打赌它可能在mySQL中,但如何在Oracle中做到这一点?
考虑以下 Dart 源代码(Flutter 项目):
void foo() {
await bar();
}
Future<void> bar() async {
print("test");
}
Run Code Online (Sandbox Code Playgroud)
这导致在Android Studio中的以下错误:
The built-in identifier 'await' can't be used as a type
。
如果我将其更改为(await bar());
然后我收到错误Unexpected text 'await'
。
我在这里缺少什么?
我和两个朋友想在PHP中共同构建一些东西,可能我们所有人都会使用eclipse,但有些人使用Ubuntu,有些人使用Windows.
有没有说服力和好的为什么要分享代码并自由地共同发展?谢谢!
在这种情况下我们不希望我们的项目是开源的:(