Ok, I am desperate. I am relatively new to OMP and am having a lot of problems with a seemingly simple parallelization in fortran. The code below is the smallest portion of a much larger code producing this kind of error. All this snippet is meant to do, is read the rows of a shared two dimensional complex array (which here I have filled with arbitrary numbers) into parallel instances of a private one dimensional array (for further parallel processing in the finished code).
Using ifort, once the loop has been executed for roughly 3000 values of the iterator j, the program crashes with the error:
* glibc detected * ./run.sh: munmap_chunk(): invalid pointer: 0x00002ac9b47ffde0 ***
gfortran on the other hand does not produce any errors, but yields all together nonsensical output in the completed program, which leads me to believe there is a mistake that gfortran isn´t picking up. Everything works as it should in serial.
PROGRAM partest
implicit none
INTERFACE
INTEGER FUNCTION OMP_GET_THREAD_NUM()
END FUNCTION
END INTERFACE
INTEGER :: i,j,npot,N,nproc
COMPLEX *16, ALLOCATABLE :: temp_wv(:,:),tv(:)
N=4096
npot=140
ALLOCATE(temp_wv(N,npot),tv(npot))
print *, "assign random values to array"
DO i=1,N
DO j=1,npot
temp_wv(i,j)=exp(dcmplx(0,i+j))
ENDDO
ENDDO
print *,"parallel region"
!$OMP PARALLEL DO &
!$OMP DEFAULT(NONE) &
!$OMP PRIVATE(tv,nproc) &
!$OMP SHARED(temp_wv,N,npot)
DO j=1,N
nproc=OMP_GET_THREAD_NUM()
print*, "THREAD", nproc, "ITERATOR", j,N
tv=temp_wv(j,:)
ENDDO
!$OMP END PARALLEL DO
print *, "DONE"
END PROGRAM partest