-
Notifications
You must be signed in to change notification settings - Fork 14
Add 3D gather/scatter capability #154
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
Draft
pmarguinaud
wants to merge
9
commits into
ecmwf-ifs:main
Choose a base branch
from
pmarguinaud:collapse
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e37907d
Add gather/scatter with collapse
pmarguinaud fbb59c2
Cleaning
pmarguinaud 469798c
Cleaning
pmarguinaud 21f1f4e
Add collapse1 + more tests
pmarguinaud 2ddb91f
Generate field_gathscat_collapse1 (identical to field_gathscat) from …
pmarguinaud 75e5d90
Shared libs with NVHPC
pmarguinaud 06956ec
Merge branch 'main' of https://github.com/ecmwf-ifs/field_api into co…
pmarguinaud 6a50bfe
Test gather/scatter collapse2 feature with arrays whose second dimens…
pmarguinaud 352daac
Return dummy pointer when optional field argument is not present (GET…
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 hidden or 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
105 changes: 105 additions & 0 deletions
105
src/shuffle/field_RANKSUFF_gather_collapseCOLLAPSE_module.fypp
This file contains hidden or 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,105 @@ | ||
| #! (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. | ||
|
|
||
| MODULE FIELD_${RANK}$${SUFF}$_GATHER_COLLAPSE${COLLAPSE}$_MODULE | ||
|
|
||
| #:set fieldTypeList = fieldType.getFieldTypeList (ranks=[RANK], kinds=['JP' + str (SUFF)], hasView=True) | ||
|
|
||
| USE FIELD_${RANK}$${SUFF}$_MODULE | ||
| USE FIELD_${RANK}$${SUFF}$_ACCESS_MODULE | ||
| USE FIELD_${RANK}$${SUFF}$_FACTORY_MODULE | ||
| USE FIELD_GATHSCAT_COLLAPSE${COLLAPSE}$_TYPE_MODULE | ||
| USE FIELD_${RANK}$${SUFF}$_SHUFFLE_COLLAPSE${COLLAPSE}$_MODULE | ||
| ${fieldType.useParkind1 ()}$ | ||
|
|
||
| IMPLICIT NONE | ||
|
|
||
| PRIVATE | ||
|
|
||
| PUBLIC :: FIELD_GATHSCAT_COLLAPSE${COLLAPSE}$ | ||
|
|
||
| #:for what in ['DEVICE', 'HOST'] | ||
| #:for mode in ['RDONLY', 'RDWR'] | ||
|
|
||
| #:for ft in fieldTypeList | ||
| #:if ft.rank >= COLLAPSE + 1 | ||
|
|
||
| PUBLIC :: ${ft.name}$_GATHER_COLLAPSE${COLLAPSE}$_${what}$_DATA_${mode}$ | ||
| PUBLIC :: S${ft.name}$_GATHER_COLLAPSE${COLLAPSE}$_${what}$_DATA_${mode}$ | ||
|
|
||
| #:endif | ||
| #:endfor | ||
|
|
||
| #:endfor | ||
| #:endfor | ||
|
|
||
| CONTAINS | ||
|
|
||
| #:for ft in fieldTypeList | ||
| #:if ft.rank >= COLLAPSE + 1 | ||
|
|
||
| #:if COLLAPSE == 1 | ||
| #:set gathered_shape = ft.shape | ||
| #:elif COLLAPSE == 2 | ||
| #:set gathered_rank = ft.rank - 1 | ||
| #:set gathered_shape = ','.join([':'] * gathered_rank) | ||
| #:endif | ||
|
|
||
| #:for what in ['DEVICE', 'HOST'] | ||
| #:for mode in ['RDONLY', 'RDWR'] | ||
|
|
||
| FUNCTION ${ft.name}$_GATHER_COLLAPSE${COLLAPSE}$_${what}$_DATA_${mode}$ (SELF, YLF) RESULT (PTR) | ||
|
|
||
| CLASS (FIELD_GATHSCAT_COLLAPSE${COLLAPSE}$) :: SELF | ||
| CLASS (${ft.name}$), POINTER, INTENT (IN) :: YLF | ||
|
|
||
| ${ft.type}$, POINTER :: PTR(${gathered_shape}$) | ||
|
|
||
| CALL S${ft.name}$_GATHER_COLLAPSE${COLLAPSE}$_${what}$_DATA_${mode}$ (SELF, PTR, YLF) | ||
|
|
||
| END FUNCTION ${ft.name}$_GATHER_COLLAPSE${COLLAPSE}$_${what}$_DATA_${mode}$ | ||
|
|
||
| SUBROUTINE S${ft.name}$_GATHER_COLLAPSE${COLLAPSE}$_${what}$_DATA_${mode}$ (SELF, PTR, YLF) | ||
|
|
||
| USE FIELD_${RANK}$${SUFF}$_ACCESS_MODULE | ||
|
|
||
| CLASS (FIELD_GATHSCAT_COLLAPSE${COLLAPSE}$) :: SELF | ||
| ${ft.type}$, POINTER :: PTR(${gathered_shape}$) | ||
| CLASS (${ft.name}$), POINTER, OPTIONAL :: YLF | ||
|
|
||
| #:if COLLAPSE == 2 | ||
| ${ft.type}$, POINTER :: PTR1(${ft.shape}$) | ||
| #:endif | ||
|
|
||
| IF (PRESENT (YLF)) THEN | ||
|
|
||
| CALL PAIR_GATHER_COLLAPSE${COLLAPSE}$_${what}$_DATA_${mode}$ (SELF%${ft.name}$_C${COLLAPSE}$LIST, SELF%LNULL, SELF%LFULL, & | ||
| & SELF%KLON_G, SELF%KGPBLKS_G, SELF%YLFINDS, PTR, YLF, SELF%KBLKMIN, SELF%KBLKMAX) | ||
|
|
||
| ELSE | ||
|
|
||
|
|
||
| #:if COLLAPSE == 2 | ||
| CALL SGET_${what}$_DATA_${mode}$ (PTR1, YLF) | ||
| PTR => PTR1 (${gathered_shape}$, 1) | ||
| #:elif COLLAPSE == 1 | ||
| CALL SGET_${what}$_DATA_${mode}$ (PTR, YLF) | ||
| #:endif | ||
|
|
||
| ENDIF | ||
|
|
||
| END SUBROUTINE S${ft.name}$_GATHER_COLLAPSE${COLLAPSE}$_${what}$_DATA_${mode}$ | ||
|
|
||
| #:endfor | ||
| #:endfor | ||
|
|
||
| #:endif | ||
| #:endfor | ||
|
|
||
| END MODULE FIELD_${RANK}$${SUFF}$_GATHER_COLLAPSE${COLLAPSE}$_MODULE | ||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
Do we really need a separate module per derived type here? If possible, I would prefer to keep the fypp expansion to the rank-suff matrix, and a loop in here for the different values of
COLLAPSE. This is effectively what we are already doing in many places forWRAPPER, OWNERtypes in the same module. You could then simply add the relevant files to theranksuff_srcsandnon_ranksuff_srcslists.