Questions about OPENMP to transfer serial to parallel

General OpenMP discussion

Re: Questions about OPENMP to transfer serial to parallel

Postby alex » Mon May 07, 2012 12:42 am

MarkB wrote:Time to start using a debugger, I think.
Do you get the error when running with OpenMP but on only one thread?


Hello MarkB,

I used export OMP_NUM_THREADS=1, then run the program again, but the same problem happened while the OMP_STACKSIZE set to 1.5G and the ulimit -s unlimited set.
how to solve my problem that I just want to parallelize the DO loop which I posted before? Is it so hard to solve?

If I use a debugger, how to use? I never use debugger in the linux platform.



best wishes
yours alex
alex
 
Posts: 17
Joined: Thu Apr 19, 2012 1:23 am

Re: Questions about OPENMP to transfer serial to parallel

Postby ftinetti » Mon May 07, 2012 3:33 am

Hi Alex,

I used export OMP_NUM_THREADS=1, then run the program again, but the same problem happened while the OMP_STACKSIZE set to 1.5G and the ulimit -s unlimited set.

combined with
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
libpthread.so.0 00007F7863F699CB Unknown Unknown Unknown
libiomp5.so 00007F786449E2A8 Unknown Unknown Unknown

makes me think there is some problem on data (uninitialized private?)... but it depends on too many unknown information, e.g. is there any call from subroutine1?

how to solve my problem that I just want to parallelize the DO loop which I posted before? Is it so hard to solve?

Well... I've found that hardness is usually a problem of the involved code: number of lines, data access(es), control structures, etc., and maybe subroutine1 is really complex. I think you should look at the data you use in the subroutine and explicitly "declare" each one either as private, shared, or reduction.

Anyway, I think the best suggestion is that of MarkB: use a debugger.

Fernando.

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

Re: Questions about OPENMP to transfer serial to parallel

Postby alex » Wed May 09, 2012 8:25 pm

ftinetti wrote:Hi Alex,

I used export OMP_NUM_THREADS=1, then run the program again, but the same problem happened while the OMP_STACKSIZE set to 1.5G and the ulimit -s unlimited set.

combined with
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
libpthread.so.0 00007F7863F699CB Unknown Unknown Unknown
libiomp5.so 00007F786449E2A8 Unknown Unknown Unknown

makes me think there is some problem on data (uninitialized private?)... but it depends on too many unknown information, e.g. is there any call from subroutine1?

how to solve my problem that I just want to parallelize the DO loop which I posted before? Is it so hard to solve?

Well... I've found that hardness is usually a problem of the involved code: number of lines, data access(es), control structures, etc., and maybe subroutine1 is really complex. I think you should look at the data you use in the subroutine and explicitly "declare" each one either as private, shared, or reduction.

Anyway, I think the best suggestion is that of MarkB: use a debugger.

Fernando.

Fernando.


Thanks Fernando,
I use a debugger and found the reason some array not allocated in the do loop , so I allocate the array inner the doloop and then I can compile it and run it.
in the doloop, I use subroutine1 which not only need shared variables but need use private variables.
but the answer is to my surprise, I get a variable "NAN", this variable is a shared one which used in subroutine1 . and in subroutine1 variable = variable + 1 when the subroutine1 is called each time.
I use a debugger again ,but not find any problem, how can I solve the problem?

thanks
alex
 
Posts: 17
Joined: Thu Apr 19, 2012 1:23 am

Re: Questions about OPENMP to transfer serial to parallel

Postby ftinetti » Thu May 10, 2012 3:07 am

Hi Alex,

I get a variable "NAN", this variable is a shared one which used in subroutine1 . and in subroutine1 variable = variable + 1 when the subroutine1 is called each time.

Again, hard to say, without having the actual code... just "side" questions: variable should be REAL, DOUBLE, or some floating point type, right? do you protect the assignment with any synchronization? I suggest critical. If the problem persists... well I think I would need the actual code, but I cannot give by granted I would be able to find any bug, however...

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

