1,GPU算力适配问题*
在安装的cuda SDK中
C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.5\0_Simple\simplePrintf
默认在该路径下的解决方案,可以打印出本机GPU的算力信息
所以我自己工程里配置为61
2 示例代码
首先这个代码肯定可以运行。所以如果你运行不出来,不是代码问题。是配置问题。
#include "stdio.h"
#include "cuda_runtime.h"
__global__ void kernel(void)
{
printf(" this is from gpu\r\n");
}
int main()
{
printf("hello world!\r\n");
kernel <<<1, 10 >>> ();
cudaDeviceReset();
return 0;
}
3,错误复现
debug是在32位模式下编译运行的