Skip to content

Commit

Permalink
equivalent to ectrans in CY48T3_mrg48R1.02:contrib/
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreMary authored and samhatfield committed Jan 28, 2025
1 parent 522f530 commit 2411323
Show file tree
Hide file tree
Showing 3 changed files with 241 additions and 147 deletions.
2 changes: 1 addition & 1 deletion src/trans/common/internal/tpm_gen.F90
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ MODULE TPM_GEN
! NSTACK_MEMORY_TR : optional memory strategy in gridpoint transpositions
! = 0 : prefer heap (slower but less memory consuming)
! > 0 : prefer stack (faster but more memory consuming)
INTEGER(KIND=JPIM) :: NSTACK_MEMORY_TR
INTEGER(KIND=JPIM) :: NSTACK_MEMORY_TR = 0

LOGICAL, ALLOCATABLE :: LENABLED(:) ! true: the resolution is enabled (it has been
! initialised and has not been released afterward)
Expand Down
19 changes: 16 additions & 3 deletions src/trans/gpu/external/gath_spec.F90
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ SUBROUTINE GATH_SPEC(PSPECG,KFGATHG,KTO,KVSET,KRESOL,PSPEC,LDIM1_IS_FLD,KSMAX,LD
INTEGER(KIND=JPIM) :: IVSET(KFGATHG)
INTEGER(KIND=JPIM) :: IFRECV,IFSEND,J
INTEGER(KIND=JPIM) :: IFLD,ICOEFF
INTEGER(KIND=JPIM) :: ISMAX, ISPEC2, ISPEC2_G
INTEGER(KIND=JPIM) :: ISMAX, ISPEC2, ISPEC2_G, ISPEC2MX
INTEGER(KIND=JPIM) :: IPOSSP(NPRTRW+1)
INTEGER(KIND=JPIM) :: IUMPP(NPRTRW)
INTEGER(KIND=JPIM) :: IPTRMS(NPRTRW)
INTEGER(KIND=JPIM),ALLOCATABLE :: IDIM0G(:)
INTEGER(KIND=JPIM),ALLOCATABLE :: IALLMS(:)
INTEGER(KIND=JPIM),ALLOCATABLE :: IKN(:)
LOGICAL :: LLDIM1_IS_FLD
REAL(KIND=JPHOOK) :: ZHOOK_HANDLE

Expand All @@ -111,16 +115,26 @@ SUBROUTINE GATH_SPEC(PSPECG,KFGATHG,KTO,KVSET,KRESOL,PSPEC,LDIM1_IS_FLD,KSMAX,LD
ISMAX = R%NSMAX
IF(PRESENT(KSMAX)) ISMAX = KSMAX
ALLOCATE(IDIM0G(0:ISMAX))
ALLOCATE(IALLMS(ISMAX+1))
ALLOCATE(IKN(0:ISMAX))
IF(ISMAX /= R%NSMAX) THEN
CALL SUWAVEDI(ISMAX,ISMAX,NPRTRW,MYSETW,KPOSSP=IPOSSP,KSPEC2=ISPEC2,&
& KUMPP=IUMPP,KALLMS=IALLMS,KPTRMS=IPTRMS,KSPEC2MX=ISPEC2MX, &
& KDIM0G=IDIM0G)
ISPEC2_G = (ISMAX+1)*(ISMAX+2)
ELSE
ISPEC2 = D%NSPEC2
ISPEC2_G = R%NSPEC2_G
IPOSSP(:) = D%NPOSSP(:)
IDIM0G(:) = D%NDIM0G(:)
ISPEC2MX = D%NSPEC2MX
IUMPP(:) = D%NUMPP(:)
IALLMS(:) = D%NALLMS(:)
IPTRMS(:) = D%NPTRMS(:)
ENDIF
DO J=0,ISMAX
IKN(J)=2*(ISMAX+1-J)
ENDDO

IFSEND = 0
IFRECV = 0
Expand Down Expand Up @@ -181,7 +195,7 @@ SUBROUTINE GATH_SPEC(PSPECG,KFGATHG,KTO,KVSET,KRESOL,PSPEC,LDIM1_IS_FLD,KSMAX,LD
ENDIF

CALL GATH_SPEC_CONTROL(PSPECG,KFGATHG,KTO,IVSET,PSPEC,LLDIM1_IS_FLD,&
& ISMAX,ISPEC2,ISPEC2_G,IPOSSP,IDIM0G,LDZA0IP)
& ISMAX,ISPEC2,ISPEC2MX,ISPEC2_G,IPOSSP,IDIM0G,IUMPP,IALLMS,IPTRMS,IKN,LDZA0IP)
DEALLOCATE(IDIM0G)

IF (LHOOK) CALL DR_HOOK('GATH_SPEC',1,ZHOOK_HANDLE)
Expand All @@ -190,4 +204,3 @@ SUBROUTINE GATH_SPEC(PSPECG,KFGATHG,KTO,KVSET,KRESOL,PSPEC,LDIM1_IS_FLD,KSMAX,LD
! ------------------------------------------------------------------

END SUBROUTINE GATH_SPEC

Loading

0 comments on commit 2411323

Please sign in to comment.