Changeset 6122 for LMDZ6/trunk/libf


Ignore:
Timestamp:
Mar 23, 2026, 11:30:30 PM (9 days ago)
Author:
lguez
Message:

Set variables to OpenMP threadprivate

Set press_cen_climoz, press_edg_climoz and time_climoz in
procedure physiq to OpenMP threadprivate. We then have to call
open_climoz for each thread.

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

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phylmd/open_climoz_m.f90

    r6121 r6122  
    1414    USE netcdf95, ONLY: nf95_open, nf95_close, nf95_gw_var, nf95_inq_varid
    1515    USE netcdf,   ONLY: nf90_nowrite
     16    use mod_phys_lmdz_omp_data, only: is_omp_root
    1617    USE mod_phys_lmdz_mpi_data,      ONLY: is_mpi_root
    17     USE mod_phys_lmdz_mpi_transfert, ONLY: bcast_mpi
     18    USE mod_phys_lmdz_transfert_para, ONLY: bcast
    1819    USE phys_cal_mod,                ONLY: calend, year_len, year_cur
    1920    !-------------------------------------------------------------------------------
     
    2627    !-------------------------------------------------------------------------------
    2728    INTEGER, INTENT(OUT):: ncid      !--- "climoz_LMDZ.nc" identifier
    28     ! Following arguments are OpenMP shared:
    2929    REAL, allocatable, intent(out):: press_in_cen(:) !--- at cells centers
    3030    REAL, allocatable, INTENT(OUT):: press_in_edg(:) !--- at the interfaces (pressure intervals)
     
    4444    WRITE(lunout,*)"Entering routine "//TRIM(sub)
    4545
    46     IF(is_mpi_root) THEN
     46    IF (is_mpi_root .and. is_omp_root) THEN
    4747
    4848       !--- OPEN FILE, READ PRESSURE LEVELS AND TIME VECTOR
     
    8787          WRITE(lunout,*)TRIM(sub)//': Interpolating O3 field directly on gcm levels.'
    8888       END IF
     89    END IF
    8990
    90     END IF
    91     CALL bcast_mpi(nlev)
    92     IF(.NOT.is_mpi_root) ALLOCATE(press_in_cen(nlev  )); CALL bcast_mpi(press_in_cen)
    93     IF(.NOT.is_mpi_root) ALLOCATE(press_in_edg(nlev+1)); CALL bcast_mpi(press_in_edg)
    94     CALL bcast_mpi(ntim)
    95     IF(.NOT.is_mpi_root) ALLOCATE(time_in(ntim));        CALL bcast_mpi(time_in)
     91    CALL bcast(nlev)
     92    CALL bcast(ntim)
     93
     94    IF (.NOT. is_mpi_root .or. .not. is_omp_root) then
     95       ALLOCATE(press_in_cen(nlev  ))
     96       ALLOCATE(press_in_edg(nlev+1))
     97       ALLOCATE(time_in(ntim))
     98    end IF
     99
     100    CALL bcast(press_in_cen)
     101    CALL bcast(press_in_edg)
     102    CALL bcast(time_in)
    96103
    97104  END SUBROUTINE open_climoz
  • LMDZ6/trunk/libf/phylmd/physiq_mod.F90

    r6120 r6122  
    10701070    !     climatology and the daylight climatology
    10711071    INTEGER,SAVE :: ncid_climoz                ! NetCDF file identifier
    1072     !$OMP THREADPRIVATE(read_climoz, ncid_climoz)
    1073 
    1074     !  Following variables are OpenMP shared
    10751072    REAL, ALLOCATABLE, SAVE :: press_cen_climoz(:) ! Pressure levels
    10761073    REAL, ALLOCATABLE, SAVE :: press_edg_climoz(:) ! Edges of pressure intervals
    10771074    REAL, ALLOCATABLE, SAVE :: time_climoz(:)      ! Time vector
     1075    !$OMP THREADPRIVATE(read_climoz, ncid_climoz, press_cen_climoz)
     1076    !$OMP THREADPRIVATE(press_edg_climoz, time_climoz)
    10781077
    10791078    CHARACTER(LEN=13), PARAMETER :: vars_climoz(2) &
     
    21242123       ENDIF
    21252124
    2126        !$omp master
    21272125       IF (read_climoz >= 1) CALL open_climoz(ncid_climoz, press_cen_climoz,   &
    21282126            press_edg_climoz, time_climoz, ok_daily_climoz, adjust_tropopause)
    2129        !$omp end master
    21302127       !
    21312128       !IM betaCRF
Note: See TracChangeset for help on using the changeset viewer.