Can someone tell me why the following code below doesn't work when compiled under omp? From the debugger the error is given as:
forrtl: severe (408): fort: (10): Subscript #3 of the array BIGA has value 1 which is greater than the upper bound of -1
If I move the initA() call into the parallel section, then the code works fine. While this is trivial to do in this example, it is not so easy to do in the actuall code this example simulates. I've used this type of coding before without problems, but with a larger program (or perhaps with version 11 of IVF?), I'm having problems.
Does anyone have suggestions regading how to handle large global arrays that need to be threadprivate?
module globalVars implicit none integer na real(8), allocatable:: bigA(:,:,:) !$omp threadprivate(bigA) contains subroutine initA () allocate( bigA(na,na,na) ) end subroutine initA end module globalVars program testomp use globalVars implicit none integer i,j,k na = 500 call initA () !$omp parallel !$omp do do i=1,na do j=1,na do k=1,na bigA(i,j,k) = real(i)*real(j)*real(k) end do end do end do !$omp end do pause !$omp end parallel stop end program testomp