Re: Questions about OPENMP to transfer serial to parallel

Postby alex » Thu May 10, 2012 7:03 pm

ftinetti wrote:Hi Alex,

I get a variable "NAN", this variable is a shared one which used in subroutine1 . and in subroutine1 variable = variable + 1 when the subroutine1 is called each time.

Again, hard to say, without having the actual code... just "side" questions: variable should be REAL, DOUBLE, or some floating point type, right? do you protect the assignment with any synchronization? I suggest critical. If the problem persists... well I think I would need the actual code, but I cannot give by granted I would be able to find any bug, however...

Fernando.


hi Fernando, most of variables are double precison data except satid, here I give you the doloop block which thought to be erroneous

!!arrays used in the lower loop are the shared arrays(zdp,lon,sod,lat,oldtec21)

!$OMP PARALLEL DO DEFAULT(SHARED) &
!$OMP PRIVATE(COSRAD,FGCSRAD,FBCSRAD,LATD,LONGD,UTCT,P,PCS,K,II,JJ,KK,MJT1,MJT2,MJT,NEWSTEC,NEWVTEC,VTECRMS,OLDSTEC,WT,YG,FACT1,FACT2,snindex)

the general construct for the doloop is upper , can you give me some advices?

best regards
Last edited by alex on Fri May 11, 2012 8:34 pm, edited 1 time in total.
alex
 
Posts: 17
Joined: Thu Apr 19, 2012 1:23 am

Re: Questions about OPENMP to transfer serial to parallel

Postby alex » Thu May 10, 2012 11:27 pm

Hi MarkB,

I put a question into the end of this thread, I invite you to help me to solve the problem.
thanks
yours alex
alex
 
Posts: 17
Joined: Thu Apr 19, 2012 1:23 am

Re: Questions about OPENMP to transfer serial to parallel

Postby ftinetti » Fri May 11, 2012 3:24 am

Hi Alex,

Please include the code between code tags. Also,
a) please send variable declarations, specifically variable NUMGIV
b) note that there are race conditions on array WORK
c) what is the variable that gets NAN as value?

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

Re: Questions about OPENMP to transfer serial to parallel

Postby alex » Fri May 11, 2012 8:38 pm

ftinetti wrote:Hi Alex,

Please include the code between code tags. Also,
a) please send variable declarations, specifically variable NUMGIV
b) note that there are race conditions on array WORK
c) what is the variable that gets NAN as value?

Fernando.


Hi Fernando,
a)NUMGIV declared as 'integer*4'
b)array work is the in race conditions? you means in the line 'call accmlt()'?
c)the variable that gets NAN I have posted in the upper thread. that is "SIGMA0" (real*8)
alex
 
Posts: 17
Joined: Thu Apr 19, 2012 1:23 am

Re: Questions about OPENMP to transfer serial to parallel

Postby alex » Sat May 12, 2012 6:12 am

ftinetti wrote:Hi Alex,

Please include the code between code tags. Also,
a) please send variable declarations, specifically variable NUMGIV
b) note that there are race conditions on array WORK
c) what is the variable that gets NAN as value?

Fernando.


hi Fernando,

I have another question to ask you:

for the upper code, why the error information inform me that P array is not allocated ?

so I just want to use P(32,32) and PCS(200) as the private variable ,so I allocate(p(32,32)) and allocate(pcs(200)) during each loop beginning. am I wrong?
how to use arrays as private variables in each thread?
alex
 
Posts: 17
Joined: Thu Apr 19, 2012 1:23 am

Re: Questions about OPENMP to transfer serial to parallel

Postby MarkB » Mon May 14, 2012 12:24 pm

Have you checked that all your private variables are initialized correctly inside the parallel region?
MarkB
 
Posts: 428
Joined: Thu Jan 08, 2009 10:12 am

PreviousNext

Return to Using OpenMP

Who is online

Users browsing this forum: Google [Bot] and 12 guests