1 |
|
|
! |
2 |
|
|
! $Id: mod_synchro_omp.F90 3531 2019-06-06 15:08:45Z fairhead $ |
3 |
|
|
! |
4 |
|
|
MODULE mod_synchro_omp |
5 |
|
|
|
6 |
|
|
INTEGER,SAVE :: exit_omp |
7 |
|
|
|
8 |
|
|
CONTAINS |
9 |
|
|
|
10 |
|
|
SUBROUTINE Init_synchro_omp |
11 |
|
|
USE mod_phys_lmdz_para |
12 |
|
|
IMPLICIT NONE |
13 |
|
|
|
14 |
|
|
CALL omp_barrier |
15 |
|
|
!$OMP MASTER |
16 |
|
|
exit_omp=0 |
17 |
|
|
!$OMP END MASTER |
18 |
|
|
CALL omp_barrier |
19 |
|
|
|
20 |
|
|
END SUBROUTINE Init_Synchro_omp |
21 |
|
|
|
22 |
|
|
SUBROUTINE Synchro_omp |
23 |
|
|
USE mod_phys_lmdz_para |
24 |
|
|
IMPLICIT NONE |
25 |
|
|
LOGICAL :: out |
26 |
|
|
CHARACTER (LEN=20) :: modname='synchro_omp' |
27 |
|
|
CHARACTER (LEN=80) :: abort_message |
28 |
|
|
|
29 |
|
|
out=.FALSE. |
30 |
|
|
!$OMP BARRIER |
31 |
|
|
!$OMP BARRIER |
32 |
|
|
!$OMP ATOMIC |
33 |
|
|
exit_omp=exit_omp+1 |
34 |
|
|
!$OMP BARRIER |
35 |
|
|
!$OMP BARRIER |
36 |
|
|
IF (exit_omp==omp_size) THEN |
37 |
|
|
out=.TRUE. |
38 |
|
|
ENDIF |
39 |
|
|
|
40 |
|
|
DO WHILE (.NOT. out) |
41 |
|
|
!$OMP BARRIER |
42 |
|
|
IF (exit_omp==omp_size) out=.TRUE. |
43 |
|
|
!$OMP BARRIER |
44 |
|
|
ENDDO |
45 |
|
|
|
46 |
|
|
!$OMP BARRIER |
47 |
|
|
!$OMP MASTER |
48 |
|
|
exit_omp=0 |
49 |
|
|
!$OMP END MASTER |
50 |
|
|
!$OMP BARRIER |
51 |
|
|
|
52 |
|
|
IF (exit_omp/=0) THEN |
53 |
|
|
abort_message='synchro_omp' |
54 |
|
|
CALL abort_physic(modname,abort_message,1) |
55 |
|
|
ENDIF |
56 |
|
|
|
57 |
|
|
END SUBROUTINE Synchro_omp |
58 |
|
|
|
59 |
|
|
|
60 |
|
|
END MODULE mod_synchro_omp |