OS is CentOS 8
$ nvidia-smi
Fri May 8 16:38:21 2020
±----------------------------------------------------------------------------+
| NVIDIA-SMI 390.132 Driver Version: 390.132 |
|-------------------------------±---------------------±---------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 NVS 5400M Off | 00000000:01:00.0 N/A | N/A |
| N/A 42C P8 N/A / N/A | 0MiB / 964MiB | N/A Default |
±------------------------------±---------------------±---------------------+
±----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 Not Supported |
±----------------------------------------------------------------------------+
Here is the code:
#include <cstdio>
#include “cuda.h”
void CPUFunction()
{
printf(“Runs on the CPU.\n”);
}
global
void GPUFunction()
{
printf(“Runs on the GPU.\n”);
}
int main()
{
CPUFunction();
GPUFunction<<<1, 1>>>();
cudaDeviceSynchronize();
return EXIT_SUCCESS;
}
Output:
Runs on the CPU.