Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
documentation:examples:submit_scripts [2020/07/23 15:00] – [job parallèle] ltaulell | documentation:examples:submit_scripts [2023/01/13 09:39] (Version actuelle) – supprimée ccalugar | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ====== Exemples de scripts de soumission ====== | ||
- | <note warning> | ||
- | |||
- | <note tip>Many more examples scripts are available on our [[https:// | ||
- | |||
- | |||
- | ===== job parallèle ===== | ||
- | |||
- | * Soumission avec un seul script | ||
- | * Usage du ''/ | ||
- | * Configuration de l' | ||
- | * Parallel Environment and '' | ||
- | * 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** : '' | ||
- | |||
- | <code bash parexample.sh> | ||
- | #!/bin/bash | ||
- | ### variables SGE | ||
- | ### shell du job | ||
- | #$ -S /bin/bash | ||
- | ### nom du job (a changer) | ||
- | #$ -N testbash | ||
- | ### file d' | ||
- | #$ -q E5_test | ||
- | ### parallel environnement & nslots (a changer) | ||
- | #$ -pe mpi8_debian 8 | ||
- | ### charger l' | ||
- | #$ -cwd | ||
- | ### exporte les variables d' | ||
- | #$ -V | ||
- | ### mails en debut et fin d' | ||
- | #$ -m b | ||
- | #$ -m e | ||
- | |||
- | |||
- | ### sinon SGE travaille dans ~/ | ||
- | cd " | ||
- | |||
- | ### environment modules | ||
- | source / | ||
- | module load GCC/ | ||
- | |||
- | ### definition SCRATCHDIR | ||
- | SCRATCH="/ | ||
- | SCRATCHDIR=${SGE_O_WORKDIR/" | ||
- | ### verif SCRATCHDIR | ||
- | echo " | ||
- | |||
- | BINDIR="/ | ||
- | EXEC=" | ||
- | |||
- | ### PREFIX doit matcher le modele openmpi (ligne 18) | ||
- | PREFIX="/ | ||
- | MPIRUN=" | ||
- | ### necessaire si plusieurs noeuds | ||
- | ### HOSTFILE=${TMPDIR}/ | ||
- | |||
- | ### creation du repertoire de travail dans le /scratch | ||
- | if [[ ! -d " | ||
- | then | ||
- | /bin/mkdir -p " | ||
- | fi | ||
- | |||
- | |||
- | ### copie des fichiers input dans le /scratch | ||
- | for FICHIER in INPUT.hdf5 MATHRICE cube3x3 | ||
- | do | ||
- | cp -- " | ||
- | done | ||
- | |||
- | ### nettoyage d' | ||
- | ### lancement du programme, si necessaire | ||
- | for FICHIER in OUTPUT.hdf5 mathrice.o | ||
- | do | ||
- | if [[ -e " | ||
- | then | ||
- | /bin/rm -f " | ||
- | fi | ||
- | done | ||
- | |||
- | ### hostfile SGE si repartition sur plusieurs noeuds | ||
- | ### ${TMPDIR}/ | ||
- | /bin/cat " | ||
- | /bin/rm -f " | ||
- | Master=$(/ | ||
- | /bin/echo " | ||
- | |||
- | ### se placer dans le repertoire d' | ||
- | cd " | ||
- | |||
- | ##${MPIRUN} -prefix ${PREFIX} -mca btl sm, | ||
- | " | ||
- | |||
- | ### recuperation des resultats à la fin du calcul | ||
- | for FICHIER in OUTPUT.hdf5 mathrice.o | ||
- | do | ||
- | cp -- " | ||
- | done | ||
- | |||
- | ### | ||
- | </ | ||
- | |||
- | <code bash test_scratch.sh> | ||
- | #!/bin/bash | ||
- | # | ||
- | ### variables SGE | ||
- | ### shell du job | ||
- | #$ -S /bin/bash | ||
- | ### nom du job (a changer) | ||
- | #$ -N test1 | ||
- | ### file d' | ||
- | #$ -q E5_test | ||
- | ### charger l' | ||
- | #$ -cwd | ||
- | ### exporter les variables d' | ||
- | #$ -V | ||
- | ### mails en debut et fin d' | ||
- | #$ -m b | ||
- | #$ -m e | ||
- | |||
- | # aller dans le repertoire de travail/ | ||
- | # important, sinon, le programme est lancé depuis ~/ | ||
- | cd " | ||
- | |||
- | ### configurer l' | ||
- | source / | ||
- | module load IntelComp/ | ||
- | |||
- | ### definition SCRATCHDIR | ||
- | # | ||
- | # | ||
- | SCRATCHDIR="/ | ||
- | ### verif SCRATCHDIR | ||
- | echo " | ||
- | |||
- | ### creation du repertoire de travail dans le /scratch | ||
- | if [[ ! -d " | ||
- | then | ||
- | / | ||
- | else | ||
- | if [[ " | ||
- | then | ||
- | # cette commande est DANGEREUSE ! | ||
- | # | ||
- | / | ||
- | fi | ||
- | fi | ||
- | |||
- | ### copie des fichiers sources dans le /scratch | ||
- | /bin/cp -- " | ||
- | |||
- | ### se placer dans le repertoire d' | ||
- | cd " | ||
- | |||
- | ### execution du programme | ||
- | ## | ||
- | ## | ||
- | ./test1.exe | ||
- | |||
- | ### recuperation des resultats à la fin du calcul | ||
- | /bin/cp -- " | ||
- | |||
- | ### delete le dossier sur /scratch | ||
- | if [[ " | ||
- | then | ||
- | /bin/rm -rf " | ||
- | fi | ||
- | |||
- | ### | ||
- | # fin | ||
- | </ | ||
- | ===== job parallèle, variantes ===== | ||
- | |||
- | |||
- | * variante utilisant [[documentation: | ||
- | |||
- | |||
- | <code bash> | ||
- | #!/bin/bash | ||
- | #[...] | ||
- | |||
- | source / | ||
- | module load R/3.2.4 | ||
- | |||
- | #[...] | ||
- | </ | ||
- | |||
- | * variante du script : Appel à plusieurs queues (même cluster) | ||
- | |||
- | <code bash> | ||
- | #!/bin/bash | ||
- | ### SGE | ||
- | #$ -q E5-2670deb64A, | ||
- | #$ -pe mpi16_debian 32 | ||
- | |||
- | #[...] | ||
- | </ | ||
- | |||
- | * variante : Appel à plusieurs queues (de clusters différents) | ||
- | |||
- | <code bash> | ||
- | #!/bin/bash | ||
- | ### SGE | ||
- | #$ -q dl165_debian, | ||
- | #$ -pe openmp8 8 | ||
- | |||
- | #[...] | ||
- | </ | ||
- | |||
- | * variante : Retirer un node (host) des nodes autorisés | ||
- | |||
- | <code bash> | ||
- | #!/bin/bash | ||
- | ### SGE | ||
- | #$ -q dl165_debian | ||
- | #$ -pe openmp8 8 | ||
- | ## node HS : | ||
- | #$ -l h=!dl165lin2 | ||
- | |||
- | #[...] | ||
- | </ | ||
- | |||
- | * variante : Copie des inputs dans ''/ | ||
- | |||
- | <code bash var1_copy_inputs.sh> | ||
- | #!/bin/bash | ||
- | #[...] | ||
- | |||
- | # Copy input from home to scratch (pick bash or tcsh version) | ||
- | cd " | ||
- | |||
- | # for bash: | ||
- | SCRATCH="/ | ||
- | SCRATCHDIR=${SGE_O_WORKDIR/" | ||
- | |||
- | /bin/mkdir -p " | ||
- | |||
- | # you only can know what $INPUT is | ||
- | /bin/cp -rf -- " | ||
- | |||
- | # go to scratch (instead of workdir) before running binary | ||
- | cd " | ||
- | |||
- | # run whatever binary | ||
- | whatever < " | ||
- | |||
- | # copy results from scratch to home | ||
- | /bin/cp -r -- " | ||
- | </ | ||
- | |||
- | * variante : Vérification de l' | ||
- | |||
- | <code bash var1_scratch_exist.sh> | ||
- | #!/bin/bash | ||
- | #[...] | ||
- | |||
- | cd " | ||
- | |||
- | # for bash: | ||
- | SCRATCH="/ | ||
- | SCRATCHDIR=${SGE_O_WORKDIR/" | ||
- | |||
- | if [[ -d "/ | ||
- | then | ||
- | mkdir -p " | ||
- | else | ||
- | echo "/ | ||
- | exit 1 | ||
- | fi | ||
- | |||
- | /bin/cp -rf " | ||
- | |||
- | # go to scratch (instead of workdir) before running binary | ||
- | cd " | ||
- | |||
- | |||
- | </ | ||
- | |||
- | * variante : Vérification de l' | ||
- | |||
- | <code bash var1_create_scratch.sh> | ||
- | #!/bin/bash | ||
- | ### creation avec verification scratch global | ||
- | ### avoid bash substitution | ||
- | ### SCRATCHDIR=${SGE_O_WORKDIR/" | ||
- | |||
- | if [[ -d "/ | ||
- | then | ||
- | SCRATCHDIR="/ | ||
- | elif [[ -d "/ | ||
- | then | ||
- | SCRATCHDIR="/ | ||
- | elif [[ -d "/ | ||
- | then | ||
- | SCRATCHDIR="/ | ||
- | else | ||
- | echo "/ | ||
- | SCRATCHDIR=" | ||
- | fi | ||
- | mkdir -p " | ||
- | </ | ||
- | |||
- | |||
- | * variante : Job gaussian sur 8 coeurs ou 4 coeurs (mais réservation d'un noeud entier à 8 coeurs) | ||
- | |||
- | <code bash> | ||
- | #!/bin/bash | ||
- | ### SGE | ||
- | #$ -q x41zlin32gb | ||
- | #$ -pe gaussian8 8 | ||
- | |||
- | #[...] | ||
- | </ | ||
- | |||
- | * variante : Job gaussian dans le ''/ | ||
- | |||
- | <code bash> | ||
- | #!/bin/bash | ||
- | #[...] | ||
- | |||
- | cd " | ||
- | export GAUSS_SCRDIR=" | ||
- | |||
- | #[...] | ||
- | </ | ||
- | |||
- | |||
- | * variante : Directives particulières, | ||
- | |||
- | <code bash> | ||
- | #!/bin/bash | ||
- | ### SGE | ||
- | #$ -q sl390lin48 | ||
- | #$ -pe gaussian8 8 | ||
- | #$ -cwd | ||
- | #$ -V | ||
- | # | ||
- | NPERSOCKET=" | ||
- | # | ||
- | " | ||
- | |||
- | </ | ||
- | |||
- | |||
- | * variante : Programme pseudo-parallèle, | ||
- | |||
- | <code bash> | ||
- | #!/bin/bash | ||
- | ### variables SGE | ||
- | HOMEDIR=" | ||
- | ### shell du job: | ||
- | #$ -S /bin/bash | ||
- | ### nom du job: | ||
- | #$ -N testbash | ||
- | ### file d' | ||
- | #$ -q monoamddeb25 | ||
- | ### parallel environnement & nslots | ||
- | #$ -pe openmp8 8 | ||
- | ### charger l' | ||
- | #$ -cwd | ||
- | ### exporte les variables d' | ||
- | #$ -V | ||
- | |||
- | #[...] | ||
- | |||
- | # Variables pour OPENMP | ||
- | #export OMP_NUM_THREADS=" | ||
- | export OMP_NUM_THREADS=${NSLOTS} | ||
- | |||
- | |||
- | " | ||
- | |||
- | </ | ||
- | |||
- | <note tip>Many more examples scripts are available on our [[https:// | ||
- | |||
- | |||
- | ===== Références ===== | ||
- | |||
- | * https:// | ||
- | * https:// |