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

Parallel running intermittence

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

Like Tree3Likes
  • 1 Post By juanblanco
  • 2 Post By floquation

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 15, 2017, 05:30
Default Parallel running intermittence
  #1
New Member
 
Juan Blanco
Join Date: May 2017
Posts: 12
Rep Power: 9
juanblanco is on a distinguished road
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
mauri_tano likes this.
juanblanco is offline   Reply With Quote

Old   May 15, 2017, 07:00
Default
  #2
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 20
floquation will become famous soon enough
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"
)
If you can trace where this message comes from, you immediately know how to separate the master from the slaves.

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
jherb and juanblanco like this.
floquation is offline   Reply With Quote

Old   May 24, 2017, 07:13
Default
  #3
New Member
 
Juan Blanco
Join Date: May 2017
Posts: 12
Rep Power: 9
juanblanco is on a distinguished road
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
juanblanco is offline   Reply With Quote

Reply

Tags
coupling, intermittence, on/off, parallel

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
error while running in parallel using openmpi on local mc 6 processors suryawanshi_nitin OpenFOAM 10 February 22, 2017 21:33
Fluent 14.0 file not running in parallel mode in cluster tejakalva FLUENT 0 February 4, 2015 07:02
Problems running in parallel - missing controlDict Argen OpenFOAM Running, Solving & CFD 4 June 7, 2012 03:50
Statically Compiling OpenFOAM Issues herzfeldd OpenFOAM Installation 21 January 6, 2009 09:38
Kubuntu uses dash breaks All scripts in tutorials platopus OpenFOAM Bugs 8 April 15, 2008 07:52


All times are GMT -4. The time now is 02:38.