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

constructor argList and parallel run

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 29, 2013, 07:59
Default constructor argList and parallel run
  #1
Senior Member
 
Join Date: Jan 2012
Posts: 166
Rep Power: 14
maybee is on a distinguished road
hi,
I have questions about the subject mentioned in the title:

1. The first part of the argList constructor is:

Code:
Foam::argList::argList
  372 (
  373     int& argc,
  374     char**& argv,
  375     bool checkArgs,
  376     bool checkOpts
  377 )
  378 :
  379     args_(argc),
  380     options_(argc)
  381 {
  382     // Check if this run is a parallel run by searching for any parallel option
  383     // If found call runPar which might filter argv
  384     for (int argI = 0; argI < argc; ++argI)
  385     {
  386         if (argv[argI][0] == '-')
  387         {
  388             const char *optionName = &argv[argI][1];
  389 
  390             if (validParOptions.found(optionName))
  391             {
  392                 parRunControl_.runPar(argc, argv);
  393                 break;
  394             }
  395         }
  396     }
...
If the first argument of argv starts with a dash (line386) and the the following string is found in the valid paralell options (line 390) method runPar() is called on parRunControl_.
Now runPar is defined as

Code:
void runPar(int& argc, char**& argv)
{
RunPar = true;  //bool RunPar;  //subobject of parRunControl
if (!Pstream::init(argc, argv))           
   {
    Info<< "Failed to start parallel run" << endl;
    Pstream::exit(1);
   }
}
and herein method init(...) out of class reference Pstream:
Code:
bool Foam::UPstream::init(int& argc, char**& argv)    //Spawns slave processes and 
                                                                             //initialises inter-communication
   36 {
   37     FatalErrorIn("UPstream::init(int& argc, char**& argv)")
   38         << "Trying to use the dummy Pstream library." << nl
   39         << "This dummy library cannot be used in parallel mode"
   40         << Foam::exit(FatalError);
   41 
   42     return false;
   43 }
Questions:
1. Method init(...) should spawn slave processes. Where is this happening in init()?
Furthermore when looking up the .C files of class UpStream on my PC I get three different files with three different init() methods. Is the method out of the online OpenFoam library the right one? How am I suppossed to know which one will be used in the code I am analysing?

2. When talking about parallel run what is meant with master process?
I have read already
http://www.openfoam.org/docs/user/ru...s-parallel.php
and
http://www.cfd-online.com/Forums/ope...g-2-2-0-a.html

If I devide the mesh into different sections and assign each section to another processor
which section or processor will be the master and more important what is the meaning of being master ?
maybee is offline   Reply With Quote

Old   November 29, 2013, 09:50
Default
  #2
Senior Member
 
dkxls's Avatar
 
Armin
Join Date: Feb 2011
Location: Helsinki, Finland
Posts: 156
Rep Power: 19
dkxls will become famous soon enough
If you want to figure which process is 'master', this should help
Code:
if (Pstream::master())
{
    // Do something only on master
}
Otherwise, I would also be very happy if somebody who has some insight to this could point out what the master process does and what not.
To my understanding this comes largely into play when talking about input/output.

For example, it would be quite interesting to know which process is writing to a 'summary file', as e.g. the one in the sprayEngineFoam solver:
https://github.com/OpenFOAM/OpenFOAM...startSummary.H

'OFstream logSummaryFile' is (and has to be) initialized in all processes, but in the end there will only be one file on the HDD. I haven't had time to dig through the source code, but it would be interesting to know, how OpenFOAM handles such kind of I/O operations in parallel runs.
dkxls is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
parallel run is slower than serial run (pimpleFoam) !!! mechy OpenFOAM 18 August 17, 2016 17:19
simpleFoam parallel AndrewMortimer OpenFOAM Running, Solving & CFD 12 August 7, 2015 18:45
Can not run OpenFOAM in parallel in clusters, help! ripperjack OpenFOAM Running, Solving & CFD 5 May 6, 2014 15:25
simpleFoam in parallel issue plucas OpenFOAM Running, Solving & CFD 3 July 17, 2013 11:30
Working directory via command line Luiz CFX 4 March 6, 2011 20:02


All times are GMT -4. The time now is 03:56.