Hello,
I would like to profile the performance of an OpenACC C Program. I have to view the C source code as a blackbox so I cannot just create a special program for performance testing (but I can add my own function calls).
What do I want to do?
I would like to get metrics on the data movement (Host to Device, Device to Host) for specific OpenACC regions and their execution time (when executed on GPU and CPU (multicore)). But I need additional information on the content of
some variables before the OpenACC regions are entered.
What I have done so far/How I thought I can solve this:
For now I have just printed the content of variables to stdout and measured the execution time by simply getting the difference beween the time when the OpenACC Region begins and ends. I think that I cannot measure the memory
transfer with this setup. So some code might look like:
printf"SomeVar=%d\n", SomeVar) );
struct timeval tim;
gettimeofday(&tim, NULL);
t1=tim.tv_sec+(tim.tv_usec/1000000.0);
#pragma acc data copy(SomeArray[0:ArrayLength])
#pragma acc parallel loop gang vector present(SomeOtherArray[0:ArrayLength])
for(i=0; i<ArrayLength; i++){
// Do some calculations
}
gettimeofday(&tim, NULL);
t2=tim.tv_sec+(tim.tv_usec/1000000.0);
printf("for loop took %.6lf seconds \n", t2-t1);
I would then just parse the output and that works fine for me. The problem with this is, that I cannot get the time for the memory transfer (or is it somehow possible?)
When I use pgprof (esp. with --print-gpu-trace), I can get the memory transfer times and the execution time for the parallel region, but not the value for the “SomeVar” variable directly before the loop. This value changes on
different runs and I need to make a connection between this value, the memory transfer times and the time the actual computation needs.
How can I achieve this goal, so I can assess all the metrics? I have searched the official guides for a solution, but I could not find any. But I am still new to OpenACC and I might missed something (although I hope not).
Thanks,
Daniel