Skip to content

Commit

Permalink
bugfix in index in COPY mehtods to be fixupped
Browse files Browse the repository at this point in the history
  • Loading branch information
wertysas committed Dec 16, 2024
1 parent db13728 commit a858bef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
3 changes: 2 additions & 1 deletion fieldType.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def __init__ (self, **kwargs):
self.viewShape = ','.join ([':'] * (self.rank-1))
self.lbptr = ', '.join (list (map (lambda i: "LBOUNDS(" + str (i+1) + "):", range (0, self.rank))))
self.lbptr_blk = ', '.join([ f"LBOUNDS({i}):" for i in range(1, self.rank)] + ["BLK_BOUNDS(1):"])
self.devptr_blk = ':, ' * (self.rank-1) + 'BLK_BOUNDS(1):BLK_BOUNDS(2)'
self.hst_blk = ':, ' * (self.rank-1) + 'BLK_BOUNDS(1):BLK_BOUNDS(2)'
self.devptr_blk = ':, ' * (self.rank-1) + f'LBOUNDS({self.rank}):LBOUNDS({self.rank}) + BLK_BOUNDS(2)-BLK_BOUNDS(1)'
self.hasView = self.rank > 1
self.ganged = self.rank > 2

Expand Down
13 changes: 5 additions & 8 deletions field_RANKSUFF_module.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ CONTAINS
INTEGER(KIND=JPIM), OPTIONAL, INTENT(IN) :: BLK_BOUNDS(2)

INTEGER(KIND=JPIM) :: LB, UB
${ft.type}$, POINTER :: TMP_PTR(${ft.shape}$) => NULL()
${ft.type}$, POINTER :: HST_BLK(${ft.shape}$) => NULL()
REAL :: START, FINISH

IF ( .NOT. PRESENT(BLK_BOUNDS) ) THEN
Expand All @@ -451,8 +451,8 @@ CONTAINS
IF ( BLK_BOUNDS(1) < LB .OR. BLK_BOUNDS(2) > UB ) THEN
CALL FIELD_ABORT("BLOCK DIMENSIONS ARE OUT OF RANGE")
END IF
TMP_PTR => SELF%PTR(${ft.devptr_blk}$)
CALL COPY_ARRAY(TMP_PTR, SELF%DEVPTR, SELF%MAP_DEVPTR, KDIR, QUEUE)
HST_BLK => SELF%PTR(${ft.hst_blk}$)
CALL COPY_ARRAY(HST_BLK, SELF%DEVPTR, SELF%MAP_DEVPTR, KDIR, QUEUE)
END IF
IF (KDIR == NH2D) THEN
CALL SELF%STATS%INC_CPU_TO_GPU_TRANSFER(START, FINISH)
Expand All @@ -477,9 +477,9 @@ CONTAINS
CALL SELF%SET_STATUS (IOR (SELF%GET_STATUS (), NHSTFRESH))
ENDIF
IF ( PRESENT(BLK_BOUNDS) ) THEN
PTR ( ${ft.lbptr_blk}$) => SELF%DEVPTR (${ft.devptr_blk}$)
PTR ( ${ft.lbptr_blk}$) => SELF%PTR (${ft.hst_blk}$)
ELSE
PTR (${ft.lbptr}$) => SELF%DEVPTR (${','.join(':' for _ in range(ft.rank))}$)
PTR (${ft.lbptr}$) => SELF%PTR (${','.join(':' for _ in range(ft.rank))}$)
END IF
IF (IAND (MODE, NWR) /= 0) THEN
CALL SELF%SET_STATUS (IAND (SELF%GET_STATUS (), NOT (NDEVFRESH)))
Expand Down Expand Up @@ -569,9 +569,6 @@ CONTAINS
CALL SELF%SET_STATUS (IOR (SELF%GET_STATUS (), NDEVFRESH))
ENDIF
IF ( PRESENT(BLK_BOUNDS) ) THEN
PRINT *, "BLK_BOUNDS", BLK_BOUNDS
PRINT *, "lbptr_blk: ${ft.lbptr_blk}$"
PRINT *, "devtr_blk: ${ft.devptr_blk}$"
PTR ( ${ft.lbptr_blk}$) => SELF%DEVPTR (${ft.devptr_blk}$)
ELSE
PTR (${ft.lbptr}$) => SELF%DEVPTR (${','.join(':' for _ in range(ft.rank))}$)
Expand Down

0 comments on commit a858bef

Please sign in to comment.