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

Lpjguess mac compile #3459

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

infotroph
Copy link
Member

Description

Removes templated max and min macros and replaces their calls with c++ builtins fmax and fmin. Unless I've missed something, all the variables passed to these functions (at least for the uses of the in the existing PEcAn.LJPGUESS code -- I have not inspected their calls elsewhere in the LPJ-GUESS model code) are already declared with type double, so the type flexibility of the templates is not needed.

Motivation and Context

Compilation of PEcAn.LPJGUESS was failing on my Mac with unknown type name '_GLIBCXX14_CONSTEXPR'. @yinghaoSunn did some great detective work and diagnosed this as one of several macros provided by GCC's glibc that are not present in the libc Apple provides with their version of Clang. Although it would theoretically be possible to declare a SystemRequirements on GNU glibc, in practice that's not automatically enforced and would not prevent build failures on Macs.

Instead, I propose to use a simpler equivalent that compiles and passes package tests on all systems I've tested it on. To state the obvious though, this is introducing more divergence between the LPJ-GUESS model and the code copied into the PEcAn package. I'm opening this PR to start discussion, but will defer fully to actual users of the model on whether compilation across OSes is more or less important than keeping model and PEcAn code in sync.

Review Time Estimate

  • Immediately
  • Within one week
  • When possible

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • My name is in the list of CITATION.cff
  • I agree that PEcAn Project may distribute my contribution under any or all of
    • the same license as the existing code,
    • and/or the BSD 3-clause license.
  • I have updated the CHANGELOG.md.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@mdietze
Copy link
Member

mdietze commented Feb 24, 2025

Assigned to @yinghaoSunn and @istfer but also tagging @HannahOgrady and @MagicForrest to get their opinions

@MagicForrest
Copy link
Contributor

Yes, this looks like a good idea to me. In this case, I don't think you need to worry about the divergence between the LPJ-GUESS code and the code in PEcAn. There is really no reason for not using fmin and fmax in LPJ-GUESS, just "historical reasons". So go for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants