Stack overflow when using OpenMP in Intel Fortran in Windows

General OpenMP discussion

Stack overflow when using OpenMP in Intel Fortran in Windows

Postby Wennilo » Mon Sep 03, 2012 8:33 pm

I use Intel Fortran for windows to compile my fortran code. When I use OpenMP in my code, it is always say "stack overflow". Somebody tell me that maybe my array is too big, but actually not! Even I use the simplyest OpenMp test code "hello world", the result is also same! I found that if I put the Openmp code in front of a subrountine in my code, it can excute! but if below this subrountine or no "stop" between the openmp code and the subrountine , stack overflow! :cry: :cry:

I try use Fn for setting the stacksize, but also fail to excute.

Thank you very much, if you can solve my problem!!


Wenby.
Wennilo
 
Posts: 6
Joined: Thu Aug 30, 2012 4:42 pm

Re: Stack overflow when using OpenMP in Intel Fortran in Win

Postby ftinetti » Tue Sep 04, 2012 3:51 am

Hi Wenby,

Please take a look and try setting OMP_STACKSIZE according to your needs. I don't know how the stack is handled in windows ifort, though... there are several issues in Linux/UNIX, but usually eventual problems are solved playing around ulimit...

Fernando.
ftinetti
 
Posts: 567
Joined: Wed Feb 10, 2010 2:44 pm

Re: Stack overflow when using OpenMP in Intel Fortran in Win

Postby Wennilo » Tue Sep 04, 2012 5:22 am

ftinetti wrote:Hi Wenby,

Please take a look and try setting OMP_STACKSIZE according to your needs. I don't know how the stack is handled in windows ifort, though... there are several issues in Linux/UNIX, but usually eventual problems are solved playing around ulimit...

Fernando.

Thanks a lot.

Yes, I know this solution in Linux. But I wanna to find such kind solution in Windows.....
Wennilo
 
Posts: 6
Joined: Thu Aug 30, 2012 4:42 pm

Re: Stack overflow when using OpenMP in Intel Fortran in Win

Postby ftinetti » Tue Sep 04, 2012 5:31 am

Yes, I know this solution in Linux. But I wanna to find such kind solution in Windows.....

I see, did you try setting OMP_STACKSIZE?

A quick search provided
http://software.intel.com/en-us/article ... ion-fault/
Did you see/use it?

Fernando.
ftinetti
 
Posts: 567
Joined: Wed Feb 10, 2010 2:44 pm

Re: Stack overflow when using OpenMP in Intel Fortran in Win

Postby Wennilo » Wed Sep 05, 2012 2:28 am

ftinetti wrote:
Yes, I know this solution in Linux. But I wanna to find such kind solution in Windows.....

I see, did you try setting OMP_STACKSIZE?

A quick search provided
http://software.intel.com/en-us/article ... ion-fault/
Did you see/use it?

Fernando.

Thank you, Fernando.
I have already tried /Fn compiler option, it looks like can work. but when I excute the .exe file after compiled, Windows always showed "*.exe has stop working, windows can check this problem......" :cry:

Follow your url, I just tried -heap -arrays, nothing happened.

So, maybe I need transfer my codes to Linux.

Thank you very much for this very usful information!

Wenby.
Wennilo
 
Posts: 6
Joined: Thu Aug 30, 2012 4:42 pm

Re: Stack overflow when using OpenMP in Intel Fortran in Win

Postby ftinetti » Wed Sep 05, 2012 3:38 am

I have already tried /Fn compiler option, it looks like can work. but when I excute the .exe file after compiled, Windows always showed "*.exe has stop working, windows can check this problem......"


Strange... would you post the code? maybe the one you were referring to
I use the simplyest OpenMp test code "hello world", the result is also same!


ifort version?

Fernando.
ftinetti
 
Posts: 567
Joined: Wed Feb 10, 2010 2:44 pm

Re: Stack overflow when using OpenMP in Intel Fortran in Win

Postby Wennilo » Wed Sep 05, 2012 7:40 pm

ftinetti wrote:
I use the simplyest OpenMp test code "hello world", the result is also same!


ifort version?

Fernando.

version----11.0.061. I dont think the ifort compiler has problems. Of course, if I test a very simply code, and inserd the "hello world" test code, no problem, OpenMP works. But, in my codes (very complicated), it doesnt work. the problem I think is my very compilcated subrountine. If I get rid of these subrountines, ok, "hello world" works. but it is very strange that I end the OpenMP before these subrountines, and I think, the Openmp code would not be influenced by the subroutines below.
Wennilo
 
Posts: 6
Joined: Thu Aug 30, 2012 4:42 pm

Re: Stack overflow when using OpenMP in Intel Fortran in Win

Postby Wennilo » Wed Sep 05, 2012 7:48 pm

