openacc workshare?!

In Modern Fortran we use the compact notation for vectors and arrays. for example :

  real :: a(1000,1000,1000),b(1000,1000,1000)

which is generally autovectorized, and to parallelize it we use omp workshare

  !$omp parallel workshare
     a=exp(-b) + b
  !$omp end parallel workshare

Is ther an alternative to openmp workshare in openacc without changing the code ( using loops)?!

Hi cmehdi56131,

You can use array syntax within a “kernels” region and the compiler will parallelize the implicit loops.

  !$acc kernels
     a=exp(-b) + b 
  !$acc end kernels

Hope this helps,


I am also using “kernels” for Fortran array notation code.

Unfortunately, one does not have access to gang, worker, and vector clauses when doing so.

Are there any plans to allow (at lest some) of such clauses on a kernels around array syntax fortran?

For example, something like:

!$acc kernels gang worker vector(32)
a = b+c
d = 2*a

!$acc end kernels

  • Ron

Hi Ron,

In the 2.6 OpenACC draft specifications, they have added “num_gangs”, “num_workers”, and “vector_length” to the “kernels” directive so that you’ll be able to set the widths.

Feel free to send the request to add “gang”, “worker”, and “vector” directly to OpenACC. Though I’m skeptical if they are needed. Do you have a use case?



I think vector_length should be enough.

My use case is that the compiler chooses a vector/worker length on my kernels regions but I would like more control to be able to tell it to use a vector(32) and workers for NVIDIA GPUs.

For example, something like

!$acc kernels
!$acc end kernels

I would want the resulting double loop kernel to be worker(8),vector(32) but I currently have no control over it.