CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

bash script for pseudo-parallel usage of reconstructPar

Register Blogs Community New Posts Updated Threads Search

Like Tree58Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 18, 2009, 15:43
Lightbulb bash script for pseudo-parallel usage of reconstructPar
  #1
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21
kwardle is on a distinguished road
All,
I thought I would post this as maybe someone else will find it useful. I wrote a short script (not necessarily pretty, but it works...) that runs reconstructPar in pseudo-parallel mode by breaking the time directories into a number of ranges and running multiple instances of reconstructPar. For lack of a better name I have called it parReconstructPar.
Enjoy.
-Kent

(The forum won't take a file without an extension so it is uploaded as a .txt -- just save it somewhere in your path as parReconstructPar and make it executable.)
Attached Files
File Type: txt parReconstructPar.txt (1.8 KB, 1995 views)
luismsc, msaravia, Ivooo and 16 others like this.
kwardle is offline   Reply With Quote

Old   July 22, 2009, 11:42
Lightbulb parallel reconstruction (slightly improved)
  #2
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21
kwardle is on a distinguished road
All,
Here is an updated version of my bash script for parallel reconstruction with a few minor modifications--it lists the total number of directories remaining to be reconstructed. I suppose it would be relatively simple to also put in an estimate for the time remaining but I think I'll save that for later.

parReconstructPar

Note that this is geared toward reconstruction of a large number of time directories from a long transient run--if you just want to reconstruct a single time directory this is NOT what you need. Also, it basically assumes you currently have no other reconstructed time directories in your base case directory besides 0.

I would love to hear if anyone has found this to be useful.
-Kent
tfuwa, hua1015, vigneshTG and 12 others like this.
kwardle is offline   Reply With Quote

Old   August 15, 2009, 11:55
Default Nice and useful
  #3
Member
 
Jean-Peer Lorenz
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 33
Rep Power: 17
jploz is on a distinguished road
Works well for me. Thank you for sharing such nice and useful tool. Helps to save some time on multiprocessor machines.

Regards.
jploz is offline   Reply With Quote

Old   August 16, 2009, 18:51
Default Nice!
  #4
New Member
 
Oskar
Join Date: Mar 2009
Location: Finland
Posts: 12
Rep Power: 17
oskar is on a distinguished road
Always good to have utilities that make using OpenFOAM more efficient (and that you don't have to study for many days to figure out how to use).

...user interface, when oh when?
oskar is offline   Reply With Quote

Old   November 1, 2009, 15:35
Default Bugs?
  #5
New Member
 
Join Date: Oct 2009
Posts: 11
Rep Power: 17
Bastian is on a distinguished road
Hi,

I tried to use it with a case I started from time=10 s (to continue it). First reconstructPar job exists with an error. In the end, I have the files that were reconstructed by the 2. and following instances of reconstructPar (so everything from 11.3 s). But the last timeStep (15 s) is missing as well.

My fault or does it just work from 0 on?

Would like to use it though, so if you would fix that in case it's a bug...

Thanks! Bastian

Last edited by Bastian; November 1, 2009 at 16:19.
Bastian is offline   Reply With Quote

Old   November 4, 2009, 11:15
Default
  #6
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21
kwardle is on a distinguished road
Well, I guess strictly speaking that is not a bug, just a deficiency of the simplistic method I am using and I mentioned that it assumes you are reconstructing from the smallest time dir in your processor0 directory since it figures out the total number of time directories there and breaks it up into chunks. There is probably an easy fix to generalize this so that you could start the reconstruction from a different value (like t=10s in your case)--I don't know that I have time in the near term (next few weeks) to look at this again, so if someone else wants to run with it and post back that would be awesome.
kwardle is offline   Reply With Quote

Old   November 4, 2009, 15:24
Default
  #7
New Member
 
Join Date: Oct 2009
Posts: 11
Rep Power: 17
Bastian is on a distinguished road
Hhhmm I'm pretty sure that that (10 s) was the smallest dir in my processor0, since I usually delete all processor dirs after reconstructing. And only if i reconstruct I can continue from another time. But I'll have a look again.

Bastian
Bastian is offline   Reply With Quote

Old   October 18, 2010, 06:03
Default
  #8
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 256
Blog Entries: 1
Rep Power: 19
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
Kent,

thank you very much to your contribution, I found this script very useful for me!
Here I attach my bash script, which reconstructs only those case files, which are not reconstructed yet. It is not parallel, but perhaps someone will find it useful for common usage)))
Attached Files
File Type: gz newReconstructPar.sh.gz (151 Bytes, 502 views)
rajibroy likes this.
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Metallurgical Applications of Magnetohydrodynamics"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

http://smmp.unileoben.ac.at
makaveli_lcf is offline   Reply With Quote

Old   October 18, 2010, 06:44
Default
  #9
Member
 
Join Date: Dec 2009
Posts: 36
Rep Power: 17
FG_HSRM is on a distinguished road
Thanks to Kent, until now it's working perfectly for me.
FG_HSRM is offline   Reply With Quote

Old   March 24, 2011, 16:39
Default
  #10
Senior Member
 
