Appendix: creating a Slurm script

Caution

If you intend to use the Slurm script illustrated in this section of the tutorial, the account name and Chemshell file paths will need to be redefined.

This section of the tutorial illustrates how to create a Slurm script to run Py-ChemShell taskfarming calculations on HPC facilities. This section is of relevance only if you do not already have a submission script for running Py-ChemShell calculations.

Slurm is a resource manager and job scheduler used on most high-performance computing (HPC) platforms. To run a job using the Slurm scheduler, a submission script needs to be created with allocated resources for the calculation. Here an example submission script that can be used to run taskfarmed Py-ChemShell calculations is shown.

#!/bin/bash --login
#SBATCH -n 40
#SBATCH --tasks-per-node=40
#SBATCH -o o.%J
#SBATCH -e e.%J
#SBATCH -t 0-48:00
#SBATCH --account=scw1057
#SBATCH -p htc

# Preloads py-chemshell from bin
. /home/scw1057/software/venv/py-chemshell/bin/activate

# Load the environment
module purge
module load python/3.7.0
module load mpi         

# Runs the desired script inside the temporary directory
/home/scw1057/software/chemsh-py/chemsh-py_nwchem_gulp/bin/intel/chemsh  -np $SLURM_NTASKS -nwg 4 example.py > example_output.log 2>&1

Here, the #SBATCH options specify the resources for the calculation. Subsequently, Py-ChemShell and the other modules are loaded. To run the calculation, the Py-ChemShell runtime script file located in bin/intel/chemsh or bin/gnu/chemsh of your installation is specified. Additional options can then be specified of which a few are highlighted below.

  • -np specifies the number of processors. Here $SLURM_NTASKS is 40, therefore the calculation is run with 40 processors.

  • -nwg specifies the number of workgroups. Here 4 workgroups are requested, so the 40 processors are divided into 4 groups of 10 processors.

  • -npmm requests the number of processes within a workgroup for the MM calculation. In this case, it is not specified so 1 process is used on each processor (-npmm 10).

The following line example.py > example_output.log specifies to run the script example.py and stores the ChemShell output in a file called example_output.log. After this, 2>&1 is added. This is simply shell notation for redirecting your normal and error outputs to the same stream.

More information on how to setup Slurm submission scripts is readily available on most HPC websites (e.g: 1 , 2 ).