How to swap between versions of the TELEMAC system

From SourceWiki
Jump to navigation Jump to search

It is rather common to have more than one version of the TELEMAC system installed at the same time. Most developers will have at least the current stable and development versions installed at the same time. This article gives some hints on how to set up a system with concurrent versions alongside each other.

Using the steering file? NO!

In theory, the keyword RELEASES in the steering file can be used to swap between versions of ESTEL. However, it is a very bad idea to do so. This is mainly because:

  • the script that lauches ESTEL needs a "dictionary" and it will use the "dictionary" of the version set by default in systel.ini, regardless of what you have used for RELEASES
  • ESTEL needs to be used with a particular set of libraries and this cannot be ensured if you change the RELEASES string. This is why it is recommended to not put the RELEASES keyword into your steering files, the default release numbers selected by the developers will be used instead... and they work.

The rest of this article shows how to reliably switch very quickly between version of ESTEL. The setup is a bit time consuming but after that, a single command is enough to switch (no messy editing of files etc...).

SYSTELCFG

The TELEMAC system allows several configuration directories. By default, it looks for /path/to/systel90/config/. However, if the environment variable SYSTELCFG is set, it will use its value as the location of the configuration directory.

The method described in this article consists of creating a separate configuration folder for each version of the code. In each configuration folder, the systel.ini and cfgmak.mak files will point to a specific version of the code.

For instance, create a folder called /path/to/systel90/configv5p7. Inside this folder, copy a systel.ini file where the [GENERAL] section is tweaked for version v5p7 of the TELEMAC system. So basically, just set all the "VERS" variables to V5P7. Then set the SYSTELCFG variable to point to this folder, run cfgmak and recompile the whole TELEMAC system:

$ export SYSTELCFG=/path/to/systel90/configv5p7
$ cfgmak
File '/path/to/systel90/configv5p7/cfgmak.mak' updated.
$ build_systel -v v5p7 -p -c

You will have version v5p7 of the TELEMAC system compiled and configured. Try a few test cases to make sure. Note, in these test cases, make sure the RELEASES keyword is not used.

Then create a configv5p8 folder, edit the systel.ini file in this folder and do the same for v5p8:

$ export SYSTELCFG=/path/to/systel90/configv5p8
$ cfgmak
File '/path/to/systel90/configv5p8/cfgmak.mak' updated.
$ build_systel -v v5p8 -p -c

You will then have both v5p7 and v5p8 compiled and configured on your machine.

Switching between versions

Providing that the TELEMAC system is configured properly for each configuration directory, switching between versions is now trivial: just set SYSTELCFG to point to either configv5p7 or configv5p8. Simple!

To switch to version v5p7:

$ export SYSTELCFG=/path/to/systel90/configv5p7

To switch back to v5p8:

$ export SYSTELCFG=/path/to/systel90/configv5p8

change_systel_version

Actually, to automate the process even more, a script called change_systel_version is provided in the /path/to/systel90/bin/ which create the relevant code to export SYSTELCFG to $SYSTEL90/convigvxpy. This way, you can simply switch between versions by typing "eval `change_systel_version -v v5p7`" or "eval `change_systel_version -v v5p8`" at the command line.

$ eval `change_systel_version -v v5p7`
Switched to TELEMAC version: v5p7
$ estel3d cas (-> will use ESTEL-3D v5p7)
$ eval `change_systel_version -v v5p8`
Switched to TELEMAC version: v5p8
$ estel3d cas (-> will use ESTEL-3D v5p8)

Note that the root of the TELEMAC system must be stored in the environment variable SYSTEL90 for this script to work. Have a look at the typical .bashrc for ESTEL. Also, the use of "eval" and the backquotes " ` " is required for the environment variable to be exported properly. You can define simplier shortcuts though, see below.

In the future, the script will be extended to modify the HOSTNAME too so that you can switch between architectures. Be patient...

Integration in the .bashrc file

The syntax above is quite wordy so it is useful to define a set of small bash functions in your .bashrc file to do this automatically. For instance you could use for v5p7:

function v5p7 ()
{
    eval `change_systel_version -v v5p7`
}

Define a similar v5p8 function. Then you can switch easily:

$ v5p7
Switched to TELEMAC version: v5p7
$ estel3d cas (-> will use ESTEL-3D v5p7)
$ v5p8
Switched to TELEMAC version: v5p8
$ estel3d cas (-> will use ESTEL-3D v5p8)

The typical .bashrc for ESTEL contains some other functions which provide extended functionality when used with the change_systel_version script above, for instance to navigate quickly to the ESTEL folders.