====== Job MPI ====== ===== Intel MPI ===== Programma di test: #include "mpi.h" #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, &size); MPI_Comm_rank (MPI_COMM_WORLD, &rank); MPI_Get_processor_name (name, &namelen); if (rank == 0) { printf ("Hello world: rank %d of %d running on %s\n", rank, size, name); for (i = 1; i < size; i++) { MPI_Recv (&rank, 1, MPI_INT, i, 1, MPI_COMM_WORLD, &stat); MPI_Recv (&size, 1, MPI_INT, i, 1, MPI_COMM_WORLD, &stat); MPI_Recv (&namelen, 1, MPI_INT, i, 1, MPI_COMM_WORLD, &stat); MPI_Recv (name, namelen + 1, MPI_CHAR, i, 1, MPI_COMM_WORLD, &stat); printf ("Hello world: rank %d of %d running on %s\n", rank, size, name); } } 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 (&namelen, 1, MPI_INT, 0, 1, MPI_COMM_WORLD); 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: #BSUB -J impi # Job name #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 # Application #BSUB -m rd-coka-02 # Host selection #BSUB -n 10 # Number of process # # commands module load ips-xe-2013 intel-mpi mpirun.lsf /home/GUEST/mcaberletti/test_intel_mpi/test Salvare in un file, ad esempio ''impi.job'' e sottometterlo con: $ bsub < impi.job ==== Slurm ==== Con Slurm occorre tenere presente che il comando ''sbatch'' non fa lo spawn di processi, ma riserva solamente le risorse. Per questo occorre indicare il numero di processi Esempio di job: #!/bin/bash #SBATCH -J test_impi # Job name #SBATCH -p coka-test # Queue #SBATCH -e %J.err # Stderr #SBATCH -o %J.out # Stdout #SBATCH -n 10 # Task number #SBATCH -w rd-coka-[01-02] # Host selection #SBATCH -D /home/GUEST/mcaberletti/test_intel_mpi # Working dir #SBATCH --mail-type=ALL # Send all notification via mail #SBATCH --mail-user=mcaberletti@rd-ui # commands module load ips-xe-2013 intel-mpi srun ./test Salvare in un file, ad esempio ''impi.job'' e sottometterlo con: $ sbatch impi.job