Parcourir la source

simplification array matlab: le double script est inutile!

Ph. Marion il y a 2 ans
Parent
commit
17186f86f2
4 fichiers modifiés avec 49 ajouts et 80 suppressions
  1. 2 13
      OAR_array/README.md
  2. 0 38
      OAR_array/gc_array.oar
  3. 0 29
      OAR_array/gc_matlab.sh
  4. 47 0
      OAR_array/gc_matlab_array.oar

+ 2 - 13
OAR_array/README.md

@@ -33,22 +33,11 @@ Le nombre d'intervalles est passé en argument (regroupé dans le fichier pi_inp
 Le programme résout un système linéaire par la méthode itérative du gradient conjugué.
 Le script matlab a été tranformé en fonction: gradientconj(n,tolerance,maxiter)
 
-
-- oarsub -S ./gc_array.oar
-
-note: contrairement à l'exemple 1 (ci-dessus) et à l'exemple [gradient
-conjugué](https://www-calculco.univ-littoral.fr/utilisation/tutoriaux/matlab#h3-2-2-batch-simple-2)
-des tutoriaux, le script bash OAR ne peut accepter la syntaxe de
-commande:
-
- `matlab -nodisplay -nodesktop -nojvm -r 'testgradientconj("$@");exit'" ` 
-
-L'astuce employée ici est de passer par autre script de lancement intermédiaire: gc_matlab.sh
+- oarsub -S ./gc_matlab_array.oar
 
 #### description des fichiers
 
-- gc_array.oar : le script OAR à lancer (oarsub -S ./gc_array.oar)
-- gc_matlab.sh : réordonne les paramètres et lance la commande matlab proprement dite
+- gc_matlab_array.oar : le script OAR à lancer (oarsub -S ./gc_array.oar)
 - gradientconj.m : prog. matlab 
 - gc_input.txt : paramètres des différents jobs ( n, tol, maxiter )
    - 1000 1e-5 1000

+ 0 - 38
OAR_array/gc_array.oar

@@ -1,38 +0,0 @@
-#!/bin/bash
-################################################################################
-#
-################################################################################
-
-
-#-----------------------------------------------------------
-# Les directives OAR
-#-----------------------------------------------------------
-# donner un nom au job
-
-#OAR -n matlab_gc_array
-
-# les ressources
-#OAR -l /core=1,walltime=00:20
-
-# le fichier de paramètres (1 ligne par instance)
-#OAR --array-param-file gc_input.txt
-
-# la file de soumission
-#OAR -t besteffort
-#OAR -t idempotent
-
-
-#OAR -O cg.%jobid%.stdout
-#OAR -E cg.%jobid%.stderror
-
-# optionnel (mais intéressant -cf gc_postraitement.sh -):
-# -> récupérer l'ID du job/batch lancé
-echo "array_id:$OAR_ARRAY_ID"
-
-# nom du programme
-PROG="gc_matlab.sh"
-
-./$PROG "$@"
-
-exit
-

+ 0 - 29
OAR_array/gc_matlab.sh

@@ -1,29 +0,0 @@
-#!/bin/bash
-
-
-# pour utiliser la fonctionnalité 'array' de OAR:
-# OAR --array-param-file param.txt, où param.txt
-# a une syntaxe prédéfinie qui ne peut lancer
-# notre fonction matlab :
-
-# gradientconj('$n,$tol,$maxiter)'
-
-# Il faut donc passer par un script secondaire (ce script)
-# qui récupère les 3 arguments
-#   - n = taille matrice 
-#   - tol = tolerance 
-#   - maxiter : nb iteration maximum 
-
-source /nfs/opt/env/env.sh > /dev/null 2>&1 
-module load matlab
-
-
-if [[ $# -ne 3 ]] ; then
-    echo '3  arguments obligatoires'
-    exit 0
-fi
-echo "params: $1, $2, $3"
-
-#straights_bench('$LDA,$TOL,$MATRICE,$SOLUTION)'
-
-matlab -nodesktop -nodisplay -nosplash -nojvm -r "gradientconj($1,$2,$3);exit"

+ 47 - 0
OAR_array/gc_matlab_array.oar

@@ -0,0 +1,47 @@
+#!/bin/bash
+
+#---------------------------------------------------------
+# calc gradient conjugué 
+#---------------------------------------------------------
+
+# donner un nom au job
+#OAR -n matlab_gc_array
+
+# les ressources
+#OAR -l /core=1,walltime=00:20
+
+# le fichier de paramètres (1 ligne par instance)
+#  n: matSize ; tolérance ; max. itération)
+#OAR --array-param-file gc_input.txt
+
+# la file de soumission
+#OAR -t besteffort
+#OAR -t idempotent
+
+
+#OAR -O cg.%jobid%.stdout
+#OAR -E cg.%jobid%.stderror
+
+# optionnel (mais intéressant -cf gc_postraitement.sh -):
+# -> récupérer l'ID du job/batch lancé
+echo "array_id:$OAR_ARRAY_ID"
+
+source /nfs/opt/env/env.sh > /dev/null 2>&1 
+module load matlab
+
+
+if [[ $# -ne 3 ]] ; then
+    echo '3  arguments obligatoires'
+    exit 0
+else
+    # gradientconj('$n,$tol,$maxiter)'
+    echo "params: $1, $2, $3"
+    n=$1
+    tol=$2
+    maxiter=$3
+    matlab -nodesktop -nodisplay -nosplash -nojvm -r "gradientconj($n,$tol,$maxiter);exit"
+fi
+
+exit
+
+