The code is a simple hello world code:
#include <stdio.h>
__global__ void helloFromGPU(void){
printf("Hello World From GPU!\n");
}
int main(void){
printf("Hello World From CPU!\n");
helloFromGPU <<<1, 10>>>();
cudaDeviceReset();
return 0;
}
Then I use the following code: nvcc -arch sm_52 hello.cu -o hello
Run ./hello, The output is:
Hello World From CPU!
Why does the device code not work? My OS is Ubuntu 22.04, and CUDA Toolkit version is 12.1, thanks!
-arch=sm_xx