old goto-structur crashes

General OpenMP discussion

old goto-structur crashes

Postby HeinzM » Sat Nov 10, 2012 6:12 am

Hello,

I have an old Fortran-code, starting in the 70ties with Fortran 66. It does cfd-computations. The input-part is made of a goto-struktur,
for example:

read(datnr,500) word
if(Word.ne.'word1) goto 11

<do something on input>

read(datnr,500) word
11 if(word.ne.'word2') goto 12

<do something on input>

read(datnr,500) word
12 if(word.ne.'word3') goto 200

<and so on>


Needless to say, that no one will write in this style today. But this part of code works since many years.
Now I want to use OpenMP with the newest Intel-compiler. When I compile this code with /Qopenmp and so an, the code crashes with a stack overflow at some of the above gotos. Especially at those, where the jumps gos over many lines of the code. This is even the cas, if I do not specify any OpenMP-order.

Is there a problem with goto? Goto in parrallel-regions and goto out of them forbidden. But goto outside of parrallel-regions is not.

Do you have an idea, what is going wrong?

Thanks and regards
Heinz
HeinzM
 
Posts: 17
Joined: Sat Nov 03, 2012 7:22 am

Re: old goto-structur crashes

Postby MarkB » Sat Nov 10, 2012 11:16 am

Hi Heinz,

I suspect the gotos are not the real problem here. Without /Qopenmp the compiler can allocate large local arrays on the heap to save stack space. However, compiling with /Qopenmp forces all local variables which do not have the SAVE attribute to be stack allocated in case the routine is called from multiple threads. You could try increasing the stacksize: you may need to use both the /F option (for the master thread's stack) and the OMP_STACKSIZE environment variable (for all the other threads).

The is some useful discussion on the topic here: http://software.intel.com/en-us/forums/topic/301590

Hope that helps,
Mark.
MarkB
 
Posts: 422
Joined: Thu Jan 08, 2009 10:12 am

Re: old goto-structur crashes

Postby HeinzM » Sun Nov 11, 2012 4:50 am

Hi Mark,

I found out by trial and error, that commenting out some gotos, the code crashes no more. So the gotos mast have an effect.

Thanks for your posting. I realize, that compiling with /Qopenmp results in absolutely different work of the compiler.

I will try to increase the stack size. Is there a limit for stack size? As I know the stack is in the cache of the processor. I use an i7 board with 8MB cache. So when using 8 threads, each thread can not have more than 1MB?

Thank you and regards
Heinz
HeinzM
 
Posts: 17
Joined: Sat Nov 03, 2012 7:22 am

Re: old goto-structur crashes

Postby MarkB » Sun Nov 11, 2012 1:27 pm

HeinzM wrote:
I will try to increase the stack size. Is there a limit for stack size? As I know the stack is in the cache of the processor. I use an i7 board with 8MB cache. So when using 8 threads, each thread can not have more than 1MB?



The stack size is unrelated to the size of the cache. There may be some limit imposed by the OS, but it will likely be in the Gb range.
MarkB
 
Posts: 422
Joined: Thu Jan 08, 2009 10:12 am


Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 9 guests