Ceci est une ancienne révision du document !


Compilation and execution of a program (Fortran)

Language Fortran 90, sequential code

The program SommeVecVecSEQ.f90 makes the sum of the two vectors A and B. The result is put in C.

Compilation of a program :

Definition of the environment :

  • definition of the environment :
module avail 
module load GCC/7.2.0 
  • checking the compiler version
gfortran --version
GNU Fortran (GCC) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc. 

Compilation :

gfortran -o SommeVecVecSEQ.exe SommeVecVecSEQ.f90 

The binary file (executable) SommeVecVecSEQ.f90.exe has been generated.

Exécution du programme :

Running on the build server :

./SommeVecVecSEQ.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

Le vecteur somme :

C =           10          10          10          10          10          10          10          10         10          10

Running on the cluster :

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.csh → binaire

qsub batch.csh
Your job 335982 ("SommeVecVecSEQ") has been submitted
qstat

job-ID  prior   name             user         state submit/start at     queue                  slots ja-task-ID 
-----------------------------------------------------------------------------------------------------------------
 335982 0.00000 SommeVecVecSEQ   ccalugar     qw    02/14/2018 10:37:46

qstat

job-ID  prior   name             user         state submit/start at     queue                  slots ja-task-ID 
-----------------------------------------------------------------------------------------------------------------
 335982 0.07300 SommeVecVecSEQ   ccalugar     r    02/14/2018 10:38:54  E5_test@c8220node145         1 
  • The output of the screen (standard output) is redirected to the file SommeVecVecSEQ.o335982
  • The error output (standard error) is redirected to the file SommeVecVecSEQ.e335982
cat SommeVecVecSEQ.o335982

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
Le vecteur somme :
C =           10          10          10          10          10          10          10          10          10          10
en/documentation/tutorials/build/fortran.1542709865.txt.gz · Dernière modification : 2020/08/25 15:58 (modification externe)