Hi, guys. I'm a new hand of openmp. I encounter some problems related to deallocating allocatable array in openmp loop.
The main reason is the array is too large. An example code is following:
program omptest use omp_lib implicit none INTEGER :: I,k,J integer,pointer :: b(:) !$OMP PARALLEL DO PRIVATE(i,b,k) DO I=1,2490000 allocate(b(67214259)) k=OMP_get_thread_num() deallocate(b) END DO !$OMP END PARALLEL DO END PROGRAM
When the maximum bound of i is large, like 2490000, the program will break at deallocate(b)
I have also tried this version:(to make b as a threadprivate variable) but it is still useless
module da implicit none integer,allocatable,save :: b(:) !$omp threadprivate(a,b) contains subroutine ji(i) integer :: i allocate(b(672142590)) end subroutine end module program omptest use omp_lib use da implicit none INTEGER :: I,k,J !$OMP PARALLEL DO PRIVATE(i,k) DO I=1,2490000 call ji(i) k=OMP_get_thread_num() deallocate(b) END DO !$OMP END PARALLEL DO
I guess it might because of the size of heap. I have tried to divide I into 10 parts, and makes parallel computing separately( serially) but it is still no use.
Could any body help me to find out the solution? Thank you very much!
My development environment is VS2012 update 4+Intel cluster studio xe 2013 sp1