Using modules in scheduler jobscripts
When submitting jobs through the scheduler system, users may wish to use module commands to configure their environment variable settings before running jobs. Three methods can be used to use environment variables in job submission scripts:
- Permanently add the required modules to be loaded for your login environment
- Load modules before submitting jobs and use the
-Vscheduler directive to export these variables to the running job - Use a
module loadcommand in your jobscript to load additional modules
Users incorporating a module load command in their job script should remember to source the system profile environment (e.g. /etc/profile) in their jobscripts before loading modules to allow the environment to be properly configured; e.g.
#!/bin/bash
# This is an example job script
# Scheduler directives are shown below
#$ -j y -o ~/myoutputfile
# Source the /etc/profile file to enable modules
. /etc/profile
# Load modules
module load apps/memtester/4.3.0
echo “Job starting at `date`”
memtester 4096 40