This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
cluster [2019/10/03 14:07] osotolongo [Hard batching] |
cluster [2020/05/04 10:23] osotolongo [Paralelizando un archivo de ordenes] |
||
---|---|---|---|
Line 3: | Line 3: | ||
[[https:// | [[https:// | ||
- | El cluster (//brick//) consta de cuatro | + | El cluster (//brick//) consta de tres nodos (//brick01, brick02 y brick03//). Lo que sigue describe la operativa básica para ejecutar tareas en estas maquinas de una manera ordenada |
{{ :: | {{ :: | ||
Line 417: | Line 417: | ||
{{:: | {{:: | ||
+ | |||
+ | |||
+ | ===== Paralelizando un archivo de ordenes ===== | ||
+ | |||
+ | Podemos abstraer todo esto en un script simple para paralelizar las ordenes escritas en un solo archivo. | ||
+ | |||
+ | Ejemplo, este script, | ||
+ | |||
+ | <code perl slurmize.pl> | ||
+ | # | ||
+ | use strict; | ||
+ | use warnings; | ||
+ | |||
+ | #Cambiar aqui el tiempo maximo de ejecucion | ||
+ | my $time = ' | ||
+ | |||
+ | my $ifile = $ARGV[0]; | ||
+ | my $wdir = ' | ||
+ | mkdir $wdir; | ||
+ | my $count = 0; | ||
+ | open IPDF, "< | ||
+ | while (< | ||
+ | $count++; | ||
+ | my $ofile = sprintf (" | ||
+ | $ofile = $wdir.'/' | ||
+ | open ORD, "> | ||
+ | print ORD '# | ||
+ | print ORD '# | ||
+ | print ORD '# | ||
+ | print ORD '# | ||
+ | print ORD '# | ||
+ | print ORD '# | ||
+ | print ORD '# | ||
+ | print ORD '# | ||
+ | print ORD '# | ||
+ | print ORD "srun $_\n"; | ||
+ | close ORD; | ||
+ | system(" | ||
+ | } | ||
+ | close IPDF; | ||
+ | my $orderfile = $wdir.'/' | ||
+ | open ORD, "> | ||
+ | print ORD '# | ||
+ | print ORD '# | ||
+ | print ORD '# | ||
+ | print ORD '# | ||
+ | print ORD '# | ||
+ | print ORD ": | ||
+ | close ORD; | ||
+ | my $xorder = ' | ||
+ | exec($xorder); | ||
+ | </ | ||
+ | |||
+ | lee un archivo de entrada y ejecuta cada linea como una tarea de SLURM. Para esto basta hacer, | ||
+ | |||
+ | <code bash> | ||
+ | $ ./ | ||
+ | </ | ||
+ | |||
+ | donde // | ||
+ | |||
+ | ==== ejemplo ==== | ||
+ | * Las ordenes deben ejecutarse dentro del directorio /nas/ para que el sistema de archivos sea accesible a todos los nodos. | ||
+ | * Escribo las ordenes dentro de un archivo (en este caso //test//) | ||
+ | * Ejecuto el script dando como argumento el nombre del archivo de ordenes | ||
+ | * Las tareas seenvian a los nodos del cluster | ||
+ | * El output (STDOUT & STDERR) queda dentro del directorio //slurm// en un archivo distinto para cada proceso | ||
+ | * Tambien pueden mirarse los scripts individuales que quedan en el mismo directorio | ||
+ | |||
+ | |||
+ | <code bash> | ||
+ | [osotolongo@detritus slurmit]$ pwd | ||
+ | / | ||
+ | [osotolongo@detritus slurmit]$ cat test | ||
+ | sleep 2000; | ||
+ | sleep 2000; | ||
+ | sleep 2000; | ||
+ | [osotolongo@detritus slurmit]$ ./ | ||
+ | Submitted batch job 129583 | ||
+ | Submitted batch job 129584 | ||
+ | Submitted batch job 129585 | ||
+ | Submitted batch job 129586 | ||
+ | [osotolongo@detritus slurmit]$ squeue | grep test | ||
+ | 129586 | ||
+ | 129583 | ||
+ | 129584 | ||
+ | 129585 | ||
+ | [osotolongo@detritus slurmit]$ tree | ||
+ | . | ||
+ | ├── slurm | ||
+ | │ ├── sorder_0001.sh | ||
+ | │ ├── sorder_0002.sh | ||
+ | │ ├── sorder_0003.sh | ||
+ | │ ├── test-129583 | ||
+ | │ ├── test-129584 | ||
+ | │ ├── test-129585 | ||
+ | │ └── test_end.sh | ||
+ | ├── slurmize.pl | ||
+ | └── test | ||
+ | |||
+ | 1 directory, 9 files | ||
+ | |||
+ | </ | ||