easybuilders / easybuild-framework

EasyBuild is a software installation framework in Python that allows you to install software in a structured and robust way.
https://easybuild.io
GNU General Public License v2.0
149 stars 202 forks source link

Make MPI stack modulefiles always conflicting #860

Open geimer opened 10 years ago

geimer commented 10 years ago

It should not be possible to load multiple MPI stack modules at the same time without warning/error message.

This cannot be solved using the 'conflict' keyword, as it expects a static list of modulefile names, i.e., this list would have to be updated once a new MPI stack is added.

A simple solution is to set a special environment variable (e.g., 'EBCONFLICT_MPISTACK') to the MPI stack name by the modulefile. Then, this can easily be checked before loading the module.

proc checkMpiConflict {} {
  global env

  switch [module-info mode] {
    load {
      if [info exists env(EBCONFLICT_MPISTACK)] {
        print stderr "Conflicting MPI library module detected!" \
                   "Please unload module \"$env(EBCONFLICT_MPISTACK)\" first."
        exit
      }
    }
  }
}
fgeorgatos commented 10 years ago

fyi. Lmod seems to implement this concept with a family keyword: https://www.tacc.utexas.edu/tacc-projects/lmod/system-administrator-guide/suggestions-for-modulefiles

AFAI can tell, this could perhaps be a dict in python like:

family = ['mpi-stack', 'instrumented'] # the examples are fictional...