|
[Sponsors] |
May 15, 2017, 06:30 |
Parallel running intermittence
|
#1 |
New Member
Juan Blanco
Join Date: May 2017
Posts: 12
Rep Power: 9 |
Hello, I'm currently coupling OpenFOAM (OF) with other code. The latter is compiled from OF directly. The problem is that the code (of type Monte Carlo) imports the full mesh of the original geometry and parallelizes in a different way from usual OF running. This parallelization is already implemented and working but then I want to split the mesh and run OF routines with the usual mpirun. At this point I have an inconvenience, I need to split the mesh, turn on mpirun, run the OF routine, recompose the mesh and turn mpirun off.
To summarize, the scheme of what I want to do goes like the following 1. Imports geometry and mesh specifications 2. While loop --------3. Run code of type Monte Carlo. --------4. Split mesh. --------5. Turn on mpirun. --------6. Run classic OpenFOAM routine parallelized. --------7. Reconstruct mesh. --------8. Turn off mpirun 9.End loop If I try to use decomposePar and mpirun with -np processors from console I obtain that I run step 2 to 9 -np times simultaneously. So is like running the case -np times independently. Also, with the command system() I tried to use decomposePar, runParallel and reconstructPar inside the code from linux scripts but I couldn't make it work. I've ended with the same problem as explained before. In conclusion, I want a way to turn on and off mpirun from inside the code and not from terminal. Observation: The coupled code need the data recompose in order to work, so it is necessary to gather the data at the end of each loop step. I appreciate your collaboration and thank you for your time. Juan |
|
May 15, 2017, 08:00 |
|
#2 |
Senior Member
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 21 |
I don't know any details, but this might help you...
What I recall from an HPC course during my studies is that you should detect whether a certain processor is the "master" or a "slave". This should also be the case for OpenFOAM, as the beginning of a simulation outputs: Code:
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 4.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 4.1 Exec : interFoam -parallel Date : May 10 2017 Time : 14:02:03 Host : "n77" PID : 186229 Case : /foo/bar nProcs : 4 Slaves : 3 ( "n77.186230" "n77.186231" "n77.186232" ) Then, if something should run in series, you can have something like (pseudocode): Code:
if(master) { do serial stuff send message to slaves to synchronise }else{ wait for message from master } continue with parallel stuff |
|
May 24, 2017, 08:13 |
|
#3 |
New Member
Juan Blanco
Join Date: May 2017
Posts: 12
Rep Power: 9 |
Hi, thank you for the answer and sorry for delay.
For selecting the master is as you've said. Unfortunately, I had other problems inherent to my code so I couldn't make it work properly. If it is useful for anyone the command I've used for the master is Pstream::master() Also, I've found a related thread. I attach the link Access patch points (on different processor) in parallel Regards |
|
Tags |
coupling, intermittence, on/off, parallel |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
error while running in parallel using openmpi on local mc 6 processors | suryawanshi_nitin | OpenFOAM | 10 | February 22, 2017 22:33 |
Fluent 14.0 file not running in parallel mode in cluster | tejakalva | FLUENT | 0 | February 4, 2015 08:02 |
Problems running in parallel - missing controlDict | Argen | OpenFOAM Running, Solving & CFD | 4 | June 7, 2012 04:50 |
Statically Compiling OpenFOAM Issues | herzfeldd | OpenFOAM Installation | 21 | January 6, 2009 10:38 |
Kubuntu uses dash breaks All scripts in tutorials | platopus | OpenFOAM Bugs | 8 | April 15, 2008 08:52 |