ufs-weather-model build on MacBook M3 Sonoma 14.5 #2371
-
I'm attempting to build ufs-weather-model on a MacBook M3 Sonoma 14.5 using spack-stack. I have successfully built spack-stack 1.7.0 using the ufs-weather-model template, though as a side note, the current build of 1.7.0 will not work with current ufs-weather-model develop due to the UFS dependency on the sp library, which will be removed in a current spack-stack build that uses the ip v5 library. I got around this temporarily by pinning the ip library version to 4.3.0 (same IP version as spack-stack 1.6.0). This at least allows the UFS build to start. Bottom line is I get an error in the final link that looks like this:
My module loading and environment setup prior to building:
if I build without 32BIT=ON, I get a similar error:
Just wondering if anyone out there is using Mac/ARM with spack-stack and running into a similar problem. Or has anyone with Mac M chips been able to build ufs-weather-model? |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments 17 replies
-
I now see that OPENMP is forced OFF for Mac builds. However, the spack-stack seems to build with openmp for FMS. Is this the issue? |
Beta Was this translation helpful? Give feedback.
-
Some additional tests: Removing the force of OPENMP OFF for clang builds in configure_macosx.gnu.cmake, same error:
Attempt to remove openmp from fms build of spack-stack:
A few additional tests of trying to remove openmp from spack-stack always results in CRTM cmake failure, presumably because there is no way to build CRTM without openmp in spack-stack (?). Additional test on MacBook Pro intel chip with Ventura 13.6.7:
|
Beta Was this translation helpful? Give feedback.
-
Hi Mike! I forwarded your question yesterday to the team that usually helps troubleshoot spack-stack dependencies. @natalie-perlin mentioned that she is working on building spack-stack (v1.6.0) on Mac but hasn't succeeded yet. Most of our other team members are on Linux systems, I believe. I will see if I can get any more information from them, but several people are either on PTO or about to travel to UIFCW, so there may be a bit of delay. Didn't want you to think we were ignoring the question though! Best, |
Beta Was this translation helpful? Give feedback.
-
After the successful compile, the model still doesn't not run. I have confirmed with another Mac user who gets the same error (I believe using spack-stack 1.6.0 on an M2):
Anyone seeing or seen something similar or have any suggestions? I'm attempting to run an approximation of the control_p8 regression test setup. |
Beta Was this translation helpful? Give feedback.
-
@barlage Were you able to get in touch with the ESMF folks to work on the issue, or do you need more assistance from us? |
Beta Was this translation helpful? Give feedback.
-
@barlage If you don't need all the libraries that spack-stack provides and you don't need the entire SRW app, but just need to be able to compile ufs-weather-model, UFS_UTILS or UPP, on macOS you can take a look at simple-ufs (https://github.com/DusanJovic-NOAA/simple-ufs). I just re-enabled macos github workflow and it seems it built the model and ran a very short c96 test configuration successfully. The github workflow runs on 'macos-14-arm64', which I believe is Sonoma on M chip. I don't know which M chip exactly. See: https://github.com/DusanJovic-NOAA/simple-ufs/actions/runs/10386707623/job/28758562692a |
Beta Was this translation helpful? Give feedback.
-
@barlage - |
Beta Was this translation helpful? Give feedback.
-
I'm getting a similar runtime error for UFS-WM on Mac OS with Intel, when running it as a forecast workflow task in the SRW. All other SRW workflow tasks that use the same spack-stack-1.6.0 environment complete successfully (after some additional flags set), with or without MPI.
|
Beta Was this translation helpful? Give feedback.
-
My further digging into the issue shows that this runtime issues appear indeed due to ESMF is built (mainly the way it is linked) for the clang/clang++/gfortran combination. |
Beta Was this translation helpful? Give feedback.
-
Maybe that's why in my github workflow test here I build everything with the same compiler, GNU in this case. Why would anyone use C/C++ compiler from one vendor and Fortran compiler from another? |
Beta Was this translation helpful? Give feedback.
-
Some updates on the diagnostics: ESMF builds and passes all tests on MacOS with either combination, using clang or gcc:
These tests also include unit tests in $ESMF_DIR/src/Infrastructure/Base/tests that use nlohmann::json pointers for c++, version 3.11.2; a header json.hpp could be found in $ESMF_DIR/src/include/ and in $ESMF_DIR/src/Infrastructure/Base/include/nlohmann/json/ directories. A ufs_model binary built with the spack-stack (with all the ESMF tests passing) still produces the same error as @barlage reported, when it is run with no specific conda environment (such as srw_app conda environment):
Few things are mentioned in this error may draw the attention: libc++abi, nlohmann::json_abi_v3_11_2, and NUOPC json key. I've explored several possible ways to solve the issue, as listed below, but with no avail so far. Addressing the issue with NUOPC json missing key is likely something to get help from the ESMF developers, It is post this issue in the ESMF repo as well. |
Beta Was this translation helpful? Give feedback.
-
Thanks to the support at https://github.com/orgs/esmf-org/discussions/311 (comment)
(note use of "CXX" instead of the currently used "Fortran" in the ufs wm repo) So the final linking of the executable is the key issue. I did test options to do the last step of linking the ufs_model by hand, and replacing "mpicxx " in the string that assembles a successful ufs_model binary by "mpifort" with the same list of libraries, which did not help to solve the problem. |
Beta Was this translation helpful? Give feedback.
Thanks to the support at https://github.com/orgs/esmf-org/discussions/311 (comment)
building and running ufs_model is successful when CXX linker is used instead of Fortran linker.
This includes the following change in main CMakeLists.txt for the ufs_model:
set_target_properties(ufs_model PROPERTIES LINKER_LANGUAGE CXX)
(note use of "CXX" instead of the currently used "Fortran" in the ufs wm repo)
So the final linking of the executable is the key issue. I did test options to do the last step of linking the ufs_model by hand, and replacing "mpicxx " in the string that assembles a successful ufs_model binary by "mpifort" with the same list of libraries, which did not help to solve the problem.
…