CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Problem with Application based on a faceZone in parallel (https://www.cfd-online.com/Forums/openfoam-programming-development/170252-problem-application-based-facezone-parallel.html)

psilkeit April 27, 2016 11:07

Problem with Application based on a faceZone in parallel
 
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 April 28, 2016 05:25

Additional Info
 
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 April 28, 2016 09:47

Solved
 
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 :)


All times are GMT -4. The time now is 07:09.