Ceci est une ancienne révision du document !
The program SommeVecVecPAR.f90 performs the sum of the two vectors A and B. The result is put in C. Each step is performed on 2 processes. If the program runs on multiple cores, only two cores will actually be used.
module avail module load GCC/7.2.0/OpenMPI/3.0.0
mpifort -showme gfortran .....
mpifort -o SommeVecVecPAR.exe SommeVecVecPAR.f90
The binary file (executable) SommeVecVecPAR.exe has been generated.
mpirun -np 2 ./SommeVecVecPAR.exe
The result is displayed on the screen:
LES DEUX VECTEURS : A = 1 2 3 4 5 6 7 8 9 10 B = 9 8 7 6 5 4 3 2 1 0 LES DEUX VECTEURS LOCAUX : Je suis le proc 0 parmi 2 processus A local ( proc 0 ) = 1 2 3 4 5 B local ( proc 0 ) = 9 8 7 6 5 Je suis le proc 1 parmi 2 processus A local ( proc 1 ) = 6 7 8 9 10 B local ( proc 1 ) = 4 3 2 1 0 LE VECTEUR SOMME LOCAL : C local ( proc 1 ) = 10 10 10 10 10 C local ( proc 0 ) = 10 10 10 10 10 LE VECTEUR SOMME : C = 10 10 10 10 10 10 10 10 10 10
We use a submission script batch.sh to submit the job on compute clusters.
It is the submission script that configures the environment and then calls your binary (with its options, if any) on the execution node.
SGE → batch.sh → binaire
qsub batch.sh Your job 336000 ("SommeVecVecPAR") has been submitted
qstat job-ID prior name user state submit/start at queue slots ja-task-ID ----------------------------------------------------------------------------------------------------------------- 336000 0.00000 SommeVecVecPAR Login qw 02/14/2018 10:53:51 2 qstat job-ID prior name user state submit/start at queue slots ja-task-ID ----------------------------------------------------------------------------------------------------------------- 336000 0.05000 SommeVecVecPAR Login r 02/14/2018 10:54:16 r410B_ib_test@r410lin57.ens-ly 2
The output of the screen (standard output) is redirected to the file SommeVecVecPAR.o336000
The error output (standard error) is redirected to the file SommeVecVecPAR.e336000
.
cat SommeVecVecPAR.o336000 /home/ccalugar/Support/FormationPSMN/SommeVecVecPar LES DEUX VECTEURS : A = 1 2 3 4 5 6 7 8 9 10 B = 9 8 7 6 5 4 3 2 1 0 LES DEUX VECTEURS LOCAUX : Je suis le proc 0 parmi 2 processus A local ( proc 0 ) = 1 2 3 4 5 B local ( proc 0 ) = 9 8 7 6 5 LE VECTEUR SOMME LOCAL : C local ( proc 0 ) = 10 10 10 10 10 LE VECTEUR SOMME : C = 10 10 10 10 10 10 10 10 10 10 Je suis le proc 1 parmi 2 processus A local ( proc 1 ) = 6 7 8 9 10 B local ( proc 1 ) = 4 3 2 1 0 C local ( proc 1 ) = 10 10 10 10 10