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:exemples:sommevecvecparopenmp.f90 [2017/01/22 18:22] – cicaluga | documentation:exemples:sommevecvecparopenmp.f90 [2017/01/23 10:24] (Version actuelle) – supprimée ltaulell | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | <code fortran ProgPAROpenMP.f90> | ||
- | PROGRAM HELLO | ||
- | |||
- | | ||
- | + OMP_GET_THREAD_NUM | ||
- | |||
- | C Fork a team of threads giving them their own copies of variables | ||
- | !$OMP PARALLEL PRIVATE(NTHREADS, | ||
- | |||
- | |||
- | C Obtain thread number | ||
- | TID = OMP_GET_THREAD_NUM() | ||
- | PRINT *, 'Hello World from thread = ', TID | ||
- | |||
- | C Only master thread does this | ||
- | IF (TID .EQ. 0) THEN | ||
- | NTHREADS = OMP_GET_NUM_THREADS() | ||
- | PRINT *, ' | ||
- | END IF | ||
- | |||
- | C All threads join master thread and disband | ||
- | !$OMP END PARALLEL | ||
- | |||
- | END | ||
- | </ |