Using module load command to switch environment for an application on CentOS 7
Nov 02, 2020 | 559 views
Refer to
For HPC:
yum install lmod-ohpc-8.1.18-6.1.ohpc.1.3.9.x86_64
# shell file into modulefile
/opt/ohpc/admin/lmod/8.1.18/libexec/sh_to_modulefile example.sh
Install it:
yum install environment-modules -y; bash
Examples:
root@beta ## > cd /usr/share/Modules/modulefiles root@beta ## > mkdir compilers root@beta ## > cp modules compilers/gcc-4.8.5
"Then we edit the module info (compilers/gcc-4.8.5). The modified version looks like this:"
#%Module1.0################################### ## ## modules compilers/gcc-4.8.5 ## ## modulefiles/compilers/gcc-4.8.5. Sample gcc module ## proc ModulesHelp { } { global version modroot puts stderr "compilers/gcc-4.8.5 - sets the Environment for GCC 4.8.5 " } module-whatis "Sets the environment for using gcc-4.8.5 (C, Fortran)" # for Tcl script use only set topdir /usr/bin/gcc set version 4.8.5 set sys linux86 setenv CC $topdir/bin/gcc setenv GCC $topdir/bin/gcc setenv FC $topdir/bin/gfortran setenv F77 $topdir/bin/gfortran setenv F90 $topdir/bin/gfortran prepend-path PATH $topdir/include prepend-path PATH $topdir/bin prepend-path MANPATH $topdir/man prepend-path LD_LIBRARY_PATH $topdir/lib
Test it:
988 module avail
989 module help compilers/gcc-4.8.5
990 cat compilers/gcc-4.8.5
991 module whatis compilers/gcc-4.8.5
992 module load compilers/gcc-4.8.5
993 module list
994 env
995 env | more
996 /usr/bin/gcc/
997 env
998 module unload compilers/gcc-4.8.5
999 env