good values for width in vector and parallel directives

Hi all,
When we want to explicitly tell how the compiler should compile our code to run on the Accelerator, the parallel (width) and vector(width) are of my concern.

Looking at the “width” value automatically determined by the compiler, I see they can get different values like 8, 16, 128 or sometimes 256. I’m not sure how we determine a good value for “width” if we want to explicitly select it by ourself.


!$acc do parallel (16)
   do i=1, 100


Hi Tuan,

The parallel and vector clauses correspond to how your compute kernels are scheduled on the accelerator. “parallel” is the number of multi-processor threads and vector is the number of SIMD (vector) threads.

In general, the state of the art way to choose the optimal schedule for a GPU is to try all options. As Micheal Wolfe likes to say, for you students, there is a PHD thesis here.

The compiler will generate a default schedule but there is no guarantee that it’s optimal. Best thing to do is experiment and see if you can improve the performance.

  • Mat

Thanks a lot, Mat.