Hello everyone,
I need to reduce some arrays inside a parallel region. Due to Openacc I can’t reduce the arrays. Below is an example of what I am trying to achieve. I thought about reducing to scalar however after that I can’t store them back to the array because I have race condition. Also, I tried the atomic clause but I can’t write to an allocatable variable.
Thank you in advance!
!$acc parallel loop collapse(2) independent private (Y)
Do L=1,Nt !- External loop for angles
Do K=1,Nc ! External loop for velocities
! Boundary conditions
Do i=1,Nx
Y(i,1)=..
End do
Do i=2,Ny
Y(1,i)=..
End do
!Calculation of Y
Do I=2,Nx
Do J=2,Ny
Y(I,J)=(-Y(I-1,J-1)*Td00-Y(I,J-1)*Td10-Y(I- &
1,J)*Td01+CoFy)/Td11
End do
End do
!Sum Reduction
Do i=1,Nx
Do j=1,Ny
Ux(i,j)=Ux(i,j)+Y(i,j)
Uy(i,j)=Uy(i,j)+Y(i,j)
End do
End do
!
End do
End do