Ignore:
Timestamp:
May 24, 2013, 11:52:12 AM (12 years ago)
Author:
Ehouarn Millour
Message:

IOIPSL routine getin is not threadsafe, so when running in OpenMP, it should be called by only one thread (and the result copied to other threads in the case of threadprivate variables).
EM

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

Legend:

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

    r1454 r1759  
    1919!$OMP THREADPRIVATE(carbon_cycle_cpl)
    2020
     21  LOGICAL :: carbon_cycle_emis_comp_omp=.FALSE.
    2122  LOGICAL :: carbon_cycle_emis_comp=.FALSE. ! Calculation of emission compatible
    2223!$OMP THREADPRIVATE(carbon_cycle_emis_comp)
    2324
     25  LOGICAL :: RCO2_inter_omp
    2426  LOGICAL :: RCO2_inter  ! RCO2 interactive : if true calculate new value RCO2 for the radiation scheme
    2527!$OMP THREADPRIVATE(RCO2_inter)
    2628
    2729! Scalare values when no transport, from physiq.def
     30  REAL :: fos_fuel_s_omp
    2831  REAL :: fos_fuel_s  ! carbon_cycle_fos_fuel dans physiq.def
    2932!$OMP THREADPRIVATE(fos_fuel_s)
     
    112115    ! Read fosil fuel value if no transport
    113116    IF (.NOT. carbon_cycle_tr) THEN
    114        fos_fuel_s = 0.
    115        CALL getin ('carbon_cycle_fos_fuel',fos_fuel_s)
     117!$OMP MASTER
     118       fos_fuel_s_omp = 0.
     119       CALL getin ('carbon_cycle_fos_fuel',fos_fuel_s_omp)
     120!$OMP END MASTER
     121!$OMP BARRIER
     122       fos_fuel_s=fos_fuel_s_omp
    116123       WRITE(lunout,*) 'carbon_cycle_fos_fuel = ', fos_fuel_s
    117124    END IF
     
    120127    ! Read parmeter for calculation compatible emission
    121128    IF (.NOT. carbon_cycle_tr) THEN
    122        carbon_cycle_emis_comp=.FALSE.
    123        CALL getin('carbon_cycle_emis_comp',carbon_cycle_emis_comp)
     129!$OMP MASTER
     130       carbon_cycle_emis_comp_omp=.FALSE.
     131       CALL getin('carbon_cycle_emis_comp',carbon_cycle_emis_comp_omp)
     132!$OMP END MASTER
     133!$OMP BARRIER
     134       carbon_cycle_emis_comp=carbon_cycle_emis_comp_omp
    124135       WRITE(lunout,*) 'carbon_cycle_emis_comp = ',carbon_cycle_emis_comp
    125136       IF (carbon_cycle_emis_comp) THEN
     
    129140
    130141    ! Read parameter for interactive calculation of the CO2 value for the radiation scheme
    131     RCO2_inter=.FALSE.
    132     CALL getin('RCO2_inter',RCO2_inter)
     142!$OMP MASTER
     143    RCO2_inter_omp=.FALSE.
     144    CALL getin('RCO2_inter',RCO2_inter_omp)
     145!$OMP END MASTER
     146!$OMP BARRIER
     147    RCO2_inter=RCO2_inter_omp
    133148    WRITE(lunout,*) 'RCO2_inter = ', RCO2_inter
    134149    IF (RCO2_inter) THEN
  • LMDZ5/trunk/libf/phylmd/cvltr.F90

    r1742 r1759  
    121121   coefcoli         = 0.
    122122
     123!$OMP MASTER
    123124  call getin('ccntrAA_coef',ccntrAA_coef)
    124125  call getin('ccntrENV_coef',ccntrENV_coef)
    125126  call getin('coefcoli',coefcoli)
     127!$OMP END MASTER
     128!$OMP BARRIER
    126129  print*,'cvltr coef lessivage convectif', ccntrAA_coef,ccntrENV_coef,coefcoli
    127130
  • LMDZ5/trunk/libf/phylmd/phyaqua.F

    r1671 r1759  
    8989      integer, save::  read_climoz=0 ! read ozone climatology
    9090
    91 
     91! intermediate variables to use getin
     92      integer :: nbapp_rad_omp
     93      real :: co2_ppm_omp,solaire_omp
     94      logical :: alb_ocean_omp
     95      real :: rugos_omp
    9296!-------------------------------------------------------------------------
    9397!  declaration pour l'appel a phyredem
     
    160164         zcufi=1.
    161165         zcvfi=1.
    162       nbapp_rad=24
    163       CALL getin('nbapp_rad',nbapp_rad)
     166!$OMP MASTER
     167      nbapp_rad_omp=24
     168      CALL getin('nbapp_rad',nbapp_rad_omp)
     169!$OMP END MASTER
     170!$OMP BARRIER
     171      nbapp_rad=nbapp_rad_omp
    164172
    165173!---------------------------------------------------------------------
     
    168176! Initialisations des constantes
    169177! Ajouter les manquants dans planete.def... (albedo etc)
    170       co2_ppm=348.
    171       CALL getin('co2_ppm',co2_ppm)
    172       solaire=1365.
    173       CALL getin('solaire',solaire)
     178!$OMP MASTER
     179      co2_ppm_omp=348.
     180      CALL getin('co2_ppm',co2_ppm_omp)
     181      solaire_omp=1365.
     182      CALL getin('solaire',solaire_omp)
     183!      CALL getin('albedo',albedo) ! albedo is set below, depending on type_aqua
     184      alb_ocean_omp=.true.
     185      CALL getin('alb_ocean',alb_ocean_omp)
     186!$OMP END MASTER
     187!$OMP BARRIER
     188      co2_ppm=co2_ppm_omp
     189      solaire=solaire_omp
     190      alb_ocean=alb_ocean_omp
     191
    174192      radsol=0.
    175193      qsol_f=10.
    176 !      CALL getin('albedo',albedo) ! albedo is set below, depending on type_aqua
    177       alb_ocean=.true.
    178       CALL getin('alb_ocean',alb_ocean)
    179194
    180195c  Conditions aux limites:
     
    208223      endif
    209224
    210       CALL getin('rugos',rugos)
     225!$OMP MASTER
     226      rugos_omp=rugos
     227      CALL getin('rugos',rugos_omp)
     228!$OMP END MASTER
     229!$OMP BARRIER
     230      rugos=rugos_omp
    211231      zmasq(:)=pctsrf(:,is_oce)
    212232
  • LMDZ5/trunk/libf/phylmd/phytrac.F90

    r1742 r1759  
    203203  INTEGER                   :: itau_w      ! pas de temps ecriture = nstep + itau_phy
    204204  LOGICAL,PARAMETER         :: ok_sync=.TRUE.
    205   CHARACTER(len=20)         :: chtratimestep
    206 
     205  CHARACTER(len=20),save    :: chtratimestep,chtratimestep_omp
     206!$OMP THREADPRIVATE(chtratimestep)
    207207!
    208208! Nature du traceur
     
    264264  CHARACTER(len=8),DIMENSION(nbtr) :: solsym
    265265!RomP >>>
    266   INTEGER,SAVE  :: iflag_lscav
    267   LOGICAL,SAVE  :: convscav
     266  INTEGER,SAVE  :: iflag_lscav_omp,iflag_lscav
     267  LOGICAL,SAVE  :: convscav_omp,convscav
    268268!$OMP THREADPRIVATE(iflag_lscav,convscav)
    269269!RomP <<<
     
    309309  IF (debutphy) THEN
    310310!!jyg
    311    chtratimestep='DefFreq'
    312    CALL getin('tra_time_step',chtratimestep)
     311!$OMP MASTER
     312   chtratimestep_omp='DefFreq'
     313   CALL getin('tra_time_step',chtratimestep_omp)
     314!$OMP END MASTER
     315!$OMP BARRIER
     316   chtratimestep=chtratimestep_omp
    313317   IF (chtratimestep .NE. 'DefFreq') THEN
    314318     call convers_timesteps(chtratimestep,pdtphys,ecrit_tra)
     
    321325!Config Help =
    322326!
    323   convscav=.false.
    324   call getin('convscav', convscav)
     327!$OMP MASTER
     328  convscav_omp=.false.
     329  call getin('convscav', convscav_omp)
     330!$OMP END MASTER
     331!$OMP BARRIER
     332  convscav=convscav_omp
    325333  print*,'phytrac passage dans routine conv avec lessivage', convscav
    326334!
     
    331339!Config Help =
    332340!
    333   iflag_lscav=1
    334   call getin('iflag_lscav', iflag_lscav)
     341!$OMP MASTER
     342  iflag_lscav_omp=1
     343  call getin('iflag_lscav', iflag_lscav_omp)
     344!$OMP END MASTER
     345!$OMP BARRIER
     346  iflag_lscav=iflag_lscav_omp
    335347!
    336348  SELECT CASE(iflag_lscav)
     
    371383     INCLUDE "ini_histrac.h"
    372384#endif
    373   END IF
     385  END IF ! of IF (debutphy)
    374386!############################################ END INITIALIZATION #######
    375387
Note: See TracChangeset for help on using the changeset viewer.