GAUSSIAN G16¶
Voici dans un premier temps un script de soumission :
#!/bin/csh -x
#SBATCH -o gaussian.%j.out
#SBATCH --nodes=1
#SBATCH --ntasks=16
#SBATCH --mem-per-cpu=2500mb
#SBATCH -t 24:00:00
#SBATCH --comment="gaussian without gpu"
# load the module environment
#debian case
if ( -f /etc/csh/login.d/modules ) then
source /etc/csh/login.d/modules
endif
#redhat case
if ( -f /etc/profile.d/modules.csh ) then
source /etc/profile.d/modules.csh
endif
# and the gaussian module
module load gaussian/g16-B.01
# load environment variable for gaussian
# first option using TMPDIR
source $g16root/g16/bsd/g16.login
# second option using scratch dir. To use it, comment first option and uncomment next line.
# source $g16root/g16/bsd/g16.login.scratch
# just to debug
env
# create an id for storing result of this job
setenv SJID "$SLURM_JOB_NAME"_"`echo $SLURM_JOB_ID | cut -d . -f 1`_`date '+%d%m%Y'`"
if (! -d $GAUSS_SCRDIR ) then
mkdir -p $GAUSS_SCRDIR
endif
# this part is only to use this script in interactive mode without slurm system
if ! $?SLURM_JOB_ID then
setenv SLURM_SUBMIT_DIR $PWD
setenv SLURM_JOB_NAME $1
setenv SLURM_JOB_ID "S"`date '+%H%M%S'`
endif
# go to the computation directory and copy input
cd $GAUSS_SCRDIR
cp -p $SLURM_SUBMIT_DIR/$SLURM_JOB_NAME.c* .
# modify or create NProcShared to use the same as define in SBATCH
set lineproc=`grep -ic "\%nproc" "./$SLURM_JOB_NAME.com"`
if ( "$lineproc" != 0 ) then
foreach occurence (`grep -i "\%nproc" ./$SLURM_JOB_NAME.com `)
sed -i "s/$occurence/%NProcShared=$SLURM_JOB_CPUS_PER_NODE/" ./$SLURM_JOB_NAME.com
end
else
sed -i "1i\%NProcShared=$SLURM_JOB_CPUS_PER_NODE" ./$SLURM_JOB_NAME.com
endif
echo "SLURM_JOB_CPUS_PER_NODE = "$SLURM_JOB_CPUS_PER_NODE
# modify or create Mem to use the same as define in SBATCH
#compute mem first
@ RMEM= $SLURM_JOB_CPUS_PER_NODE * $SLURM_MEM_PER_CPU - 100
set lineproc=`grep -ic "\%mem" "./$SLURM_JOB_NAME.com"`
if ( "$lineproc" != 0 ) then
foreach occurence (`grep -i "\%mem" ./$SLURM_JOB_NAME.com `)
sed -i "s/$occurence/%Mem=${RMEM}MB/" ./$SLURM_JOB_NAME.com
end
else
sed -i "1i\%Mem=${RMEM}MB" ./$SLURM_JOB_NAME.com
endif
echo "SLURM_MEM_PER_CPU = "$SLURM_MEM_PER_CPU
# start gaussian calculation
#alias timit '/usr/bin/time -f "Elapsed: %e User: %U System: %S PageF: %F"'
g16 $SLURM_JOB_NAME.com
# return of ooutput in the directory we have submit the calculation and where must be the .com inputfile
mkdir -p $SLURM_SUBMIT_DIR/$SJID
mv -f * $SLURM_SUBMIT_DIR/$SJID
#liberation du scratch
/bin/rm -rf $GAUSS_SCRDIR
Pour utiliser ce script il suffit de ce placer dans le répertoire où se trouve votre fichier d'entré avec l'extension .com est de taper :
sbatch -J <nom du fichier sans l'extension> <chemin vers le script de soumission>
par exemple, si mon arborescence est la suivante :
[paurel@login01 home]$ tree
.
└── paurel
├── Calcul
│ └── Gaussian
│ └── butoxyiso_MP2.com
└── gaussian_16.slurm
3 directories, 2 files
gaussian_16.slurm étant le script de soumission ci dessus et butoxyiso.com mon fichier input.
Je dois me placer dans le répertoire où se trouve mon input grace à la commande:
cd ~/Calcul/Gaussian
Puis lancer le job avec la commande:
sbatch -J buoxyiso ~/gaussian_16.slurm
Les résultats me reviendront dans un répertoire de la forme butoxyiso_<numero du job>_<date de la soumission sous la forme jjmmyyyy>