CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Strange behaviour gMax in parallel.

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   April 19, 2011, 11:06
Question Strange behaviour gMax in parallel.
  #1
Senior Member
 
Francois
Join Date: Jun 2010
Posts: 107
Rep Power: 7
Fransje is on a distinguished road
Hello all,

A small technical questions which baffles me..

I'm modifying a remapping boundary condition. All works fine on one processor, but switching to a run in parallel, I get "interesting" results.

If I do:
Code:
Pout << newUValues.size() << endl;
Pout << gMax(newUValue) << endl;
I get a value for gMax(newUValues) on all processors, even if newUValues.size() has returned 0.

And if I add:
Code:
if( newUValues.size() > 0 )
{
    Pout << gMax(newUValues) << endl;
}
The simulation run crashes immediately, although only the processors where the condition newUValues.size() > 0 have run the Pout statement..

Mighty weird. Any ideas why this could be happening?

Kind regards,

Francois.
Fransje is offline   Reply With Quote

Old   April 20, 2011, 04:21
Default
  #2
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 14
l_r_mcglashan will become famous soon enough
What is the error message, i.e. why does it 'crash'? gMax will give you the maximum value in the field newUValue over all processors. Pout outputs to screen the result on each processor; why not just use Info? I'm guessing there's a problem with your if statement in that perhaps there is a loss of synchronisation, or a problem maybe with gMax only being called on some processors, although I can't say for sure without digging more.

One thing I don't understand is why you're using the if statement?
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   April 20, 2011, 05:26
Default
  #3
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 12
eugene is on a distinguished road
You can't put global reduce functions inside an if statement that will evaluate differently for different processors. The whole point of a gMax (global maximum) statement is that it will be evaluated for all cpus. If some of them can't evaluate the gMax function because it is inside a heterogeneous if statement, then of course the code will crash. You should first evaluate gMax before the if statement and then do whatever you want to do based on the size of the list.
eugene is offline   Reply With Quote

Old   April 20, 2011, 11:59
Smile
  #4
Senior Member
 
Francois
Join Date: Jun 2010
Posts: 107
Rep Power: 7
Fransje is on a distinguished road
Dear Laurence, dear Eugene,

Thank you both for your fast replies! It's all clear now.

On hindsight, a "stupid" mistake.. I had somehow misunderstood the true meaning of "global maximum".

But with the help of Eugene's explanations I can understand what's going on..
gMax is defined in FieldFieldFunctions.C, and when called, it makes a call to PstreamReduceOps.H and does a reduce() operation on the variable being gMax-ed to obtain the data on all processors. So if a processor doesn't answer to the reduce() call, all hell will break lose.

@Laurence: The if statement was because I do some computations (boundary layer rescalling) one the variable being if-ed, and that somewhere along the way I was using gMax. So the case here was just a simplified example.

Thank you both for your help.

Kind regards,

Francois.
Fransje is offline   Reply With Quote

Reply

Tags
directmappedvelocityflux, gmax, parallel error, pout

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Nut behaviour with K-OmegaSST nicolarre OpenFOAM Running, Solving & CFD 10 January 29, 2015 12:53
Strange behaviour when using LienCubicKE and NonlinearKEShih hani OpenFOAM Running, Solving & CFD 20 March 6, 2013 11:06
Strange behaviour because of contact angle (interfoam) Kim123 OpenFOAM Running, Solving & CFD 0 January 12, 2011 11:16
A Strange Problem in making Parallel (Ansys/CFX 12) a.sarami CFX 13 October 7, 2010 01:33
strange behaviour of GGI in parallel on axis symmetrical case A.Devesa OpenFOAM Running, Solving & CFD 0 April 6, 2010 03:58


All times are GMT -4. The time now is 04:37.