Assume that there is a multiple loop inside a parallel region,
!$ACC PARALLEL LOOP GANG
DO k = …
// Something
DO i = 1, 2
DO j = 1, 4
// Something
ENDDO
ENDDO
// Something
END DO
!$ACC END PARALLEL
If I assign 8 workers to the loop inside, like
!$ACC PARALLEL LOOP GANG
DO k = …
// Something
!$ACC LOOP WORKER(8)
DO i = 1, 2
DO j = 1, 4
// Something
ENDDO
ENDDO
// Something
END DO
!$ACC END PARALLEL
How does it behave?
Does it behave like
Worker 1 : i = 1, j = 1
Worker 2 : i = 1, j = 2
Worker 3 : i = 1, j = 3
Worker 4 : i = 1, j = 4
Worker 5 : i = 2, j = 1
Worker 6 : i = 2, j = 2
Worker 7 : i = 2, j = 3
Worker 8 : i = 2, j = 4
or
Worker 1 : i = 1, j = 1, 2, 3, 4
Worker 2 : i = 2, j = 1, 2, 3, 4
Worker 3 to 8 : Not Generated
What about if I make loops like
!$ACC PARALLEL LOOP GANG
DO k = …
// Something
!$ACC LOOP WORKER(2)
DO i = 1, 2
!$ACC LOOP WORKER(4)
DO j = 1, 4
// Something
ENDDO
ENDDO
// Something
END DO
!$ACC END PARALLEL
Is this gramatically correct? If so, how does it behave?