Initializing the Accelerator

In one of your early programs in “The PGI Accelerator Programming Model on NVIDIA GPUs Part 1” you comment out the line acc_init which is in the code. You later uncomment the that line and show how much faster the program (or at least thta section of it) runs when the acclerator has been initialzed. This is all true as far as it goes.

But the program as a whole does not run faster. You stll must initialize the accelerator, but now you do it separately from the part that is moves data and calculates on the GPU. It is faster, but the whole prgram is not faster.

Would it not be better to start the accelartor initialization be the program is ever run?


THX 1138
Then that part would never figure in to the execution and time of the program.

Hi THX 1138,

On Linux, the CUDA driver will power down devices when not in use. It takes approximately 1 second per device to bring them back up with this cost being incurred upon first use. “acc_init” was added so that a programmer could separate out this cost. Otherwise it would be incurred upon entry into the first accelerator region.

Would it not be better to start the accelartor initialization be the program is ever run?

The utility ‘pgcudainit’ will hold devices open so they will not be powered down. Running pgcudainit in the background or from another shell will eliminate this initialization cost.

Hope this helps,
Mat