strutture:cnaf:cnaf_rd:infrastruttura:utilizzo_cluster:job_mpi
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
strutture:cnaf:cnaf_rd:infrastruttura:utilizzo_cluster:job_mpi [2013/10/31 08:45] – created caberletti@infn.it | strutture:cnaf:cnaf_rd:infrastruttura:utilizzo_cluster:job_mpi [2013/11/22 14:44] (current) – caberletti@infn.it | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Job MPI ====== | ||
+ | ===== Intel MPI ===== | ||
+ | |||
+ | Programma di test: | ||
+ | <code C> | ||
+ | #include " | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | int | ||
+ | main (int argc, char *argv[]) | ||
+ | { | ||
+ | int i, rank, size, namelen; | ||
+ | char name[MPI_MAX_PROCESSOR_NAME]; | ||
+ | MPI_Status stat; | ||
+ | |||
+ | MPI_Init (&argc, &argv); | ||
+ | |||
+ | MPI_Comm_size (MPI_COMM_WORLD, | ||
+ | MPI_Comm_rank (MPI_COMM_WORLD, | ||
+ | MPI_Get_processor_name (name, & | ||
+ | |||
+ | if (rank == 0) { | ||
+ | |||
+ | printf (" | ||
+ | |||
+ | for (i = 1; i < size; i++) { | ||
+ | MPI_Recv (&rank, 1, MPI_INT, i, 1, MPI_COMM_WORLD, | ||
+ | MPI_Recv (&size, 1, MPI_INT, i, 1, MPI_COMM_WORLD, | ||
+ | MPI_Recv (& | ||
+ | MPI_Recv (name, namelen + 1, MPI_CHAR, i, 1, MPI_COMM_WORLD, | ||
+ | printf (" | ||
+ | } | ||
+ | |||
+ | } else { | ||
+ | |||
+ | MPI_Send (&rank, 1, MPI_INT, 0, 1, MPI_COMM_WORLD); | ||
+ | MPI_Send (&size, 1, MPI_INT, 0, 1, MPI_COMM_WORLD); | ||
+ | MPI_Send (& | ||
+ | MPI_Send (name, namelen + 1, MPI_CHAR, 0, 1, MPI_COMM_WORLD); | ||
+ | |||
+ | } | ||
+ | |||
+ | MPI_Finalize (); | ||
+ | |||
+ | return (0); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Compilazione: | ||
+ | < | ||
+ | $ module load ips-xe-2013 intel-mpi | ||
+ | $ mpiicc -o test test.c | ||
+ | </ | ||
+ | |||
+ | ==== LSF ==== | ||
+ | |||
+ | Esempio di job LSF che fa utilizzo di Intel MPI: | ||
+ | <code bash> | ||
+ | #BSUB -J impi | ||
+ | #BSUB -o %J.out # Job standard output | ||
+ | #BSUB -e %J.err # Job standard error | ||
+ | #BSUB -N # Job report | ||
+ | #BSUB -B # Send mail | ||
+ | #BSUB -q normal # Job queue | ||
+ | #BSUB -a intelmpi | ||
+ | #BSUB -m rd-coka-02 | ||
+ | #BSUB -n 10 # Number of process | ||
+ | # | ||
+ | # commands | ||
+ | module load ips-xe-2013 intel-mpi | ||
+ | mpirun.lsf / | ||
+ | </ | ||
+ | |||
+ | Salvare in un file, ad esempio '' | ||
+ | <code bash> | ||
+ | $ bsub < impi.job | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Slurm ==== | ||
+ | |||
+ | Con Slurm occorre tenere presente che il comando '' | ||
+ | ma riserva solamente le risorse. | ||
+ | Per questo occorre indicare il numero di processi | ||
+ | Esempio di job: | ||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | #SBATCH -J test_impi | ||
+ | #SBATCH -p coka-test | ||
+ | #SBATCH -e %J.err | ||
+ | #SBATCH -o %J.out | ||
+ | #SBATCH -n 10 # Task number | ||
+ | #SBATCH -w rd-coka-[01-02] | ||
+ | #SBATCH -D / | ||
+ | #SBATCH --mail-type=ALL | ||
+ | #SBATCH --mail-user=mcaberletti@rd-ui | ||
+ | |||
+ | # commands | ||
+ | module load ips-xe-2013 intel-mpi | ||
+ | srun ./test | ||
+ | </ | ||
+ | |||
+ | Salvare in un file, ad esempio '' | ||
+ | <code bash> | ||
+ | $ sbatch impi.job | ||
+ | </ |