Problem in sequential code with -openmp

General OpenMP discussion

Problem in sequential code with -openmp

Postby zoyo » Thu Jun 07, 2012 2:45 am

Hi,
My task is to parallelize a serial code.When i tried to do it, at first , i just added -openmp when i compile the serial code but i found an unexpected error: some arraies becomes NaN which should be a constant, while anothers are correct.
Before i did that, i wrote a demo to test the environment, which is ok.
Anybody else had met this situation?

thx!

zoyo
zoyo
 
Posts: 5
Joined: Wed May 16, 2012 7:08 am

Re: Problem in sequential code with -openmp

Postby MarkB » Thu Jun 07, 2012 9:15 am

zoyo wrote:Hi,
i just added -openmp when i compile the serial code but i found an unexpected error: some arraies becomes NaN which should be a constant, while anothers are correct.


Are you using Fortran? And does your code depend on the values of local variables being preserved between subroutine calls?
If so, then you need to ensure they are declared with the SAVE attribute.
MarkB
 
Posts: 408
Joined: Thu Jan 08, 2009 10:12 am

Re: Problem in sequential code with -openmp

Postby zoyo » Sun Jun 10, 2012 5:01 am

MarkB wrote:
zoyo wrote:Hi,
i just added -openmp when i compile the serial code but i found an unexpected error: some arraies becomes NaN which should be a constant, while anothers are correct.


Are you using Fortran? And does your code depend on the values of local variables being preserved between subroutine calls?
If so, then you need to ensure they are declared with the SAVE attribute.


Thanks for your reply ,MarkB!
yes, the code is in Fortran, and all arraies are defined in several common blocks, so as defined in the syntax, they should be SHARED, right?
And is there a possibility that the problem comes with the COMMON BLOCKS? Should i try to replace them with modules?
zoyo
 
Posts: 5
Joined: Wed May 16, 2012 7:08 am

Re: Problem in sequential code with -openmp

Postby zoyo » Tue Jun 12, 2012 10:16 pm

Excuse me, and it sounds like a joke, the problem is that i add -openmp option in the process of generating .o files in Makefile. And man only need to do so in the instruction of link.
And thanks again,MarkB!
zoyo
 
Posts: 5
Joined: Wed May 16, 2012 7:08 am

Re: Problem in sequential code with -openmp

Postby MarkB » Wed Jun 13, 2012 1:57 am

Ok, great: glad you solved the problem!
MarkB
 
Posts: 408
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