how to create temporary folders in a slurm script hpc script code example

Example: how to create temporary folders in a slurm script hpc script

#!/bin/bash
#SBATCH --job-name=sand_min
#SBATCH -N 1
#SBATCH -n 1
##SBATCH --gres=gpu:1
#SBATCH --partition=shortq7
#SBATCH --exclude=node[007,041,046],nodeamd[010-014],nodeeng[009-010],nodegpu001,nodenviv[100001-100002,100004-100015]
#SBATCH --mail-type=ALL
#SBATCH --time=6:00:00
echo   "NODE NAMES           = "$SLURM_NODELIST
echo   "CUDA_VISIBLE_DEVICES = "$CUDA_VISIBLE_DEVICES
date

#
# Load the necessary modules, etc...
#
module load vmd

#
# Go to the submission dir, and create the necessary temp files under /tmp/$USER
#
cd     $SLURM_SUBMIT_DIR
sleep 1
mkdir /tmp/$USER
mkdir /tmp/$USER/$SLURM_JOBID
cp * ../../somefileAboveSubmittingDir /tmp/$USER/$SLURM_JOBID
# (* is submitted directorory, ../somefileAboveSubmittingDir)
cd /tmp/$USER/$SLURM_JOBID
./run_script > error
cp * $SLURM_SUBMIT_DIR
# once simulation done, copy everything so submitting dir
rm -dvfr /tmp/$USER/$SLURM_JOBID

date
#it is better to get date, you can know how long simulation ran

Tags:

Misc Example