Ignore:
Timestamp:
Mar 17, 2022, 11:51:36 AM (3 years ago)
Author:
Laurent Fairhead
Message:

Inclusion of some corrections and optimisations for XIOS done by
Arnaud Durocher during his TGCC mission.
Included here are r3703, r3704, r3750, r3751, r3752 from his
LMDZ6/branches/Optimisation_LMDZ branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phy_common/mod_phys_lmdz_omp_transfert.F90

    r3465 r4103  
    498498    REAL,INTENT(OUT),DIMENSION(:) :: VarOut
    499499
    500     CALL Check_buffer_r(size(VarOut))   
    501     CALL gather_omp_rgen(VarIn,Varout,1,buffer_r)
     500    CALL gather_omp_rgen(VarIn,Varout,1)
    502501   
    503502  END SUBROUTINE gather_omp_r
     
    509508    REAL,INTENT(IN),DIMENSION(:,:) :: VarIn
    510509    REAL,INTENT(OUT),DIMENSION(:,:) :: VarOut
    511 
    512     CALL Check_buffer_r(size(VarOut))   
    513     CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2),buffer_r)
     510 
     511    CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2))
    514512       
    515513  END SUBROUTINE gather_omp_r1
     
    521519    REAL,INTENT(IN),DIMENSION(:,:,:) :: VarIn
    522520    REAL,INTENT(OUT),DIMENSION(:,:,:) :: VarOut
    523    
    524     CALL Check_buffer_r(size(VarOut))   
    525     CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3),buffer_r)
     521 
     522    CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3))
    526523   
    527524  END SUBROUTINE gather_omp_r2
     
    533530    REAL,INTENT(IN),DIMENSION(:,:,:,:) :: VarIn
    534531    REAL,INTENT(OUT),DIMENSION(:,:,:,:) :: VarOut
    535 
    536     CALL Check_buffer_r(size(VarOut))       
    537     CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4),buffer_r)
     532     
     533    CALL gather_omp_rgen(VarIn,Varout,Size(VarIn,2)*Size(VarIn,3)*Size(VarIn,4))
    538534   
    539535  END SUBROUTINE gather_omp_r3
     
    10711067
    10721068
    1073   SUBROUTINE gather_omp_rgen(VarIn,VarOut,dimsize,Buff)
     1069  SUBROUTINE gather_omp_rgen(VarIn,VarOut,dimsize)
    10741070  USE mod_phys_lmdz_omp_data
    10751071  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
     
    10781074    INTEGER,INTENT(IN) :: dimsize
    10791075    REAL,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn
    1080     REAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
    1081     REAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
     1076    REAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize),TARGET :: VarOut
     1077
     1078    REAL, POINTER, SAVE :: Varout_ptr(:,:) ! Shared between threads NOT THREADPRIVATE
     1079
     1080    INTEGER :: i,ij
     1081   
     1082    !$omp master
     1083    Varout_ptr => VarOut
     1084    !$omp end master
     1085    !$omp barrier
     1086
     1087    DO i=1,dimsize
     1088      DO ij=1,klon_omp
     1089        Varout_ptr(klon_omp_begin-1+ij,i)=VarIn(ij,i)
     1090      ENDDO
     1091    ENDDO
     1092    !$omp barrier
     1093  END SUBROUTINE gather_omp_rgen
     1094
     1095
     1096  SUBROUTINE gather_omp_lgen(VarIn,VarOut,dimsize,Buff)
     1097  USE mod_phys_lmdz_omp_data
     1098  USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
     1099  IMPLICIT NONE
     1100
     1101    INTEGER,INTENT(IN) :: dimsize
     1102    LOGICAL,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn
     1103    LOGICAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
     1104    LOGICAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
    10821105
    10831106    INTEGER :: i,ij
     
    11001123  !$OMP BARRIER
    11011124
    1102   END SUBROUTINE gather_omp_rgen
    1103 
    1104 
    1105   SUBROUTINE gather_omp_lgen(VarIn,VarOut,dimsize,Buff)
    1106   USE mod_phys_lmdz_omp_data
    1107   USE mod_phys_lmdz_mpi_data, ONLY : klon_mpi
    1108   IMPLICIT NONE
    1109 
    1110     INTEGER,INTENT(IN) :: dimsize
    1111     LOGICAL,INTENT(IN),DIMENSION(klon_omp,dimsize) :: VarIn
    1112     LOGICAL,INTENT(OUT),DIMENSION(klon_mpi,dimsize) :: VarOut
    1113     LOGICAL,INTENT(INOUT),DIMENSION(klon_mpi,dimsize) :: Buff
    1114 
    1115     INTEGER :: i,ij
    1116    
    1117     DO i=1,dimsize
    1118       DO ij=1,klon_omp
    1119         Buff(klon_omp_begin-1+ij,i)=VarIn(ij,i)
    1120       ENDDO
    1121     ENDDO
    1122   !$OMP BARRIER 
    1123 
    1124 
    1125   !$OMP MASTER
    1126     DO i=1,dimsize
    1127       DO ij=1,klon_mpi
    1128         VarOut(ij,i)=Buff(ij,i)
    1129       ENDDO
    1130     ENDDO 
    1131   !$OMP END MASTER
    1132   !$OMP BARRIER
    1133 
    11341125  END SUBROUTINE gather_omp_lgen
    11351126
Note: See TracChangeset for help on using the changeset viewer.