Skip to content

Commit

Permalink
set lower bound of devptr to be the same as for hst
Browse files Browse the repository at this point in the history
  • Loading branch information
wertysas committed Dec 11, 2024
1 parent b5a9278 commit 5ddc7a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions dev_alloc_module.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ ELSE
ENDIF

CALL C_F_POINTER (PTR, TMP, DIMSIZES)
DEV => TMP
DEV (${ ', '.join (map (lambda i: 'ILBOUNDS (' + str (i) + '):', range (1, ft.rank+1))) }$) => TMP

IF(MAP_DEVPTR)THEN
!$acc enter data create (DEV)
Expand Down Expand Up @@ -181,10 +181,13 @@ SUBROUTINE ${ft.name}$_DEV_ALLOCATE_HST (DEV, HST, MAP_DEVPTR)
${ft.type}$, POINTER :: DEV(${ft.shape}$)
${ft.type}$, POINTER :: HST(${ft.shape}$)
LOGICAL, INTENT(IN) :: MAP_DEVPTR
INTEGER (KIND=JPIM) :: DIMSIZES (${ft.rank}$)

DIMSIZES = UBOUND(HST) - LBOUND(HST)
ALLOCATE (DEV(${ ', '.join (['1:DIMSIZES(i)' for i in range (1, ft.rank+1)])}$))
#if __INTEL_COMPILER == 1800 && __INTEL_COMPILER_UPDATE == 5
! Bug with Intel 18.0.5.274
ALLOCATE (DEV (${ ', '.join (map (lambda i: 'LBOUND (HST, ' + str (i) + '):UBOUND (HST,' + str (i) + ')', range (1, ft.rank+1))) }$))
#else
ALLOCATE (DEV, MOLD=HST)
#endif

!$acc enter data create (DEV)

Expand Down
2 changes: 1 addition & 1 deletion field_RANKSUFF_data_module.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ CONTAINS
#endif

#:for e in range (ft.rank, d, -1)
${' ' * (ft.rank - e)}$D${e}$ = 1 - LBOUND (HST, ${e}$)
${' ' * (ft.rank - e)}$D${e}$ = LBOUND(DEV, ${e}$) - LBOUND (HST, ${e}$)
${' ' * (ft.rank - e)}$DO J${e}$ = LBOUND (HST, ${e}$), UBOUND (HST, ${e}$)
${' ' * (ft.rank - e + 1)}$JD${e}$ = J${e}$ + D${e}$
#:endfor
Expand Down

0 comments on commit 5ddc7a6

Please sign in to comment.