Bernhard Linseisen
Join Date: May 2010
Location: Heilbronn
Posts: 183
Blog Entries: 1
Rep Power: 16
Linse is on a distinguished road
Thanks a lot, Kent!
It worked nicely for me, using a dual-core with hyperthreading.
A thing a little bit surprising though: It counted down nicely from around 1000 timesteps. But the last one before it ended was around 200.
This was causing not more than a bit of curiosity, for sure it's not a problem!

Thanks for the tool again!
Linse is offline   Reply With Quote

Old   March 26, 2011, 16:13
Default
  #11
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 19
braennstroem is on a distinguished road
Hi,

I wonder, if anyone tried to rewrite reconstructPar/Mesh to run in real parallel... foamToEnsight is able to write data and mesh in parallel to a 'serial' file quite quickly, so it should be possible to write direct openfoam data as well!? Did anyone tried this yet?

Best REgards
Fabian
braennstroem is offline   Reply With Quote

Old   January 31, 2014, 08:51
Default
  #12
New Member
 
Nikola Pilipovic
Join Date: Nov 2013
Posts: 6
Rep Power: 13
Nik_984 is on a distinguished road
Hi Kent,

This works great, only one question, in my case it always run 2 or 3 processors for reconstructing the case, is there some way to change the code and push it to use more processors, or I am doing something wrong there?

Best Regards
Nikola
Nik_984 is offline   Reply With Quote

Old   March 28, 2014, 13:44
Default
  #13
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21
kwardle is on a distinguished road
Maybe you have already sorted this out, but I just noticed I never replied to this post. Not sure what is happening. If you run the script name without args you will see that you run it using:

parReconstructPar <number of processors for reconstruction> <name of output file, optional>

Is it not using 8 processes if you run the script as:

parReconstructPar 8

?
matthiasfoam likes this.
kwardle is offline   Reply With Quote

Old   April 11, 2014, 19:01
Default
  #14
New Member
 
Nikola Pilipovic
Join Date: Nov 2013
Posts: 6
Rep Power: 13
Nik_984 is on a distinguished road
Yes I figured it out, in the same way as you have explained in your answer.

Sorry for a late reply.

Thanks.
Nik_984 is offline   Reply With Quote

Old   May 6, 2014, 23:05
Default
  #15
Member
 
Niu
Join Date: Apr 2014
Posts: 55
Rep Power: 12
Z.Q. Niu is on a distinguished road
Hello kent !
I 'm also counter this problem, and Ithink this script is useful to me ! I have download it but I don't know how to run it ? would you mind telling me how to get it work? Thanks !
Z.Q. Niu is offline   Reply With Quote

Old   August 14, 2014, 15:37
Default
  #16
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
Dear Kent,

Thank you very much for your sharing the file. In my case, I only need to reconstruct one of the variables, so the command is:

Code:
reconstructPar -fields '(U)'
So I need to add the option -fields '(U)' to the appflag in your file like:

Code:
appflag="-noZero -fields '(U)'"
But when I have this in the file, the running always crashes and it seems it does not work. When I removed what I added, it is OK. Do you know how to add the options like that ?

Thank you.

OFFO
openfoammaofnepo is offline   Reply With Quote

Old   August 15, 2014, 02:39
Default
  #17
Member
 
hannes
Join Date: Mar 2013
Posts: 47
Rep Power: 13
hanness is on a distinguished road
Dear all,

thank you Kent for this great tool. I picked it up and added some extra features. With this script you can specify the fields to reconstruct and it is possible to specify the timeframe (start,end).
The syntax for using slightly differs from the normal reconstructPar but it is explained in the file.

Hope somebody finds it useful
Hannes
Attached Files
File Type: txt parReconstructPar.txt (5.2 KB, 781 views)
kwardle, elvis, dupeng and 5 others like this.
hanness is offline   Reply With Quote

Old   August 15, 2014, 07:20
Default
  #18
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
Thank you, it works very well.
openfoammaofnepo is offline   Reply With Quote

Old   August 15, 2014, 10:56
Default
  #19
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21
kwardle is on a distinguished road
Hannes,
Beautiful work! Thanks for your contribution in adding several features that make the script more flexible and that I am sure will be useful to many people.
-Kent
kwardle is offline   Reply With Quote

Old   August 15, 2014, 17:46
Default
  #20
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
Hello Hannes,

When I have four parallel runs to preform the reconstruct, there only two are running, the other are not. Is this caused by that fact that the my computer memory is not enough to support the reconstruct?
openfoammaofnepo is offline   Reply With Quote

Reply

Tags
parallel processing, reconstructpar


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
Running decomposePar / reconstructPar as parallel apps? carcass OpenFOAM Running, Solving & CFD 3 January 17, 2024 08:19
Script to Run Parallel Jobs in Rocks Cluster asaha OpenFOAM Running, Solving & CFD 12 July 4, 2012 23:51
Core usage on CFX parallel processing alterego CFX 6 December 21, 2011 06:45
Swap usage on parallel run nikhilesh OpenFOAM Running, Solving & CFD 0 April 30, 2009 10:50
TASCflow,problem with script and parallel mode Zbynek Hrncir CFX 0 October 2, 2001 08:30


All times are GMT -4. The time now is 01:18.