How do I know if my code was executed on GPU?

During compiling, I get messages that a kernel is generated:

Accelerator kernel generated
Generating Tesla code
107, !$acc loop gang ! blockidx%y
109, !$acc loop gang, vector(128) ! blockidx%x threadidx%x

But how do I know if my code was executed really using the GPU?


Hi Hendrun,

Setting the environment variable “ACC_NOTIFY=1” will output a line every time code is executed on the GPU.

Also, you can set “PGI_ACC_TIME=1” to have the binary print out basic profile information on the timing of your GPU code at the end of the run.

There are also a whole host of profilers, such as Nvidia’s nvprof, which will show you not only if it ran, but how well it runs on the GPU.

  • Mat

I like to use TechPowerUp GPU-Z which provides many details like bus load, memory load, gpu load, … and details about the card, slot, … which can help identify performance issues.

For example if you see the Bus load is very high and the GPU performance is lower, then the bus could be the limiting factor. So you could examine if it is in the correct type slot (i.e. if card supports PCIe 3.0 x16 but is in a PCIe 2.0 x8), or that there is a lot of memory movement (memory load very high compared to GPU).