I like to switch my code from OpenMP to OpenACC. In my OpenMP code, I pass “thread-dependent” arrays to designated threads. I am wondering whether I can do the same thing using OpenACC.
I outline the function I need in the following code snippet: I want to pass two more variables, “istart” and “iend”, into the subroutine “work” which only takes one input argument. Thanks.
module model integer :: istart,iend !$omp threadprivate(istart,iend) implicit none contains subroutine work(iarray) ... integer iarray(10000) do i = istart, iend iarray(i) = i * i enddo end subroutine work end module model program main use parameters !not completely necessary here use model implicit none ... integer iarray(10000) N = 10000 !$omp parallel private(iam, nthreads, chunk) nthreads = omp_get_num_threads() iam = omp_get_thread_num() chunk = (N + nthreads – 1)/nthreads istart = iam * chunk + 1 iend = min((iam + 1) * chunk, N) call work(iarray) !$omp end parallel end program main