Incorporating the instructions above, a complete job script could, for example, look like this:
#!/bin/bash #Set job requirements #SBATCH -n 16 #SBATCH -t 5:00 #Loading modules module load 2022 module load Python/3.10.4-GCCcore-11.3.0 #Copy input file to scratch cp $HOME/big_input_file "$TMPDIR" #Create output directory on scratch mkdir "$TMPDIR"/output_dir #Execute a Python program located in $HOME, that takes an input file and output directory as arguments. python $HOME/my_program.py "$TMPDIR"/big_input_file "$TMPDIR"/output_dir #Copy output directory from scratch to home cp -r "$TMPDIR"/output_dir $HOME
While this script illustrates the use of the most important elements of a job script (SBATCH arguments, modules, managing input and output), it is probably not efficient: if the Python program only runs on a single core, many cores are left idle, wasting resources.