That flow is fairly common.
Basically, you need to get the environment alias 'module' to be defined
so you need your script to source things.
The common thing is to:
source ~/.bash_profile
On default RHEL-based systems this will also call ~/.bashrc which in
turn calls ~/etc/bashrc
The net effect is that the environment gets setup the same as if the
user had opened a shell console.
Brian Andrus
On 1/26/2021 2:13 AM, Gestió Servidors wrote:
Hi,
My environment is this:
* Users are using “bash” as the default shell
* A sample of one of my environment modules is this:
#%Module1.0
##
## modules modulefile
##
## modulefiles/modules. Generated from modules.in by configure.
##
set ModulesVersion "3.2.10"
proc ModulesHelp { } {
global version prefix
puts stderr "\tOpenMPI - $version"
puts stderr "\n\tThis adds $prefix/* to several of the"
puts stderr "\tenvironment variables."
puts stderr "\n\tVersion $version\n"
}
module-whatis "Loads OpenMPI 3.0.0 environment"
# for Tcl script use only
set version 3.0.0
set prefix /soft/openmpi-${version}
set exec_prefix ${prefix}
set datarootdir ${prefix}/share
prepend-path PATH ${exec_prefix}/bin
prepend-path LD_LIBRARY_PATH ${prefix}/lib
prepend-path INCLUDE_PATH ${prefix}/include
* “module” command itself is processed in /etc/profile.d/modules.sh
with this script:
#----------------------------------------------------------------------#
# system-wide profile.modules #
# Initialize modules for all sh-derivative shells #
#----------------------------------------------------------------------#
trap "" 1 2 3
MODULES=/soft/modules-3.2.10/Modules/3.2.10/init/
case "$0" in
-bash|bash|*/bash) . $MODULES/bash ;;
-ksh|ksh|*/ksh) . $MODULES/ksh ;;
-sh|sh|*/sh) . $MODULES/sh ;;
*) . $MODULES/sh ;; # default for scripts
esac
# Update MODULESPATH environment. /usr/share/modules/init/.modulepath
MMODS=/soft/modules-3.2.10
module use $MMODS/compilers $MMODS/parallel
module use $MMODS/libraries $MMODS/applications $MMODS/tools
#module unuse /usr/share/modules /usr/share/modulefiles
# load site specific modules
module load modules
# source .modules in the user's home directory, if it exists
if [ -r ~/.modules ]; then
. ~/.modules
fi
trap - 1 2 3
* In the SLURM submit scripts, users have to add an explicit
“/source /soft/modules-3.2.10/Modules/3.2.10/init/bash/”, and
after this line, users can load modules in the way “module load
foo/version”
Is there any bad configuration??
Thanks.