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

Changes to build UFS-WM on MacOS platform with clang@15/[email protected] #2551

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

Conversation

natalie-perlin
Copy link
Collaborator

@natalie-perlin natalie-perlin commented Jan 7, 2025

Description:

Updates to build UFS WM on MacOSX platforms, Ventura or Sonoma OS, [email protected], [email protected]
openmpi/5.0.3 (or 4.1.6, tested as well) is built as a part of the spack-stack-1.8.0.

Tested on three MacOS systems:

Files changed:

  • ufs_macosx.gnu.lua (a new file, replacing the old one ufs_macosx.gnu)
  • CMakeLists.txt

Running of the UFS-WM was tested as a part of the UFS-SRW App, successfully ran a standard community test. A corresponding PR in the UFS-SRW repo:
ufs-community/ufs-srweather-app#1171

Priority:

(TBD)

Git Tracking

No regular testing of UFS-WM on MacOS systems is being done

This PR addresses the issues from #2371,
and uses the solution proposed.

UFSWM Blocking Dependencies:

Uses spack-stack-1.8.0
#2453
except for using mapl-2.40.3-esmf-8.6.0 required for the current ufs-wm build

At the moment, all the modules are loaded in the ufs_macosx.gnu.lua file; ufs_common.lua not used


Changes

Library Changes/Upgrades:

Directions for building spack-stack

Detailed directions to build spack-stack-1.8.0 with the software versions used in this PR:
https://docs.google.com/document/d/1Z0L7eujZGtyeZRzcgguyZPsZpkwb2Om7UhFqQPVtxnE/edit?usp=sharing


Testing Log:

  • RDHPCS
    • Hera
    • Orion
    • Hercules
    • Jet
    • GaeaC5
    • GaeaC6
    • Derecho
  • WCOSS2
    • Dogwood/Cactus
    • Acorn
  • CI
  • opnReqTest (complete task if unnecessary)

build.sh Outdated Show resolved Hide resolved
@jkbk2004
Copy link
Collaborator

jkbk2004 commented Jan 7, 2025

@grantfirl new fv3 hash is NOAA-EMC/fv3atm@7d99880

no changes from develop branch for the build.sh script
@natalie-perlin
Copy link
Collaborator Author

@grantfirl new fv3 hash is NOAA-EMC/fv3atm@7d99880

Successfully tested the build of the code (S2SWA) with the hash 7d99880 on NOAA AWS MacOS instance.

if mode() == "load" then
LmodMsgRaw([===[
Please export these env. variables after the module is successfully loaded:
> export LDFLAGS+=" -L${libjpeg_turbo_ROOT}/lib -ljpeg -Wl,-rpath,$libjpeg_turbo_ROOT}/lib -L${jasper_ROOT}/lib -ljasper -Wl,-rpath,${jasper_ROOT}/lib -L${libpng_ROOT}/lib -lpng -Wl,-rpath,${libpng_ROOT}/lib "
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems like a hack to me. Can't this be done in the modulefile?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@climbfuji - it seems that @DavidHuber-NOAA found a great solution (below in a comment) that worked seamlessly!.. Will update the branch with that approach.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops, that was preliminary, the env. variables ${libjpeg_turbo_ROOT}, ${jasper_ROOT}, ${libpng_ROOT} do not expand into full paths during the build... so getting linking issues.
The is is that these variables are not available when the Lmod file is being evaluated - this is a specifics of the Lmod. It is evaluated first before being executed/loaded.
I will attempt to find some other solutions, but so far other solutions appear to be cumbersome.

@GeorgeVandenberghe-NOAA
Copy link
Collaborator

@jkbk2004
Copy link
Collaborator

@natalie-perlin do you think you can combine ufs_macosx.gnu into ufs_macosx.gnu.lua? I mean like https://github.com/ufs-community/ufs-weather-model/blob/develop/modulefiles/ufs_wcoss2.intel.lua. Also, some test result or instruction will be helpful for people using mac even in sequential mode.

Comment on lines +59 to +63
if mode() == "load" then
LmodMsgRaw([===[
Please export these env. variables after the module is successfully loaded:
> export LDFLAGS+=" -L${libjpeg_turbo_ROOT}/lib -ljpeg -Wl,-rpath,$libjpeg_turbo_ROOT}/lib -L${jasper_ROOT}/lib -ljasper -Wl,-rpath,${jasper_ROOT}/lib -L${libpng_ROOT}/lib -lpng -Wl,-rpath,${libpng_ROOT}/lib "
]===])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Untested, but something like this should work:

Suggested change
if mode() == "load" then
LmodMsgRaw([===[
Please export these env. variables after the module is successfully loaded:
> export LDFLAGS+=" -L${libjpeg_turbo_ROOT}/lib -ljpeg -Wl,-rpath,$libjpeg_turbo_ROOT}/lib -L${jasper_ROOT}/lib -ljasper -Wl,-rpath,${jasper_ROOT}/lib -L${libpng_ROOT}/lib -lpng -Wl,-rpath,${libpng_ROOT}/lib "
]===])
local ldflags=os.getenv("LDFLAGS") or ""
setenv("LDFLAGS", ldflags .. " -L${libjpeg_turbo_ROOT}/lib -ljpeg -Wl,-rpath,$libjpeg_turbo_ROOT}/lib -L${jasper_ROOT}/lib -ljasper -Wl,-rpath,${jasper_ROOT}/lib -L${libpng_ROOT}/lib -lpng -Wl,-rpath,${libpng_ROOT}/lib ")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if mode() == "load" then
LmodMsgRaw([===[
Please export these env. variables after the module is successfully loaded:
> export LDFLAGS+=" -L${libjpeg_turbo_ROOT}/lib -ljpeg -Wl,-rpath,$libjpeg_turbo_ROOT}/lib -L${jasper_ROOT}/lib -ljasper -Wl,-rpath,${jasper_ROOT}/lib -L${libpng_ROOT}/lib -lpng -Wl,-rpath,${libpng_ROOT}/lib "
Copy link
Collaborator

Choose a reason for hiding this comment

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

You're missing a { here. The $libjpeg_turbo_ROOT} should be ${libjpeg_turbo_ROOT}
Without that, it would fail with a syntax error.
How did you test this?

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.

7 participants