Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
en:documentation:tutorials:build:fortran_parallele [2018/11/20 10:55] – créée cicalugaen:documentation:tutorials:build:fortran_parallele [2023/12/12 13:00] (Version actuelle) – supprimée ltaulell
Ligne 1: Ligne 1:
-====== Compilation and execution of a program (Fortran 90) ====== 
  
- 
-===== Fortran 90 language, parallel code (MPI) ===== 
- 
-The program [[documentation:examples:sommevecvecpar.f90|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. 
- 
-==== Compilation of a program : ==== 
- 
-=== Definition of the environment : : === 
-  
-  * definition of the environment :  
-<code bash> 
-module avail 
-module load GCC/7.2.0/OpenMPI/3.0.0  
-</code> 
- 
- 
-  * checking  
-<code> 
-mpifort -showme 
- 
-gfortran ..... 
-</code> 
- 
-=== Compilation : === 
- 
- 
-<code> 
-mpifort -o SommeVecVecPAR.exe SommeVecVecPAR.f90  
-</code> 
- 
- 
-The binary file (executable) SommeVecVecPAR.exe has been generated. 
- 
-====Execution of the program:==== 
- 
-=== Running on the build server: === 
- 
-<code> 
-mpirun -np 2 ./SommeVecVecPAR.exe 
-</code> 
- 
-The result is displayed on the screen: 
- 
-<code> 
-LES DEUX VECTEURS : 
-A =            1                                                                                          10 
-B =            9                                                                                           0 
- 
-LES DEUX VECTEURS LOCAUX : 
-Je suis le proc            0 parmi            2  processus 
-A local ( proc            0  )  =            1                                         5 
-B local ( proc            0  )  =            9                                         5 
-Je suis le proc            1 parmi            2  processus 
-A local ( proc            1  )  =            6                                        10 
-B local ( proc            1  )  =            4                                         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 
-</code> 
- 
-=== Running on the cluster: === 
- 
- 
-We use a submission script [[http://www.ens-lyon.fr/PSMN/doku.php?id=en:documentation:tutorials:submit)|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'' 
- 
-<code> 
-qsub batch.sh 
-Your job 336000 ("SommeVecVecPAR") has been submitted 
-</code> 
- 
-<code> 
-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         02/14/2018 10:54:16 r410B_ib_test@r410lin57.ens-ly      
-</code> 
- 
-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''. 
- 
-<code> 
-cat SommeVecVecPAR.o336000 
- 
-/home/ccalugar/Support/FormationPSMN/SommeVecVecPar 
- LES DEUX VECTEURS : 
- A =            1                                                                                          10 
- B =            9                                                                                           0 
- LES DEUX VECTEURS LOCAUX : 
- Je suis le proc            0 parmi            2  processus 
- A local ( proc            0  )  =            1                                         5 
- B local ( proc            0  )  =            9                                         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                                        10 
- B local ( proc            1  )  =            4                                         0 
- C local ( proc            1  )  =           10          10          10          10          10 
-</code>