Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
Dernière révisionLes deux révisions suivantes
documentation:examples:submit_scripts [2015/11/03 08:44] – [job parallèle, variantes] ltaulelldocumentation:examples:submit_scripts [2020/08/25 15:58] – modification externe 127.0.0.1
Ligne 2: Ligne 2:
  
 <note warning>Certaines variables sont fantaisistes, pour vous forcer à les mettre à jour selon [[documentation:clusters:batch#les_files_d_attente|les configurations réelles des files d'attentes]].</note> <note warning>Certaines variables sont fantaisistes, pour vous forcer à les mettre à jour selon [[documentation:clusters:batch#les_files_d_attente|les configurations réelles des files d'attentes]].</note>
 +
 +<note tip>Many more examples scripts are available on our [[https://github.com/ltaulell/submission_scripts|github repository]]</note>
 +
  
 ===== job parallèle ===== ===== job parallèle =====
Ligne 7: Ligne 10:
   * Soumission avec un seul script   * Soumission avec un seul script
   * Usage du ''/scratch glusterfs'' commun des queues ''E5-*''   * Usage du ''/scratch glusterfs'' commun des queues ''E5-*''
-  * Environnement Debian 7 
-  * <del>chargement étagé des modèles (OS, puis SGE, puis compilateur, puis openmpi)</del> 
   * Configuration de l'environnement avec les modulefiles   * Configuration de l'environnement avec les modulefiles
 +  * Parallel Environment and ''$NSLOTS'':
 +    * OpenMP **must** match (-pe openmp8 8)
 +    * OpenMPI **must** match **or** multiple (-pe mpi8_debian 8, -pe mpi8_debian 32)
  
 **Le script suivant se lance avec la commande** : ''qsub parexample.sh'' **Le script suivant se lance avec la commande** : ''qsub parexample.sh''
Ligne 16: Ligne 20:
 #!/bin/bash #!/bin/bash
 ### variables SGE ### variables SGE
-HOMEDIR=$SGE_O_WORKDIR 
 ### shell du job ### shell du job
 #$ -S /bin/bash #$ -S /bin/bash
Ligne 22: Ligne 25:
 #$ -N testbash #$ -N testbash
 ### file d'attente (a changer) ### file d'attente (a changer)
-#$ -q E5-2670deb68A+#$ -q E5_test
 ### parallel environnement & nslots (a changer) ### parallel environnement & nslots (a changer)
 #$ -pe mpi8_debian 8 #$ -pe mpi8_debian 8
Ligne 29: Ligne 32:
 ### exporte les variables d'environnement sur tous les noeuds d'exécution ### exporte les variables d'environnement sur tous les noeuds d'exécution
 #$ -V #$ -V
 +### mails en debut et fin d'execution
 +#$ -m b
 +#$ -m e
  
-### sinon SGE travaille dans ~/ 
-cd ${HOMEDIR} 
  
-### modeles: +### sinon SGE travaille dans ~
-#source /usr/local/modeles/set_debian7-clean.sh +cd "${SGE_O_WORKDIR}" || { echo "cannot cd to ${SGE_O_WORKDIR}"; exit 1; }
-#source /usr/local/modeles/sge.sh +
-#source /usr/local/modeles/openmpi-1.4.1-intel-11.1.069.sh+
  
 ### environment modules ### environment modules
-source /usr/share/modules/init/bash +source /usr/share/lmod/lmod/init/bash 
-module use /applis/PSMN/Modules +module load GCC/7.2.0/OpenMPI/3.0.0/HISAT2/2.1.0
-module load Base/psmn +
-module load openmpi/1.4.1-intel-11.1.069+
  
 ### definition SCRATCHDIR ### definition SCRATCHDIR
-SCRATCHDIR=${SGE_O_WORKDIR/home/scratch}+SCRATCH="/scratch/E5N" 
 +SCRATCHDIR=${SGE_O_WORKDIR/"${HOME}"/"${SCRATCH}"}
 ### verif SCRATCHDIR ### verif SCRATCHDIR
 echo "SCRATCHDIR=${SCRATCHDIR}" echo "SCRATCHDIR=${SCRATCHDIR}"
  
-BINDIR="/softs/Spinevolution/spinev-3.4.5-Linux-x86_64/" +BINDIR="/applis/PSMN/generic/PhyloMerge/0.2/" 
-EXEC="spinev"+EXEC="phylomerge"
  
 ### PREFIX doit matcher le modele openmpi (ligne 18) ### PREFIX doit matcher le modele openmpi (ligne 18)
-PREFIX=/softs/openmpi-1.4.1-intel-11.1.069 +PREFIX="/applis/PSMN/debian9/software/Compiler/GCC/7.2.0/OpenMPI/3.0.0" 
-MPIRUN=${PREFIX}/bin/mpirun+MPIRUN="${PREFIX}/bin/mpirun"
 ### necessaire si plusieurs noeuds ### necessaire si plusieurs noeuds
-HOSTFILE=${TMPDIR}/machines+### HOSTFILE=${TMPDIR}/machines
  
 ### creation du repertoire de travail dans le /scratch ### creation du repertoire de travail dans le /scratch
 if [[ ! -d "${SCRATCHDIR}" ]]  if [[ ! -d "${SCRATCHDIR}" ]] 
 then then
-  /bin/mkdir -p ${SCRATCHDIR}+  /bin/mkdir -p "${SCRATCHDIR}"
 fi fi
  
Ligne 68: Ligne 69:
 for FICHIER in INPUT.hdf5 MATHRICE cube3x3 for FICHIER in INPUT.hdf5 MATHRICE cube3x3
 do do
-  cp ${FICHIER} ${SCRATCHDIR}/+  cp -- "${FICHIER}" "${SCRATCHDIR}/"
 done done
  
Ligne 75: Ligne 76:
 for FICHIER in OUTPUT.hdf5 mathrice.o for FICHIER in OUTPUT.hdf5 mathrice.o
 do do
-  if [[ -e "${SCRATCHDIR}/${FICHIER}" ]]+  if [[ -e "${SCRATCHDIR}/${FICHIER}" ]]
   then   then
-    /bin/rm -f ${SCRATCHDIR}/${FICHIER}+    /bin/rm -f "${SCRATCHDIR}/${FICHIER}"
   fi   fi
 done done
  
 ### hostfile SGE si repartition sur plusieurs noeuds ### hostfile SGE si repartition sur plusieurs noeuds
-/bin/cat ${TMPDIR}/machines >> ${HOMEDIR}/tmp +### ${TMPDIR}/machines est généré par SGE 
-/bin/rm -f ${HOMEDIR}/Master +/bin/cat "${TMPDIR}/machines>> "${HOMEDIR}/tmp" 
-Master="`/usr/bin/head -1 ${TMPDIR}/machines`+/bin/rm -f "${HOMEDIR}/Master" 
-/bin/echo $Master >> ${HOMEDIR}/Master+Master=$(/usr/bin/head -1 "${TMPDIR}/machines") 
 +/bin/echo "${Master}" >> "${HOMEDIR}/Master"
  
 ### se placer dans le repertoire d'execution AVANT le lancement du programme ### se placer dans le repertoire d'execution AVANT le lancement du programme
-cd ${SCRATCHDIR}+cd "${SCRATCHDIR}" || { echo "cannot cd to ${SCRATCHDIR}"; exit 1; }
  
-${MPIRUN} -prefix ${PREFIX} -mca btl sm,openib,self -np ${NSLOTS} ${BINDIR}/${EXEC} > ${SCRATCHDIR}/out+##${MPIRUN} -prefix ${PREFIX} -mca btl sm,openib,self -np ${NSLOTS} ${BINDIR}/${EXEC} > ${SCRATCHDIR}/out 
 +"${MPIRUN}" -prefix "${PREFIX}" -mca btl vader,openib,self -np "${NSLOTS}" "${BINDIR}/${EXEC}" > "${SCRATCHDIR}/out"
  
 ### recuperation des resultats à la fin du calcul ### recuperation des resultats à la fin du calcul
 for FICHIER in OUTPUT.hdf5 mathrice.o for FICHIER in OUTPUT.hdf5 mathrice.o
 do do
-  cp ${SCRATCHDIR}/${FICHIER} ${HOMEDIR}/+  cp -- "${SCRATCHDIR}/${FICHIER}" "${HOMEDIR}/"
 done done
  
 ### ###
- 
 </code> </code>
  
 <code bash test_scratch.sh> <code bash test_scratch.sh>
- 
 #!/bin/bash #!/bin/bash
 # #
 ### variables SGE ### variables SGE
-HOMEDIR=/home/votrelogin/testpourscratch 
 ### shell du job ### shell du job
 #$ -S /bin/bash #$ -S /bin/bash
Ligne 113: Ligne 113:
 #$ -N test1 #$ -N test1
 ### file d'attente (a changer) ### file d'attente (a changer)
-#$ -q monointelbig+#$ -q E5_test
 ### charger l'environnement utilisateur pour SGE ### charger l'environnement utilisateur pour SGE
 #$ -cwd #$ -cwd
Ligne 119: Ligne 119:
 #$ -V #$ -V
 ### mails en debut et fin d'execution ### mails en debut et fin d'execution
-#$ -m be+#$ -m 
 +#$ -m e
  
 # aller dans le repertoire de travail/soumission # aller dans le repertoire de travail/soumission
 # important, sinon, le programme est lancé depuis ~/ # important, sinon, le programme est lancé depuis ~/
-cd ${HOMEDIR+cd "${SGE_O_WORKDIR}" || { echo "cannot cd to ${SGE_O_WORKDIR}"; exit 1; 
- +
 ### configurer l'environnement ### configurer l'environnement
-source /usr/share/modules/init/bash +source /usr/share/lmod/lmod/init/bash 
-module use /applis/PSMN/Modules +module load IntelComp/15.0.2
-module load Base/psmn +
-module load intel/14.0.1+
  
 ### definition SCRATCHDIR ### definition SCRATCHDIR
-SCRATCHDIR=/scratch/votrelogin/testpourscratch+#SCRATCH="/scratch/E5N" 
 +#SCRATCHDIR=${SGE_O_WORKDIR/"${HOME}"/"${SCRATCH}"
 +SCRATCHDIR="/scratch/Lake/${USER}/testpourscratch"
 ### verif SCRATCHDIR ### verif SCRATCHDIR
 echo "SCRATCHDIR=${SCRATCHDIR}" echo "SCRATCHDIR=${SCRATCHDIR}"
Ligne 139: Ligne 140:
 if [[ ! -d "${SCRATCHDIR}" ]]  if [[ ! -d "${SCRATCHDIR}" ]] 
 then then
-   /bin/mkdir -p ${SCRATCHDIR}+   /bin/mkdir -p "${SCRATCHDIR}"
 else else
    if [[ "${SCRATCHDIR}" =~ scratch ]]    if [[ "${SCRATCHDIR}" =~ scratch ]]
Ligne 145: Ligne 146:
    # cette commande est DANGEREUSE !    # cette commande est DANGEREUSE !
    #  /bin/rm -rf ${SCRATCHDIR}/    #  /bin/rm -rf ${SCRATCHDIR}/
-     /bin/mkdir -p ${SCRATCHDIR}+     /bin/mkdir -p "${SCRATCHDIR}"
    fi    fi
 fi fi
  
 ### copie des fichiers sources dans le /scratch ### copie des fichiers sources dans le /scratch
-/bin/cp ${HOMEDIR}/* ${SCRATCHDIR}/+/bin/cp -- "${HOMEDIR}/*" "${SCRATCHDIR}/"
  
 ### se placer dans le repertoire d'execution AVANT le lancement du programme ### se placer dans le repertoire d'execution AVANT le lancement du programme
-cd ${SCRATCHDIR}+cd "${SCRATCHDIR}" || { echo "cannot cd to ${SCRATCHDIR}"; exit 1; }
  
 ### execution du programme ### execution du programme
Ligne 161: Ligne 162:
  
 ### recuperation des resultats à la fin du calcul ### recuperation des resultats à la fin du calcul
-/bin/cp ${SCRATCHDIR}/* ${HOMEDIR}/+/bin/cp -- "${SCRATCHDIR}/*" "${HOMEDIR}/"
  
 ### delete le dossier sur /scratch ### delete le dossier sur /scratch
 if [[ "${SCRATCHDIR}" =~ scratch ]] if [[ "${SCRATCHDIR}" =~ scratch ]]
 then then
-  /bin/rm -rf ${SCRATCHDIR}+  /bin/rm -rf "${SCRATCHDIR}"
 fi fi
  
 ### ###
 # fin # fin
- 
 </code> </code>
 ===== job parallèle, variantes ===== ===== job parallèle, variantes =====
 +
 +
 +  * variante utilisant [[documentation:tools:modules|Environment Modules]]
 +
 +
 +<code bash>
 +#!/bin/bash
 +#[...]
 +
 +source /usr/share/lmod/lmod/init/bash
 +module load R/3.2.4
 +
 +#[...]
 +</code>
  
   * variante du script : Appel à plusieurs queues (même cluster)   * variante du script : Appel à plusieurs queues (même cluster)
Ligne 212: Ligne 226:
   * variante : Copie des inputs dans ''/scratch''   * variante : Copie des inputs dans ''/scratch''
  
-<code bash>+<code bash var1_copy_inputs.sh>
 #!/bin/bash #!/bin/bash
 #[...] #[...]
  
 # Copy input from home to scratch (pick bash or tcsh version) # Copy input from home to scratch (pick bash or tcsh version)
-cd $SGE_O_WORKDIR+cd "${SGE_O_WORKDIR}" || { echo "cannot cd to ${SGE_O_WORKDIR}"; exit 1; } 
 # for bash: # for bash:
-SCRATCHDIR=${SGE_O_WORKDIR/home/scratch+SCRATCH="/scratch/Bio" 
-# for tcsh/csh: +SCRATCHDIR=${SGE_O_WORKDIR/"${HOME}"/"${SCRATCH}"} 
-#set SCRATCHDIR = `echo $SGE_O_WORKDIR | awk -F "/" '{$2="scratch"; for(j=2;j<=NF;j++) {printf("/%s",$j);print ""' ` + 
-/bin/mkdir -p $SCRATCHDIR +/bin/mkdir -p "${SCRATCHDIR}" 
-/bin/cp -rf $INPUT $SCRATCHDIR/+ 
 +# you only can know what $INPUT is 
 +/bin/cp -rf -- "${INPUT}" "${SCRATCHDIR}/"
  
 # go to scratch (instead of workdir) before running binary # go to scratch (instead of workdir) before running binary
-cd ${SCRATCHDIR}+cd "${SCRATCHDIR}" || { echo "cannot cd to ${SCRATCHDIR}"; exit 1; }
  
 # run whatever binary # run whatever binary
-whatever < $INPUT > $OUTPUT+whatever < "${INPUT}" "${OUTPUT}"
  
 # copy results from scratch to home # copy results from scratch to home
-/bin/cp -r $SCRATCHDIR/$OUTPUT $SGE_O_WORKDIR/ +/bin/cp -r -- "${SCRATCHDIR}/${OUTPUT}" "${SGE_O_WORKDIR}/"
 </code> </code>
  
   * variante : Vérification de l'existence du ''/scratch'' (**bash only**)   * variante : Vérification de l'existence du ''/scratch'' (**bash only**)
  
-<code bash>+<code bash var1_scratch_exist.sh>
 #!/bin/bash #!/bin/bash
 #[...] #[...]
  
-cd $SGE_O_WORKDIR+cd "${SGE_O_WORKDIR}" || { echo "cannot cd to ${SGE_O_WORKDIR}"; exit 1; } 
 # for bash: # for bash:
-SCRATCHDIR=${SGE_O_WORKDIR/home/scratch}+SCRATCH="/scratch/E5N" 
 +SCRATCHDIR=${SGE_O_WORKDIR/"${HOME}"/"${SCRATCH}"}
  
 if [[ -d "/scratch" ]] if [[ -d "/scratch" ]]
 then then
-  mkdir -p ${SCRATCHDIR}+  mkdir -p "${SCRATCHDIR}"
 else else
   echo "/scratch not found, cannot create ${SCRATCHDIR}"   echo "/scratch not found, cannot create ${SCRATCHDIR}"
Ligne 254: Ligne 272:
 fi fi
  
-/bin/cp -rf $INPUT $SCRATCHDIR/+/bin/cp -rf "${INPUT}" "${SCRATCHDIR}/"
  
 # go to scratch (instead of workdir) before running binary # go to scratch (instead of workdir) before running binary
-cd ${SCRATCHDIR}+cd "${SCRATCHDIR}" || { echo "cannot cd to ${SCRATCHDIR}"; exit 1; } 
  
 </code> </code>
Ligne 263: Ligne 282:
   * variante : Vérification de l'existence du ''/scratch'' global (**bash only**)   * variante : Vérification de l'existence du ''/scratch'' global (**bash only**)
  
-<code bash>+<code bash var1_create_scratch.sh> 
 +#!/bin/bash
 ### creation avec verification scratch global ### creation avec verification scratch global
-if [[ -d "/scratch" ]]+### avoid bash substitution 
 +### SCRATCHDIR=${SGE_O_WORKDIR/"${HOME}"/"${SCRATCH}"
 + 
 +if [[ -d "/scratch/Lake" ]]
 then then
-# pour scratch X5 queues X5* +    SCRATCHDIR="/scratch/Lake/${USER}/${JOB_ID}/" 
-  if [[ -"/scratch/x5570-gfs-scratch" ]] +elif [[ -"/scratch/E5N" ]] 
-# pour scratch E5 queues E5* +then 
-#  if [[ -"/scratch/e5-2670-gfs-scratch" ]] +    SCRATCHDIR="/scratch/E5N/${USER}/${JOB_ID}/" 
-  then +elif [[ -"/scratch/X5" ]] 
-    mkdir -p ${SCRATCHDIR+then 
-  else +    SCRATCHDIR="/scratch/X5/${USER}/${JOB_ID}/"
-    echo "/scratch not found, cannot create ${SCRATCHDIR}" +
-    exit 1 +
-  fi+
 else else
-  echo "/scratch not found, cannot create ${SCRATCHDIR}" +    echo "/scratch not found, cannot create ${SCRATCHDIR}, fall back to current directory
-  exit 1+    SCRATCHDIR="${SGE_O_WORKDIR}/scratch/"
 fi fi
 +mkdir -p "${SCRATCHDIR}"
 </code> </code>
  
  
-  * variante : Job gaussian sur 8 coeurs+  * variante : Job gaussian sur 8 coeurs ou 4 coeurs (mais réservation d'un noeud entier à 8 coeurs)
  
 <code bash> <code bash>
Ligne 291: Ligne 312:
 #$ -q x41zlin32gb #$ -q x41zlin32gb
 #$ -pe gaussian8 8 #$ -pe gaussian8 8
- 
-#[...] 
-</code> 
- 
-  * variante : Job gaussian sur 4 coeurs (mais réservation d'un noeud entier à 8 coeurs) 
- 
-<code bash> 
-#!/bin/bash 
-### SGE 
-#$ -q sl390lin48 
-#$ -pe gaussian8 4 
  
 #[...] #[...]
Ligne 312: Ligne 322:
 #[...] #[...]
  
-cd ${SCRATCHDIR} +cd "${SCRATCHDIR}" || { echo "cannot cd to ${SCRATCHDIR}"; exit 1; 
-export GAUSS_SCRDIR=${SCRATCHDIR}+export GAUSS_SCRDIR="${SCRATCHDIR}"
  
 #[...] #[...]
Ligne 325: Ligne 335:
 ### SGE ### SGE
 #$ -q sl390lin48 #$ -q sl390lin48
-#$ -pe gaussian8 4+#$ -pe gaussian8 8
 #$ -cwd #$ -cwd
 #$ -V #$ -V
Ligne 331: Ligne 341:
 NPERSOCKET="4" NPERSOCKET="4"
 # #
-${MPIRUN} -prefix ${PREFIX} -mca btl sm,openib,self -npersocket ${NPERSOCKET} -bycore -bind-to-core -report-bindings -np ${NSLOTS} ${EXECDIR}/MonProgrammeOpenmpi+"${MPIRUN}-prefix "${PREFIX}-mca btl vader,openib,self -npersocket "${NPERSOCKET}-bycore -bind-to-core -report-bindings -np "${NSLOTS}" "${EXECDIR}/MonProgrammeOpenmpi"
  
 </code> </code>
Ligne 341: Ligne 351:
 #!/bin/bash #!/bin/bash
 ### variables SGE ### variables SGE
-HOMEDIR=$SGE_O_WORKDIR+HOMEDIR="${SGE_O_WORKDIR}"
 ### shell du job: ### shell du job:
 #$ -S /bin/bash #$ -S /bin/bash
Ligne 358: Ligne 368:
  
 # Variables pour OPENMP # Variables pour OPENMP
-#export OMP_NUM_THREADS=$NSLOTS +#export OMP_NUM_THREADS="8" 
-export OMP_NUM_THREADS=8+export OMP_NUM_THREADS=${NSLOTS}
  
-${EXEC_DIR}/run_RSEM.pl --transcripts ${TRINITY} --name_sorted_bam ${file} --paired --group_by_component+ 
 +"${EXEC_DIR}"/run_RSEM.pl --transcripts "${TRINITY}--name_sorted_bam "${file}--paired --group_by_component
  
 </code> </code>
  
 +<note tip>Many more examples scripts are available on our [[https://github.com/ltaulell/submission_scripts|github repository]]</note>
  
-  * variante utilisant [[documentation:tools:modules|Environment Modules]] 
  
-<code bash> +===== Références =====
-#!/bin/bash +
-#[...]+
  
-### modeles: +  * https://wiki.crc.nd.edu/w/index.php/Submitting_an_array_Job_to_SGE 
-#source /usr/local/modeles/set_debian7-clean.sh +  * https://bioinformatics.uconn.edu/resources-and-events/tutorials-2/script-array-job/
-#source /usr/local/modeles/sge.sh +
-#source /usr/local/modeles/openmpi-1.4.1-intel-11.1.069.sh +
- +
-source /usr/share/modules/init/bash +
-module use /applis/PSMN/Modules +
-module load Base/psmn +
-module load openmpi/1.4.1-intel-11.1.069 +
- +
-#[...] +
-</code>+