Setting-up Environment Modules

一曲冷凌霜 提交于 2019-12-13 03:06:23

问题


I have recently installed the environment-modules package (version 4.1.1-1) on Linux Mint 19, and I'm trying to figure out how to set-up different environments. Unfortunately, the docs only give few pointers as what to do when you're not already an expert on the subject matter (I was hoping for a simple example, instead I found mostly just a list of commands). To be more concrete, I have the following situation:

  • I have Modules installed in /usr/share/modules/.
  • I have compiled OpenMPI using two different compilers (GNU and Intel). The corresponding binaries, libraries, etc. are located in /usr/local/modules/mpi/gnu and /usr/local/modules/mpi/intel, respectively.
  • I want to set-up two environments, one for each compiled version of MPI, so that I can easily switch between those (module load mpi/gnu, module load mpi/intel, or something similar).

I apologise if this question is trivial, or if it has been posted before. The mere name of the Modules package makes it incredibly hard to search the web for support (it's like someone naming their product Software; good lucking finding what you need on Google). Your assistance will be greatly appreciated.


回答1:


Once you get your software installed, you need to write modulefiles to enable them. First define a location where to put these modulefiles, let's say for instance:

mkdir /usr/local/modules/modulefiles

In this directory, create the sub-directories that will represent the name you will refer your modulefile to

mkdir -p /usr/local/modules/modulefiles/mpi/gnu
mkdir -p /usr/local/modules/modulefiles/mpi/intel

In these directories, create a modulefile named by the version number of the software you have install (in your case for instance 3.1.3). Using the version number to name the modulefile helps to have multiple modulefiles in case you want to install newer version of the software later on.

So now, create the content of the modulefile mpi/gnu/3.1.3 represented by the /usr/local/modules/modulefiles/mpi/gnu/3.1.3 file with the modulefile syntax:

#%Module
conflict     mpi
prepend-path PATH /usr/local/modules/mpi/gnu/bin
prepend-path LD_LIBRARY_PATH /usr/local/modules/mpi/gnu/lib
prepend-path MANPATH /usr/local/modules/mpi/gnu/man

Adapt this content to the environment configuration you need/you want to set.

Repeat this step for the mpi/intel/3.1.3 modulefile in /usr/local/modules/modulefiles/mpi/intel/3.1.3.

Once you got these modulefiles ready, to need to put them at hand in your shell session. This can be done with the module use command:

module use /usr/local/modules/modulefiles

From there, the 2 modulefiles can be found among the module catalog (module avail) and loaded (module load).



来源:https://stackoverflow.com/questions/53673172/setting-up-environment-modules

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!