|
[Sponsors] |
November 29, 2013, 07:59 |
constructor argList and parallel run
|
#1 |
Senior Member
Join Date: Jan 2012
Posts: 166
Rep Power: 14 |
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 } ... 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); } } 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 } 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 ? |
|
November 29, 2013, 09:50 |
|
#2 |
Senior Member
Armin
Join Date: Feb 2011
Location: Helsinki, Finland
Posts: 156
Rep Power: 19 |
If you want to figure which process is 'master', this should help
Code:
if (Pstream::master()) { // Do something only on master } 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. |
|
|
|
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 |