Changeset 1725 for trunk/LMDZ.TITAN/libf


Ignore:
Timestamp:
Jul 21, 2017, 5:30:44 PM (7 years ago)
Author:
jvatant
Message:

Optimization of the optci/cv routines

  • The repeated calls to huge matrices gasi/v increased dramatically the execution time because of memory access
  • Added a tmpk variable
  • Save ~ 50% time on the RT, ~30% on the whole code on the tested simulations

JVO

Location:
trunk/LMDZ.TITAN/libf/phytitan
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.TITAN/libf/phytitan/optci.F90

    r1722 r1725  
    7474
    7575  real*8  KCOEF(4)
     76   
     77  ! temporary variable to reduce memory access time to gasi
     78  real*8 tmpk(2,2)
    7679 
    7780  ! temporary variables for multiple aerosol calculation
     
    216219           ! Now compute TAUGAS
    217220
    218            KCOEF(1) = GASI(MT(K),MP(K),1,NW,NG)
    219            KCOEF(2) = GASI(MT(K),MP(K)+1,1,NW,NG)
    220            KCOEF(3) = GASI(MT(K)+1,MP(K)+1,1,NW,NG)
    221            KCOEF(4) = GASI(MT(K)+1,MP(K),1,NW,NG)
     221           ! JVO 2017 : added tmpk because the repeated calls to gasi/v increased dramatically
     222           ! the execution time of optci/v -> ~ factor 2 on the whole radiative
     223           ! transfer on the tested simulations !
     224
     225           tmpk = GASI(MT(K):MT(K)+1,MP(K):MP(K)+1,1,NW,NG)
     226
     227           KCOEF(1) = tmpk(1,1) ! KCOEF(1) = GASI(MT(K),MP(K),1,NW,NG)
     228           KCOEF(2) = tmpk(1,2) ! KCOEF(2) = GASI(MT(K),MP(K)+1,1,NW,NG)
     229           KCOEF(3) = tmpk(2,2) ! KCOEF(3) = GASI(MT(K)+1,MP(K)+1,1,NW,NG)
     230           KCOEF(4) = tmpk(2,1) ! KCOEF(4) = GASI(MT(K)+1,MP(K),1,NW,NG)
     231
    222232
    223233           ! Interpolate the gaseous k-coefficients to the requested T,P values
  • trunk/LMDZ.TITAN/libf/phytitan/optcv.F90

    r1722 r1725  
    8383
    8484  real*8  KCOEF(4)
     85 
     86  ! temporary variable to reduce memory access time to gasv
     87  real*8 tmpk(2,2)
    8588
    8689  ! temporary variables for multiple aerosol calculation
     
    233236           ! Now compute TAUGAS
    234237
    235            KCOEF(1) = GASV(MT(K),MP(K),1,NW,NG)
    236            KCOEF(2) = GASV(MT(K),MP(K)+1,1,NW,NG)
    237            KCOEF(3) = GASV(MT(K)+1,MP(K)+1,1,NW,NG)
    238            KCOEF(4) = GASV(MT(K)+1,MP(K),1,NW,NG)
     238           ! JVO 2017 : added tmpk because the repeated calls to gasi/v increased dramatically
     239           ! the execution time of optci/v -> ~ factor 2 on the whole radiative
     240           ! transfer on the tested simulations !
     241
     242           tmpk = GASV(MT(K):MT(K)+1,MP(K):MP(K)+1,1,NW,NG)
     243             
     244           KCOEF(1) = tmpk(1,1) ! KCOEF(1) = GASV(MT(K),MP(K),1,NW,NG)
     245           KCOEF(2) = tmpk(1,2) ! KCOEF(2) = GASV(MT(K),MP(K)+1,1,NW,NG)
     246           KCOEF(3) = tmpk(2,2) ! KCOEF(3) = GASV(MT(K)+1,MP(K)+1,1,NW,NG)
     247           KCOEF(4) = tmpk(2,1) ! KCOEF(4) = GASV(MT(K)+1,MP(K),1,NW,NG)
    239248
    240249           ! Interpolate the gaseous k-coefficients to the requested T,P values
Note: See TracChangeset for help on using the changeset viewer.