-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to disable wrapper field synchronization on object destruction #21
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cb8366f
Add an option to disable wrapper field synchronization on object dest…
pmarguinaud 5fd74eb
More tests
pmarguinaud 670f3f1
Merge remote-tracking branch 'origin/main' into wrapper-nosync-onfinal
pmarguinaud c2da9dd
Use default value INIT_MAP_DEVPTR in OWNER constructor
pmarguinaud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
! (C) Copyright 2022- ECMWF. | ||
! (C) Copyright 2022- Meteo-France. | ||
! | ||
! This software is licensed under the terms of the Apache Licence Version 2.0 | ||
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
! In applying this licence, ECMWF does not waive the privileges and immunities | ||
! granted to it by virtue of its status as an intergovernmental organisation | ||
! nor does it submit to any jurisdiction. | ||
|
||
PROGRAM TEST_WRAPPERNOSYNCONFINAL | ||
|
||
USE FIELD_MODULE | ||
USE FIELD_FACTORY_MODULE | ||
USE FIELD_ACCESS_MODULE | ||
USE PARKIND1 | ||
USE FIELD_ABORT_MODULE | ||
IMPLICIT NONE | ||
|
||
|
||
CALL TEST_FIELD | ||
CALL TEST_GANG | ||
|
||
CONTAINS | ||
|
||
SUBROUTINE TEST_FIELD | ||
|
||
CLASS(FIELD_2RB), POINTER :: W => NULL() | ||
REAL(KIND=JPRB), ALLOCATABLE :: D(:,:) | ||
REAL(KIND=JPRB), POINTER :: DD(:,:) | ||
|
||
ALLOCATE(D(10,4)) | ||
|
||
D=7 | ||
|
||
CALL FIELD_NEW (W, DATA=D, SYNC_ON_FINAL=.FALSE.) | ||
|
||
DD => GET_DEVICE_DATA_RDWR (W) | ||
|
||
!$acc serial present (DD) | ||
DD = 22 | ||
!$acc end serial | ||
|
||
CALL FIELD_DELETE (W) | ||
|
||
IF (ANY (D /= 7)) THEN | ||
CALL FIELD_ABORT ('UNEXPECTED VALUES') | ||
WRITE (*, *) D | ||
ENDIF | ||
|
||
DEALLOCATE (D) | ||
|
||
ALLOCATE(D(10,4)) | ||
|
||
D=7 | ||
|
||
CALL FIELD_NEW (W, DATA=D, SYNC_ON_FINAL=.TRUE.) | ||
|
||
DD => GET_DEVICE_DATA_RDWR (W) | ||
|
||
!$acc serial present (DD) | ||
DD = 22 | ||
!$acc end serial | ||
|
||
CALL FIELD_DELETE (W) | ||
|
||
IF (ANY (D /= 22)) THEN | ||
CALL FIELD_ABORT ('UNEXPECTED VALUES') | ||
WRITE (*, *) D | ||
ENDIF | ||
|
||
END SUBROUTINE | ||
|
||
SUBROUTINE TEST_GANG | ||
|
||
CLASS(FIELD_4RD), POINTER :: YLF4 | ||
TYPE(FIELD_3RD_PTR), ALLOCATABLE :: YLF3L (:) | ||
|
||
REAL (KIND=JPRD), ALLOCATABLE :: ZDATA4 (:,:,:,:) | ||
REAL (KIND=JPRD), POINTER :: ZD4 (:,:,:,:), ZD3 (:,:,:), ZH4 (:,:,:,:), ZH3 (:,:,:) | ||
|
||
ALLOCATE (ZDATA4 (8,2,3,4)) | ||
|
||
ZDATA4 = 123._JPRD | ||
|
||
CALL FIELD_NEW (YLF4, CHILDREN=YLF3L, PERSISTENT=.TRUE., DATA=ZDATA4, SYNC_ON_FINAL=.FALSE.) | ||
|
||
ZD4 => GET_DEVICE_DATA_RDWR (YLF4) | ||
|
||
!$acc serial present (ZD4) | ||
ZD4 = 456._JPRD | ||
!$acc end serial | ||
|
||
ZD3 => GET_DEVICE_DATA_RDWR (YLF3L (1)%PTR) | ||
|
||
!$acc serial present (ZD3) | ||
ZD3 = 789._JPRD | ||
!$acc end serial | ||
|
||
DEALLOCATE (YLF3L) | ||
CALL FIELD_DELETE (YLF4) | ||
|
||
IF (ANY (ZDATA4 /= 123._JPRD)) THEN | ||
CALL FIELD_ABORT ('UNEXPECTED VALUES') | ||
WRITE (*, *) ZDATA4 | ||
ENDIF | ||
|
||
DEALLOCATE (ZDATA4) | ||
|
||
|
||
ALLOCATE (ZDATA4 (8,2,3,4)) | ||
|
||
ZDATA4 = 123._JPRD | ||
|
||
CALL FIELD_NEW (YLF4, CHILDREN=YLF3L, PERSISTENT=.TRUE., DATA=ZDATA4, SYNC_ON_FINAL=.TRUE.) | ||
|
||
ZD4 => GET_DEVICE_DATA_RDWR (YLF4) | ||
|
||
!$acc serial present (ZD4) | ||
ZD4 = 456._JPRD | ||
!$acc end serial | ||
|
||
DEALLOCATE (YLF3L) | ||
CALL FIELD_DELETE (YLF4) | ||
|
||
IF (ANY (ZDATA4 /= 456._JPRD)) THEN | ||
CALL FIELD_ABORT ('UNEXPECTED VALUES') | ||
WRITE (*, *) ZDATA4 | ||
ENDIF | ||
|
||
DEALLOCATE (ZDATA4) | ||
|
||
|
||
END SUBROUTINE | ||
|
||
END PROGRAM |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This overrides the default (.FALSE.) value we set in field_basic_module.F90. I think we should only have one mechanism to set the default value of
SELF%MAP_DEVPTR
. I like the configurableINIT_MAP_DEVPTR
, so this should also be applied to OWNER_INIT, and we should remove the default value in field_basic_module.F90.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pointing this out. I have made the change requested.