Hello,
For a program in which I am using do concurrent to accelerate my code on the GPUs I wanted to add OpenACC pragmas to add asynchronous behaviour. To do this, I resorted to simply:
!$acc parallel loop async(1)
do concurrent(j=1:nj, i=1:ni)
end do
However, this resulted in the do concurrent only getting parallelized over vectors instead of gangs and vectors. This made the code really slow.
Here is a sample reproducible (using nvhpc 26.1)
!$acc parallel loop collapse(2)
do j =1, dims ; do i = 1,dims
c(i,j) = alpha * a(i,j) + b(i,j)
end do ; end do
!$acc parallel loop
do concurrent (j=1:dims, i=1:dims)
c(i,j) = alpha * a(i,j) + c(i,j)
end do
When compiled, you will see:
31, Generating NVIDIA GPU code
32, ! blockidx%x threadidx%x collapsed
!$acc loop gang, vector(128) collapse(2) ! blockidx%x threadidx%x
36, Generating NVIDIA GPU code
37, !$acc loop vector(128) ! threadidx%x
!$acc loop seq
Is there a way to retain the do concurrent and use openacc directives ?
Cheers