HPC/Module naming scheme 2016: Difference between revisions

From CNM Wiki
< HPC
Jump to navigation Jump to search
Line 18: Line 18:
|}
|}


== Configuration steps ==
== Migration steps for  new-style modules ==


=== Configure new-style modules in .bashrc ===
=== Configure in .bashrc ===
To switch over to new hierarchical module names on both CentOS releases you could continue making all your module choices in <code>~/.bashrc</code> and simply signal on the older platform to use the new module style. You would do this by creating an empty new-style customization file: <code>touch ~/.modules-el6</code> .
To switch over to new hierarchical module names on both CentOS releases you could continue making all your module choices in <code>~/.bashrc</code>.
<source lang="bash">
vi .bashrc
</source>
: Adapt module commands to new module names as follows:
:* Remove version numbers from module names of the old-style <code>''packagename/version''</code>, leaving only <code>''packagename''</code>. This is the recommended approach, as you will automatically benefit from future updates.
:* To insist on a specific version for a package affected by the new-style names, use the form  <code>''packagename/compilername/version''</code> or <code>''packagename/mpiname/compilername/version''</code> as appropriate. To see available flavors and versions, separately run the command <code>module avail ''packagename''</code>.
* Tell CentOS-5 nodes to use the new module style as well. Simply create an empty customization file:
<source lang="bash">
touch ~/.modules-el6
</source>
<!--
<!--
# Create a customization file for new names, but leave it empty (you'll configure your choices in the next step). Use the command: <source lang="bash">touch ~/.modules-el6</source>
# Create a customization file for new names, but leave it empty (you'll configure your choices in the next step). Use the command: <source lang="bash">touch ~/.modules-el6</source>
Line 27: Line 37:
-->
-->


=== Configure modules in dedicated files ===
=== Configure in dedicated files ===
However, it is cleaner to move the module selection into dedicated files:
However, it is cleaner to move the module selection into dedicated files:
# Move your previous module selections inro a conspicuously named but otherwise unused file, e.g., <code>.modules-el5.inactive</code>.
* Move your previous module selections inro a conspicuously named but otherwise unused file, e.g., <code>.modules-el5.inactive</code>.
# Duplicate the file and adapt its contents to new module names, as follows:
#* Remove version numbers from module names of the old-style <code>''packagename/version''</code>, leaving only <code>''packagename''</code>. This is the recommended approach, as you will automatically benefit from future updates.
#* To insist on a specific version for a package affected by the new-style names, use the form  <code>''packagename/compilername/version''</code> or <code>''packagename/mpiname/compilername/version''</code> as appropriate. To see available flavors and versions, separately run the command <code>module avail ''packagename''</code>.
# Remove all previous module customizations from <code>~/.bashrc</code>.
# Test.
<source lang="bash">
<source lang="bash">
cd      # Go to home directory
cd      # Go to home directory
grep -A 1  module .bashrc > .modules-el5.inactive
grep -A 1  module .bashrc > .modules-el5.inactive
</source>
* Duplicate the file.
<source lang="bash">
cp .modules-el5.inactive .modules-el6
cp .modules-el5.inactive .modules-el6
</source>
* Adapt contents to new module names, as shown in the previous section.


<source lang="bash">
vi .modules-el6    # adapt module names, clean up errant lines
vi .modules-el6    # adapt module names, clean up errant lines
vi .bashrc         # remove all lines with "module" commands
</source>
 
* Edit code>~/.bashrc</code> and remove all lines with "module" commands.
# Test
<source lang="bash">
exec bash -l
vi .bashrc
</source>
* Test.
<source lang="bash">
bash -l   # open a sub-shell
module list
module list
exit        # leave the sub-shell
</source>
</source>



Revision as of 22:28, October 7, 2015

Configuration files used

You have files:
.bashrc and …
Remark CentOS-5 uses: CentOS-6 uses:
module names files module names files
Starting situation. old .bashrc only new .bashrc only
.modules-el6 Switch over, recommended. new .modules-el6 and .bashrc .modules-el6 and .bashrc
.modules-el5 Avoid! – file ignored on EL6. old .modules-el5 and .bashrc .bashrc only
.modules-el5 .modules-el6 For advanced users. old .modules-el5 and .bashrc .modules-el6 and .bashrc

Migration steps for new-style modules

Configure in .bashrc

To switch over to new hierarchical module names on both CentOS releases you could continue making all your module choices in ~/.bashrc.

vi .bashrc
Adapt module commands to new module names as follows:
  • Remove version numbers from module names of the old-style packagename/version, leaving only packagename. This is the recommended approach, as you will automatically benefit from future updates.
  • To insist on a specific version for a package affected by the new-style names, use the form packagename/compilername/version or packagename/mpiname/compilername/version as appropriate. To see available flavors and versions, separately run the command module avail packagename.
  • Tell CentOS-5 nodes to use the new module style as well. Simply create an empty customization file:
touch ~/.modules-el6

Configure in dedicated files

However, it is cleaner to move the module selection into dedicated files:

  • Move your previous module selections inro a conspicuously named but otherwise unused file, e.g., .modules-el5.inactive.
cd      # Go to home directory
grep -A 1  module .bashrc > .modules-el5.inactive
  • Duplicate the file.
cp .modules-el5.inactive .modules-el6
  • Adapt contents to new module names, as shown in the previous section.
vi .modules-el6    # adapt module names, clean up errant lines
  • Edit code>~/.bashrc and remove all lines with "module" commands.
vi .bashrc
  • Test.
bash -l    # open a sub-shell
module list
exit        # leave the sub-shell

CentOS-dependent module selection

If you encounter difficulties with making your module selection work simultaneously for CentOS-5 and CentOS-6, use separate configurations instead.

  1. Follow the steps as above.
  2. Re-activate the older module selection.
  3. Test.
cd      # Go to home directory
mv .modules-el5.inactive .modules-el5
vi .modules-el5    # clean up errant lines

# Test
exec bash -l
module list