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

Problem with Application based on a faceZone in parallel

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 27, 2016, 12:07
Default Problem with Application based on a faceZone in parallel
  #1
New Member
 
P. Silkeit
Join Date: Jun 2015
Posts: 6
Rep Power: 11
psilkeit is on a distinguished road
Dear FOAMers,
I'm working on a new application which does some calculation based on the pressure values provided on a faceZone.

When I run the case in parallel and make sure that each processor mesh contains parts of the faceZone the calculation runs smoothly and yields the correct results. For information on the parallelization see this thread http://www.cfd-online.com/Forums/ope...tml#post595977

But when one processor mesh contains no faces of the faceZone the application halts and just hangs without doing nothing.

I tried do construct and execute the calculation based on the size of the zoneMesh in the following way to keep the not concerned processor from doing the calculation
Code:
// in constructor
if(zoneFaces.size()==0) // no face of faceZone on processor
{
  // create the variable i want to calculate 
  // with the correct size and equal to zero
  myVar = scalarListList( observerPoints.size())
        forAll(observerPoints,pointI)
            {
                myVar[pointI] =  scalarList(Steps.size(),0.0);
            }
}
else
{
  // lengthy calculations resulting in myVar of 
  // same size and type as above
}

// in code / function

if(zoneFaces.size()!=0) // if there are faces of faceZone on processor
{
  // do the calculation which changes values in myVar
}

// Gathering myVar from all processor
    List<List< List<scalar>>> gatheredStuff(Pstream::nProcs());
    gatheredStuff[Pstream::myProcNo()] = myVar;
    Pstream::gatherList(gatheredStuff);

// Further calculation and writing
    if (Pstream::master())
    {
       // add some contents of gatheredStuff
        if(runTime.outputTime())
            {
              // write results to file
            }
     }
So my idea was that the processors which contain the faces from the faceZone compute the values of myVar and the other processors keep their myVar equal to zero and in the gathering/addition the correct result is achieved.

Sadly when I run the code it reaches the Pstream::gatherList comand and then following error message is produced:
Code:
[0] --> FOAM FATAL IO ERROR: 
[0] error in IOstream "IOstream" for operation operator>>(Istream&, List<T>&) : reading first token
[0] 
[0] file: IOstream at line 0.
[0] 
[0]     From function IOstream::fatalCheck(const char*) const
[0]     in file db/IOstreams/IOstreams/IOstream.C at line 114.
[0] 
FOAM parallel run exiting
[0] 
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD 
with errorcode 1.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
--------------------------------------------------------------------------
mpirun has exited due to process rank 0 with PID 16980 on
node waylon-vm exiting without calling "finalize". This may
have caused other processes in the application to be
terminated by signals sent by mpirun (as reported here).
The code runs without any problem if all processors contain faces of the faceZone. Any ideas why this behavior might happen? is there a better way to restrict some calculations just to the processors concernend. Or is there a fundamental misunderstanding in my approach?

Thanks for any input in advance.

Best regards,
Patrick
psilkeit is offline   Reply With Quote

Old   April 28, 2016, 06:25
Default Additional Info
  #2
New Member
 
P. Silkeit
Join Date: Jun 2015
Posts: 6
Rep Power: 11
psilkeit is on a distinguished road
When no processor contains faces of the zoneFaces and thus myVar is zero on all processors the calculation completes successfully.

Therefore the problem only arises if one processor does the calculation and the other one does not...

Could this be a synchronization problem?
psilkeit is offline   Reply With Quote

Old   April 28, 2016, 10:47
Default Solved
  #3
New Member
 
P. Silkeit
Join Date: Jun 2015
Posts: 6
Rep Power: 11
psilkeit is on a distinguished road
I solved my own problem...

The error was that i called gMin and gMax inside the calculation which communicates over processor boundaries if I'm not mistaken and thus doesn't restict the calcualtion to one processor. Using the normal max/min functions resolved the issue.

Sorry for spaming.. hopefully this may help someone in the future.

Cheers
psilkeit is offline   Reply With Quote

Reply

Tags
parallel code, parallel computaion


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem during mpi in server: expected Scalar, found on line 0 the word 'nan' muth OpenFOAM Running, Solving & CFD 3 August 27, 2018 05:18
problem for parallel processing minaret OpenFOAM Running, Solving & CFD 14 January 20, 2015 00:41
problem about running parallel on cluster killsecond OpenFOAM Running, Solving & CFD 3 July 23, 2014 22:13
Fluent parallel license problem brothershuai Main CFD Forum 0 July 1, 2009 16:41
PROBLEM IN PARALLEL PROGRAMMING WITH MPI Niavarani Main CFD Forum 1 April 20, 2004 07:51


All times are GMT -4. The time now is 20:43.