Skip to content

Updates to fix nvhpc compiler issues#485

Merged
mnlevy1981 merged 1 commit into
marbl-ecosys:developmentfrom
mnlevy1981:nvhpc_fixes
Oct 27, 2025
Merged

Updates to fix nvhpc compiler issues#485
mnlevy1981 merged 1 commit into
marbl-ecosys:developmentfrom
mnlevy1981:nvhpc_fixes

Conversation

@mnlevy1981
Copy link
Copy Markdown
Collaborator

To run the standalone tests on derecho, we want to use nvhpc/25.9 (this includes a bug fix we reported where nvhpc/25.7 was not handling associate statements correctly).

The compiler also rightly complained about an instance of a missing kind number when using a real variable (although 1.0 is exactly representable so there shouldn't be any difference between 1.0 and 1.0_r8).

Thirdly, I replaced a couple of where statements with the do-loop if-statement combination to avoid dividing by zero. It is unfortunate that the compiler doesn't handle this very well, but it is not a very invasive change.

To run the standalone tests on derecho, we want to use nvhpc/25.9 (this
includes a bug fix we reported where nvhpc/25.7 was not handling associate
statements correctly).

The compiler also rightly complained about an instance of a missing kind number
when using a real variable (although 1.0 is exactly representable so there
shouldn't be any difference between 1.0 and 1.0_r8).

Thirdly, I replaced a couple of where statements with the do-loop if-statement
combination to avoid dividing by zero. It is unfortunate that the compiler
doesn't handle this very well, but it is not a very invasive change.
@mnlevy1981
Copy link
Copy Markdown
Collaborator Author

Note: I am trying to create a small example problem highlighting the issue with where statements in the nvhpc compiler, but my simple example doesn't create the same error I was seeing in the MARBL test suite. I expected

program where_statements

  real, dimension(3,3) :: old_vals, new_vals
  integer :: i

  old_vals(:,:) = 2.0
  old_vals(2,:) = 0.0

  do i=1,3
    where (old_vals(i,:) > 0.0)
      new_vals(i,:) = 1.0 / old_vals(i,:)
    else where
      new_vals(i,:) = 0.0
    end where
    print*, new_vals(i,:)
  end do


end program where_statements

to fail, but even with the same -O2 -Mfree compiler flags we use to build MARBL it runs fine. I don't think it's worth spending the time to further investigate / understand why I needed to modify compute_autotroph_nutrient_uptake() in this PR, although I can think of a few debug statements to include that might help highlight the issue.

Copy link
Copy Markdown
Collaborator

@klindsay28 klindsay28 left a comment

Choose a reason for hiding this comment

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

LGTM

@mnlevy1981 mnlevy1981 merged commit 81092df into marbl-ecosys:development Oct 27, 2025
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.

2 participants