Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| documentation:examples:sommevecvecparopenmp.f90 [2017/01/23 10:32] – cicaluga | documentation:examples:sommevecvecparopenmp.f90 [2023/01/13 09:38] (Version actuelle) – supprimée ccalugar | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | ===== Langage Fortran 90, code parallèle (avec OpenMP) ===== | ||
| - | Le programme [[documentation: | ||
| - | |||
| - | <code fortran ProgPAR_OpenMP.f90> | ||
| - | |||
| - | program HELLO | ||
| - | |||
| - | INTEGER NTHREADS, TID, OMP_GET_NUM_THREADS, | ||
| - | |||
| - | ! Fork a team of threads giving them their own copies of variables | ||
| - | !$OMP PARALLEL PRIVATE(NTHREADS, | ||
| - | |||
| - | |||
| - | ! Obtain thread number | ||
| - | TID = OMP_GET_THREAD_NUM() | ||
| - | PRINT *, 'Hello World from thread = ', TID | ||
| - | |||
| - | ! Only master thread does this | ||
| - | IF (TID .EQ. 0) THEN | ||
| - | NTHREADS = OMP_GET_NUM_THREADS() | ||
| - | PRINT *, ' | ||
| - | END IF | ||
| - | |||
| - | ! All threads join master thread and disband | ||
| - | !$OMP END PARALLEL | ||
| - | |||
| - | end program | ||
| - | </ | ||