CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   Proposal for a modification of the initscripts to make switching versions easier (http://www.cfd-online.com/Forums/openfoam-bugs/62519-proposal-modification-initscripts-make-switching-versions-easier.html)

gschaider December 21, 2007 14:31

Hi! This is not a really a
 
Hi!

This is not a really a bug, but I couldn't think of fitting place to post this.

One of the cool features of OF is that Debug/Opt, SP/DP and different MPI-implementations happily reside in the same directory tree side-by-side and can be chosen by the init-scripts. The downside is that one either has to edit the initiscripts and re-source them or has to work with symbolic links for different versions.

What I would propose is (I'm doing this for bashrc) is to add this function to .OpenFOAM-1.4.1/bashrc

SetDefault() {
TMP_DEFAULT=`eval echo \${${1}_DEFAULT}`
if [ "$TMP_DEFAULT" ]; then
eval "export $1=$TMP_DEFAULT"
else
eval "export $1=$2"
fi
}

and replace assignments like this

export WM_COMPILE_OPTION=Opt

with this

SetDefault WM_COMPILE_OPTION Opt

(I think this makes sense for WM_PRECISION_OPTION, WM_COMPILE_OPTION and WM_MPLIB)

Now if, for instance, one wants to switch one shell to the profiled, single-precision version with LAM he issues the commands

export WM_PRECISION_OPTION_DEFAULT=SP
export WM_COMPILE_OPTION=Prof
export WM_MPLIB=LAM
. .OpenFOAM-1.4.1/bashrc

The advantage of not editing the init-file would be that unpleasant surprises (starting a job with the wrong precision for instance) for other users living from that installation would be avoided

henry December 21, 2007 14:53

I agree that we should make it
 
I agree that we should make it easier to switch between implementations and what we have at the moment in 1.4.2 is a set of aliases which allow us two switch between single and double precision using wmsp and wmdp, and between 32 and 64bit using wm32 and wm64. We could extend this mechanism to other build options such as opt, debug and prof and MPI implementations or use the more generic method you are proposing. I will think about this a bit more and plan for some such mechanism to be present in the next version.

Thanks

Henry

gschaider December 21, 2007 15:10

OK. Thanks for considering it.
 
OK. Thanks for considering it.

Merry Christmas and a happy new year.


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