! $Id: mod_synchro_omp.F90 5128 2024-07-25 15:47:25Z evignon $ MODULE mod_synchro_omp INTEGER, SAVE :: exit_omp CONTAINS SUBROUTINE Init_synchro_omp USE lmdz_phys_para IMPLICIT NONE !$OMP BARRIER !$OMP MASTER exit_omp = 0 !$OMP END MASTER !$OMP BARRIER END SUBROUTINE Init_Synchro_omp SUBROUTINE Synchro_omp USE lmdz_phys_para USE lmdz_abort_physic, ONLY: abort_physic IMPLICIT NONE LOGICAL :: out CHARACTER (LEN = 20) :: modname = 'synchro_omp' CHARACTER (LEN = 80) :: abort_message out = .FALSE. !$OMP BARRIER !$OMP ATOMIC exit_omp = exit_omp + 1 !$OMP BARRIER IF (exit_omp==omp_size) THEN out = .TRUE. ENDIF DO WHILE (.NOT. out) !$OMP BARRIER IF (exit_omp==omp_size) out = .TRUE. !$OMP BARRIER ENDDO !$OMP BARRIER !$OMP MASTER exit_omp = 0 !$OMP END MASTER !$OMP BARRIER IF (exit_omp/=0) THEN abort_message = 'synchro_omp' CALL abort_physic(modname, abort_message, 1) ENDIF END SUBROUTINE Synchro_omp END MODULE mod_synchro_omp