Skip to content
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

Field resize #6

Merged
merged 7 commits into from
Nov 13, 2023
Merged

Field resize #6

merged 7 commits into from
Nov 13, 2023

Conversation

dareg
Copy link
Collaborator

@dareg dareg commented Nov 8, 2023

Add the ability to resize an existing field owner variable.

Copy link
Collaborator

@mlange05 mlange05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I'd be curious if the advanced OO pattern (abstract deferred procedures) are supported on device with NVHPC? We don't depend on device-safety though, so not a showstopper.

The rest are minor nitpicks, so otherwise GTG from me.

@@ -52,6 +52,8 @@ CONTAINS
PROCEDURE :: SYNC_DEVICE_RDONLY => ${ftn}$_SYNC_DEVICE_RDONLY
PROCEDURE :: COPY_OBJECT => ${ftn}$_COPY_OBJECT
PROCEDURE :: WIPE_OBJECT => ${ftn}$_WIPE_OBJECT
PROCEDURE(GET_DIMS), DEFERRED :: GET_DIMS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks cool, but pretty advanced OO usage. Is this device-safe? Has this been checked? Not a showstopper for me, as we don't use FIELD objects on device yet; I was just curious how far NVHPC supports this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not possible to use the deferred method on the device, but I think it's not possible to use any type-bound method on the device anyway. Those methods are meant to be used on the host, in preparation of the compute kernels executing on the device. That being said, it is just a limitation of the openacc implementation, it would make sense to be able to call some methods on the device, like get_dims for instance.

REAL(KIND=JPRB) :: D(5,5)

CALL FIELD_NEW(W, DATA=D)
CALL FIELD_RESIZE(W, UBOUNDS=[100,100])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[just nitpicking] I take it the by marking this in the ABOR1_TEST_FILES failure gets checked? It could be helpful to make the exact place in code where that's supposed to happen.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment to show the line calling abor1

Copy link
Collaborator

@awnawab awnawab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this very useful feature @dareg! Could you please update the copyright headers for the new files? Other than that, looks good from my side 👍

! distributed under the License is distributed on an "AS IS" BASIS,
! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! See the License for the specific language governing permissions and
! limitations under the License.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The license header here is missing that one extra sentence we need for ECMWF. @dareg could you please add that in? Same for the other two new files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the headers to match the other headers.

@dareg
Copy link
Collaborator Author

dareg commented Nov 9, 2023

Please wait before merging, I need to add a test for get_dims.

Copy link
Collaborator

@awnawab awnawab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the comments @dareg! G2G from my side.

@awnawab awnawab merged commit f4a78e2 into ecmwf-ifs:main Nov 13, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants