Skip to content

add deferred-rank-less versions of mpp_pack and mpp_global_field#1873

Open
rem1776 wants to merge 5 commits into
NOAA-GFDL:mainfrom
rem1776:nvhpc-select-rank-workaround
Open

add deferred-rank-less versions of mpp_pack and mpp_global_field#1873
rem1776 wants to merge 5 commits into
NOAA-GFDL:mainfrom
rem1776:nvhpc-select-rank-workaround

Conversation

@rem1776

@rem1776 rem1776 commented May 14, 2026

Copy link
Copy Markdown
Contributor

Description
adds a workaround for nvhpc's lack of support for deferred-rank arrays. Copies over the nice new routines that use deferred ranks and makes them worse by using explicit rank sizes, then adds them to the corresponding interfaces to support all required dimensions the classic fortran way.

Open to any advice for how to name/manage the macro. not sure if i should just leave it as __NVCOMPILER, but it would be more convenient.

Fixes #1864

How Has This Been Tested?
nvhpc 26.1ng (beta release) + mpich was able to compile and pass most of the mpp tests. I got 3 failures, but I think they are all unrelated to these updates.

25.1 was able to compile too, but many of the mpp tests fail.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • New check tests, if applicable, are included
  • make distcheck passes

@rem1776 rem1776 mentioned this pull request May 21, 2026
8 tasks
@laurenchilutti

Copy link
Copy Markdown
Member

Do we have a way of tracking that when NVIDIA fixe their bug we should revert this change? Maybe an issue in FMS so that we dont forget this?

@rem1776

rem1776 commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

@laurenchilutti There's an issue put in by marshall, its linked above.

I just tested again and it looks like its working with the new beta version of nvhpc actually. Not sure why i had issues the last time i tested main with it, could be specific flags i was using.

I still think we should include this though since it will most likely be a while until the beta is available on any production systems.

@edoyango

Copy link
Copy Markdown

@rem1776

i ran into another issue in the rebase re: tests. the generalized indices refactored the group update tests (test_fms/mpp/test_mpp_domains.F90 and test_fms/mpp/include/group_update.inc) so that the group update tests do some permutation stuff that i suppose relate to the generalized indices stuff. but now that the generalized indices changes have been reverted, those tests don't work.

I can see 3 options for adding working openmp offload tests:

  • keep the ones that i have currently, and they live alongside the existing non-functional tests.
  • refactor the non-functional tests to work and include the openmp offload tests there.
  • try to combine the two - knowing that the tests don't work.

character(len=:), allocatable :: att_name !< Name of the attribute
contains
#ifndef __NVCOMPILER
procedure :: add => fms_add_attribute

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't this also be #ifdef as well?

subroutine add_axis_attribute(this, att_name, att_value)
class(fmsDiagFullAxis_type),INTENT(INOUT) :: this !< diag_axis obj
character(len=*), intent(in) :: att_name !< Name of the attribute
class(*), intent(in) :: att_value(:) !< The attribute value to add
integer :: j !< obj%num_attributes (for less typing)
if (.not. allocated(this%attributes)) &
allocate(this%attributes(max_axis_attributes))
this%num_attributes = this%num_attributes + 1
j = this%num_attributes
call this%attributes(j)%add(att_name, att_value)
end subroutine add_axis_attribute

We also should probably print out a NOTE on the write_metadata saying that the metadata is not being written (if it applies)

@uramirez8707

Copy link
Copy Markdown
Contributor

@rem1776

i ran into another issue in the rebase re: tests. the generalized indices refactored the group update tests (test_fms/mpp/test_mpp_domains.F90 and test_fms/mpp/include/group_update.inc) so that the group update tests do some permutation stuff that i suppose relate to the generalized indices stuff. but now that the generalized indices changes have been reverted, those tests don't work.

I can see 3 options for adding working openmp offload tests:

* keep the ones that i have currently, and they live alongside the existing non-functional tests.

* refactor the non-functional tests to work and include the openmp offload tests there.

* try to combine the two - knowing that the tests don't work.

@edoyango Sorry for the extra work. I think the first option is reasonable. We can skip the existing non-functional tests and fix them once the generalized indices work is complete.

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.

NVHPC (NVIDIA) cannot build select rank

4 participants