Changeset 1905


Ignore:
Timestamp:
Nov 20, 2013, 2:08:45 PM (11 years ago)
Author:
acozic
Message:

Make some correction in omp synchro and barrier for coupled model with Orchidee
These modifications doesn't impact LMDZ without orchidee.

Location:
LMDZ5/trunk/libf/phylmd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/libf/phylmd/mod_phys_lmdz_omp_transfert.F90

    r1279 r1905  
    4848
    4949
    50   PUBLIC bcast_omp,scatter_omp,gather_omp,reduce_sum_omp
     50  PUBLIC bcast_omp,scatter_omp,gather_omp,reduce_sum_omp, omp_barrier
    5151
    5252CONTAINS
    5353
     54  SUBROUTINE omp_barrier
     55  IMPLICIT NONE
     56
     57!$OMP BARRIER
     58
     59  END SUBROUTINE omp_barrier
     60 
    5461  SUBROUTINE check_buffer_i(buff_size)
    5562  IMPLICIT NONE
  • LMDZ5/trunk/libf/phylmd/mod_synchro_omp.F90

    r987 r1905  
    11MODULE mod_synchro_omp
    22
    3   LOGICAL,SAVE,ALLOCATABLE :: flag_omp(:)
    4  
     3    INTEGER,SAVE :: exit_omp 
     4
    55CONTAINS
    66
     
    88  USE mod_phys_lmdz_para
    99  IMPLICIT NONE
    10    
    11     IF (is_omp_root) THEN
    12       ALLOCATE(flag_omp(0:omp_size-1))
    13       flag_omp(:)=.FALSE.
    14     ENDIF
    15 !$OMP BARRIER
     10
     11  CALL omp_barrier
     12!$OMP MASTER
     13  exit_omp=0
     14!$OMP END MASTER   
     15  CALL omp_barrier
    1616
    1717  END SUBROUTINE Init_Synchro_omp
    1818 
    19   SUBROUTINE Synchro_omp
     19  SUBROUTINE Synchro_omp 
    2020  USE mod_phys_lmdz_para
    2121  IMPLICIT NONE
     22  LOGICAL :: out
    2223 
    23     flag_omp(omp_rank)=.TRUE.
     24    out=.FALSE.
    2425!$OMP BARRIER
    25     DO WHILE (.NOT. ALL(flag_omp))
     26!$OMP BARRIER
     27!$OMP ATOMIC 
     28    exit_omp=exit_omp+1
     29!$OMP BARRIER
     30!$OMP BARRIER
     31    IF (exit_omp==omp_size) THEN
     32      out=.TRUE.
     33    ENDIF
     34   
     35    DO WHILE (.NOT. out)
     36!$OMP BARRIER
     37      IF (exit_omp==omp_size) out=.TRUE.
    2638!$OMP BARRIER
    2739    ENDDO
    28 !$OMP BARRIER       
    29     flag_omp(omp_rank)=.FALSE.
     40
     41!$OMP BARRIER
     42!$OMP MASTER
     43    exit_omp=0
     44!$OMP END MASTER
    3045!$OMP BARRIER
    3146
    32    END SUBROUTINE Synchro_omp
     47    IF (exit_omp/=0) THEN
     48      STOP 'synchro_omp'
     49    ENDIF
     50
     51  END SUBROUTINE Synchro_omp
     52
    3353
    3454END MODULE mod_synchro_omp
Note: See TracChangeset for help on using the changeset viewer.