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

[Other] OpenFOAM using environment modules on an HPC

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 19, 2015, 07:59
Default OpenFOAM using environment modules on an HPC
  #1
Member
 
Andrew Coughtrie
Join Date: May 2011
Posts: 51
Rep Power: 14
Andrew.Coughtrie is on a distinguished road
Hi Everyone,

This might be a bit of a vague question in some respects but I'll ask anyway since I've found very little detailed info on it.

Installing OpenFOAM for use with environment modules which will allow all the settings/environment variables to be loaded/unloaded without opening a new shell.

Does anyone know a good way to do this? I was thinking that perhaps the best method is to compile outside the module environment and then include just the required environment variables for running in the module file. This can then be loaded and unloaded since users won't need to compile anything other than user solvers. Is this possible or are their hidden settings I'm overlooking with regards to how everything runs?

Thanks

Andrew
Andrew.Coughtrie is offline   Reply With Quote

Old   November 21, 2015, 16:22
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
You mean something like this?
http://modules.sourceforge.net/ (Welcome to the Environment Modules Project)

Look what environment variables are modified by the (usual) $WM_PROJECT_DIR/etc/bashrc and write a module accordingly.
jherb is offline   Reply With Quote

Old   November 22, 2015, 02:28
Default
  #3
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
Hi Andrew,

Defining an environment module for OpenFOAM with all the needed variables is a pain, especially if you want options to be available, like single / double precision, MPI libraries, compilers, etc...

What we do is to load the requirements using environment modules (compiler, MPI)' then source etc/bashrc. This does not allow to unload the OpenFOAM environment using the handy "module unload" command, but in my opinion it is by far the easiest option.

Otherwise pipe the output of an "env" command before and after sourcing etc/bashrc, find the differences and add them to an environment module definition file. It's a pain and you'll need to go through the same process with each new version you install.

Hope this helps,
Francesco
fra76 is offline   Reply With Quote

Old   November 22, 2015, 06:47
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

Quote:
Originally Posted by fra76 View Post
What we do is to load the requirements using environment modules (compiler, MPI)' then source etc/bashrc. This does not allow to unload the OpenFOAM environment using the handy "module unload" command, but in my opinion it is by far the easiest option.
!! Then if you can source OpenFOAM's "etc/bashrc" from within the module, then you can also unload it by sourcing the file "etc/config/unset.sh" in OpenFOAM, which was designed precisely for unloading the OpenFOAM environment!

In a normal OpenFOAM shell environment (not one manually defined with a module), you should have the alias "wmUNSET", which does exactly that, as defined in "etc/config/aliases.sh":
Code:
# clear env
alias wmUNSET='. $WM_PROJECT_DIR/etc/config/unset.sh'
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   November 22, 2015, 07:26
Default
  #5
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
Hi Bruno,

Thanks for the hint, I'll give it a try. However I'm not sure you can source an external file within environment modules, especially a bash file, as the modules files are tcl files and what you can do inside them is quite limited.

Cheers,
Francesco
fra76 is offline   Reply With Quote

Old   November 22, 2015, 09:47
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Francesco,

I had a vague idea that the module system didn't allow for sourcing shell scripts... then that means that you actually load the modules and source the "etc/bashrc" script in the job script for the scheduler or even straight in the command line.

And after a bit of Googling, I found that the FAQ for the modules project has on this very same topic: http://sourceforge.net/p/modules/wik...me-application

There has been a brief proposition for such an implementation: http://www.openfoam.org/mantisbt/view.php?id=609#c1526 - but the problem is that this creates an additional maintenance issue or adds a dependency to "modules" being installed.

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   November 23, 2015, 08:38
Default
  #7
Member
 
Andrew Coughtrie
Join Date: May 2011
Posts: 51
Rep Power: 14
Andrew.Coughtrie is on a distinguished road
Thanks everyone, you've given me some ideas.

Thanks Bruno, hadn't seen wmUNSET before, this could be useful, it does seem though that openfoam are basically just doing what the environment modules are designed to do in their own way, so I'd be very happy to see openfoam incorporate the module system in to the installation though the added complexity and maintenance issues could be a problem so may never happen.

Francesco, that does sound like a pain having to go through everything from he start every time you install a new version, I can see why people don't bother, what with everything else they have to do.

If I ever come up with a better way doing this I'll be sure to post it.

Thanks again,

Andrew
Andrew.Coughtrie is offline   Reply With Quote

Reply

Tags
hpc, modules


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
OpenFOAM course for beginners Jibran OpenFOAM Announcements from Other Sources 2 November 4, 2019 08:51
OpenFOAM v3.0+ ?? SBusch OpenFOAM 22 December 26, 2016 14:24
running OpenFoam on a HPC ce73stargazer OpenFOAM 2 May 29, 2016 19:38
OpenFOAM v3.0.1 Training, London, Houston, Berlin, Jan-Mar 2016 cfd.direct OpenFOAM Announcements from Other Sources 0 January 5, 2016 03:18
OpenFOAM benchmarks for HPC tomislav_maric OpenFOAM Running, Solving & CFD 0 April 21, 2010 17:39


All times are GMT -4. The time now is 12:42.