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

Integrate WW3 CMake build #1074

Closed
kgerheiser opened this issue Mar 2, 2022 · 8 comments · Fixed by #1089
Closed

Integrate WW3 CMake build #1074

kgerheiser opened this issue Mar 2, 2022 · 8 comments · Fixed by #1089
Assignees
Labels
enhancement New feature or request

Comments

@kgerheiser
Copy link
Contributor

kgerheiser commented Mar 2, 2022

Description

A CMake build was recently added to WW3 and this build should be integrated in the UFS. This will significantly simplify the build because it will integrate directly into UFS with add_subdirectory.

This block of code:

if(WW3)
if(CMAKE_Platform)
if(${CMAKE_Platform} MATCHES "linux*" OR ${CMAKE_Platform} MATCHES "macosx*")
if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(WW3_COMP "gnu")
elseif (CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
set(WW3_COMP "intel")
endif()
else()
set(WW3_COMP ${CMAKE_Platform})
endif()
endif()
message("Build WW3:")
message(" run: ${CMAKE_BUILD_TOOL} WW3_PARCOMPN=4 WW3_COMP=${WW3_COMP} ww3_nemslibonly")
message(" in: ${CMAKE_CURRENT_SOURCE_DIR}/WW3/model/esmf")
message("")
add_custom_target(ww3_nems
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/WW3/model/esmf
COMMAND ${CMAKE_BUILD_TOOL} WW3_PARCOMPN=4 WW3_COMP=${WW3_COMP} ww3_nemslibonly > ${CMAKE_CURRENT_BINARY_DIR}/ww3_make.log 2>&1)
set(WW3_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/WW3/model/obj/libww3_multi_esmf.a)
endif()

becomes:

  set(SWITCH "multi_esmf")
  set(MULTI_ESMF ON)
  add_subdirectory(WW3)

And linking the library is:

target_link_libraries(ufs PUBLIC WW3::WW3)

A working branch can be found here: https://github.com/jessicameixner-noaa/ufs-weather-model/tree/feature/ww3-cmake

@JessicaMeixner-NOAA did some Initial testing and tests pass, but there is an error on WCOSS-Dell related to #1072

@kgerheiser kgerheiser added the enhancement New feature or request label Mar 2, 2022
@DeniseWorthen
Copy link
Collaborator

DeniseWorthen commented Mar 2, 2022

@kgerheiser There will be an alternate nuopc cap which runs on a mesh added to the WW3 dev/ufs-weather-model branch. I am building with an alternate switch file, source file list and a different FRONT_WW3 definition in the CMakeLists.txt.

The mesh cap will be used w/in UWM for the S2SW and HAFSW apps. The ATMW application will continue to use the current build configuration (switch, file list and FRONT_WW3).

What changes will be required to have two alternate WW3 builds in UWM?

@kgerheiser
Copy link
Contributor Author

kgerheiser commented Mar 2, 2022

Setting a different switch file based on some other option is pretty simple, and would be something like

if(S2SW)
  set(switch xxxx)
else()
  set(switch multi_esmf`
endif

Different source files will have to be handled on the WW3 side through a new CMake option or something.

@DeniseWorthen
Copy link
Collaborator

At the app level, would I define a second WW3 option here,

set(WW3             OFF CACHE BOOL "Enable WW3")

and here

if(WW3)
  add_dependencies(ufs ww3_nems)
  list(APPEND _ufs_defs_private FRONT_WW3=WMESMFMD)

Will I need a dependency other than ww3_nems here?

Then in cmake/configure_apps.cmake, I'd define the alternate WW3.

  if(APP MATCHES "S2SW")
    set(WW3      ON  CACHE BOOL "Enable WAVEWATCH III"       FORCE)
    message("Configuring UFS app in S2S with Waves mode")
  else()

@junwang-noaa
Copy link
Collaborator

@kgerheiser I am curious, I assume there is no change on FV3 side with the ww3 cmake, why is there an issue compiling the code on dell? Is the ww3 cmake build taking more memory? The current ufs-weather-model develop branch can be built with ww3.

@kgerheiser
Copy link
Contributor Author

  • I assume there is no change on FV3 side with the ww3 cmake

No change there, only the build system changes

  • Why is there an issue compiling the code on dell?

The build runs out of memory on WOCSS-Dell. For whatever reason the build must take more memory to compile than the current build.

@junwang-noaa
Copy link
Collaborator

@kgerheiser @JessicaMeixner-NOAA Would you please try with the latest develop branch to see if you still have issue compiling the code on dell? After we added the compile option change to O0 for GFS_typedefs.F90, the compile issue was resolved for PR#1032. Thanks.

@JessicaMeixner-NOAA
Copy link
Collaborator

I'm running on wcoss-dell now to see if this and updates from @kgerheiser helped.

@kgerheiser
Copy link
Contributor Author

The compile issue has been fixed

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

Successfully merging a pull request may close this issue.

4 participants