ftinetti wrote:
I have already tried /Fn compiler option, it looks like can work. but when I excute the .exe file after compiled, Windows always showed "*.exe has stop working, windows can check this problem......"


Strange... would you post the code? maybe the one you were referring to
Fernando.


Yes, please attend that "ram, Rin, Rout, dRin,......, A10,A11,A12" are complex variables.

For example, If I inserd a "hello world" test code in front of "call homonic(r,ram,jar)", and stop. No problem, it works.
Without "stop", stack overflow!! I really do not know what happens..........
Thank you!
-------------------------------------------------------------------------
do l=2,8
do m=l,-l,-1
do k=-3+2*(l-2),25+2*(l-2)
!$omp parallel
!id = omp_get_thread_num()
print *, id,'Hello World'
!$omp end parallel

w=m*wp+k*wr
if(w.le.0d0) cycle
stop
call homonic(r,ram,jar)

c call omp_set_num_threads(1)
!$omp parallel do Private(r,tt,phi,pr,Rin,dRin,ddRin,Rout,dRout,
* ddRout,Bin,Bh,Ch,A10,A11,A12,eph),
* SHARED(ZZHa,ZZ8a,ra,pra,phia,rp)
do ii=0,is
r=ra(ii)
tt=ii*0.01d0*istep*Utot !0d0
phi=phia(ii) !0d0
pr=pra(ii) !0d0

call MST_R(r,ram,Rin,dRin,ddRin,Rout,dRout,
* ddRout,Bin,Bh,Ch)

call CoeffA(r,pr,E,Lz,A10, A11, A12)
eph=dcmplx(0,w*tt-m*phi)
ZZHa(ii)=(Rin*A10-dRin*A11+ddRin*A12)*EXP(eph)
ZZ8a(ii)=(Rout*A10-dRout*A11+ddRout*A12)*EXP(eph)
enddo ! END ii CYCLE
!$ omp end parallel do
write(*,*) tt,r,phi,pr
H=0.01d0*istep*Utot
call cpu_time(finish)
write(*,*)finish-start


enddo ! end k cycle
enddo ! end m cycle
enddo ! end l cycle
--------------------------------------------------
Wennilo
 
Posts: 6
Joined: Thu Aug 30, 2012 4:42 pm

Re: Stack overflow when using OpenMP in Intel Fortran in Win

Postby ftinetti » Thu Sep 06, 2012 3:45 am

I see...

Please:
1) Include the declarations of every variable (not those in the subprograms, just the ones in the code you send). Furthermore, it would be very useful if you can post a complete example based on this code, i.e. one which could be compiled and run. Leave subprograms without code. Later, you could add the local data and later, the code.
2) Take into account that subprograms should be thread-safe. Common blocks, I/O, and save variables usually imply that subprograms are not thread safe.

Fernando.
ftinetti
 
Posts: 567
Joined: Wed Feb 10, 2010 2:44 pm

Re: Stack overflow when using OpenMP in Intel Fortran in Win

Postby Wennilo » Thu Sep 06, 2012 7:46 pm

ftinetti wrote:I see...

Please:
1) Include the declarations of every variable (not those in the subprograms, just the ones in the code you send). Furthermore, it would be very useful if you can post a complete example based on this code, i.e. one which could be compiled and run. Leave subprograms without code. Later, you could add the local data and later, the code.
2) Take into account that subprograms should be thread-safe. Common blocks, I/O, and save variables usually imply that subprograms are not thread safe.

Fernando.

thank you.
Program main
Use omp_lib
implicit real*8(a-h,o-z)
parameter jmin=2,jmax=20
real*8 Lz,phlm(jmin:jmax,-jmax:jmax),ra(0:2000), pra(0:2000),
* phia(0:2000)
c real*8, allocatable :: ra(:)
c real*8, allocatable :: pra(:)
c real*8, allocatable :: phia(:)
c Complex(kind=8) , allocatable :: ZZHa(:)
c Complex(kind=8) , allocatable :: ZZ8a(:)
Complex(kind=8) hh,ZH,wave,h22,A10,A11,A12,hhe,hho,Rin,Rout,dRin,!,h21,h33,h32,h44,h66,h65,
* dRout,ddRin,ddRout,ZZH,ZZ8,SZH,SZ8,eph,ZZHI,ZZ8I,hlmk,
* ZHS,Z8S,Bin,Va4,Bh,Ch ,ram,ZZHa(0:2000),ZZ8a(0:2000) !h64,h62,h77,h88
common /group1/ Ub,Up,a,Pi,r
common /group2/ w,dr1,dr2,dr3,rc1,rc2,Elm
common /group3/ l,m
common /group4/ Utot,Ueff,rat
common /b/ bd
common /e/ dLdt
Wennilo
 
Posts: 6
Joined: Thu Aug 30, 2012 4:42 pm

Next

Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 3 guests