我刚开始通过Udacity学习CUDA编程。即使在尝试使用动态共享内存时,我也会收到以下错误。
@Configuration
@EnableAutoConfiguration
@EnableMongoRepositories
@EnableConfigurationProperties(MongoProperties.class)
static class ContextConfiguration {
@Autowired
private MongoProperties mongoProperties;
@PostConstruct
public void init() {
// Here, I override the port property
mongoProperties.setPort(mongoPort);
}
}
我搜索了很多,但仍然不知道哪里出错了。有趣的是,如果我将最后两行更改为
CUDA error at: main.cpp:55
invalid argument cudaGetLastError()
terminate called after throwing an instance of thrust::system::system_error'
what(): unload of CUDA runtime failed
We are unable to execute your code. Did you set the grid and/or block size correctly?
,运行代码时没有抛出任何错误。但是,它没有意义,因为动态内存分配的空间不应该限制为常量。也许这不是我的代码,而是Udacity上的设置?我写的代码如下。任何帮助将不胜感激。
compact_kernel<<<numBlocks, numThreadsPerBlock, sizeof(int)*1000>>>(d_inputVals, d_inputPos, d_outputVals, d_outputPos, numElems, 0);
compact_kernel<<<numBlocks, numThreadsPerBlock, sizeof(int)*1000>>>(d_inputVals, d_inputPos, &d_outputVals[numElems/2], &d_outputPos[numElems/2], numElems, 1);
}`
修改 numElems的值是220480.这个数字对于动态内存分配来说太大了吗?