-
Notifications
You must be signed in to change notification settings - Fork 23
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
Updated Field API variants of the clouds dwarf (CPU and GPU) #96
Conversation
00d866e
to
9754c1a
Compare
7eee6fb
to
3804590
Compare
a62f0ce
to
91f01f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks, this looks like it was a substantial piece of work that has been carried out very diligently and well structured!
I left a few small comments but nothing major.
To make sure this is tested in CI, please add --with-field-api
in all four entries in the github workflow here:
dwarf-p-cloudsc/.github/workflows/build.yml
Lines 35 to 38 in 57e95e8
- '' # Plain build without any options | |
- '--with-gpu --with-loki --with-atlas' # Enable Loki, Atlas, and GPU variants | |
- '--with-gpu --with-loki --with-atlas --with-mpi' # Enable Loki, Atlas, and GPU variants with MPI | |
- '--single-precision --with-gpu --with-loki --with-atlas --with-mpi' # Enable Loki, and GPU variants with MPI in a single-precision build |
Further down, you may have to add the GPU-enabled field_api build target also to the ctest_exclude options, e.g., here:
ctest_exclude_pattern: '-gpu-|-scc-|-loki-c|-cuda-' # GPU variants don't work on CPU runners, loki-c variant causes SIGFPE |
In addition, you will have to add the new target to the script here: https://github.com/ecmwf-ifs/dwarf-p-cloudsc/blob/develop/.github/scripts/verify-targets.sh
Apologies, final request: Please update also the README section here: Lines 81 to 90 in 57e95e8
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks @wertysas for this excellent and comprehensive piece of work! 🙏 Mirroring the F-API usage in the IFS is really great as it will allow us to test F-API related Loki recipes on cloudsc first.
I've left a few comments for you to address, but none of these require major changes.
…-api flag is set but --with-cuda is turned off.
src/cloudsc_loki/CMakeLists.txt
Outdated
${COMMON_MODULE}/cloudsc_field_state_mod.F90 | ||
${COMMON_MODULE}/cloudsc_flux_type_mod.F90 | ||
${COMMON_MODULE}/cloudsc_aux_type_mod.F90 | ||
${COMMON_MODULE}/cloudsc_state_type_mod.F90 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably not be added here, since this is the SCC CUF variant that is not based on the field variant of the gpu driver. My thinking is that a new loki_transform will be added through the dwarf-p-cloudsc/je-field-api-offload branch that I am using for development of the Loki Field API offload transformation.
…nned memory option from compile time constant to runtime ENV variable
I think the gnu |
…pped-field to without-mapped-fields, added field variants to verify-targets, and updated sync_host methods in scc_field driver
…NIT_MAP_DEVTPR logic to field_state_mod
…nd added CPU field version to README
Many thanks @wertysas for addressing all of my comments! 🙏 The CI fails at the moment because it can't find the |
…. variable to field gpu tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for sorting out the CI issues, this looks great and good to go 👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks for the updates and @awnawab for the diligent review! Just one final request to use a more meaningful option description, otherwise ready to go!
- arch: nvhpc/21.9 | ||
nvhpc_version: 21.9 | ||
io_library_flag: '' | ||
build_flags: '--single-precision --with-gpu --with-loki --with-cuda --with-field' | ||
ctest_exclude_pattern: '-gpu-|-scc-|-loki-c|-cuda' # GPU variants don't work on CPU runners, loki-c variant causes SIGFPE | ||
- arch: nvhpc/21.9 | ||
nvhpc_version: 21.9 | ||
io_library_flag: '--with-serialbox' | ||
build_flags: '--with-gpu --with-loki --with-cuda --with-field' | ||
ctest_exclude_pattern: '-gpu-|-scc-|-loki-c|-cuda' # GPU variants don't work on CPU runners, loki-c variant causes SIGFPE | ||
- arch: nvhpc/21.9 | ||
nvhpc_version: 21.9 | ||
io_library_flag: '' | ||
build_flags: '--single-precision --with-gpu --with-loki --with-cuda --with-field --without-mapped-fields' | ||
ctest_exclude_pattern: '-gpu-|-scc-|-loki-c|-cuda' # GPU variants don't work on CPU runners, loki-c variant causes SIGFPE | ||
- arch: nvhpc/21.9 | ||
nvhpc_version: 21.9 | ||
io_library_flag: '--with-serialbox' | ||
build_flags: '--with-gpu --with-loki --with-cuda --with-field --without-mapped-fields' | ||
ctest_exclude_pattern: '-gpu-|-scc-|-loki-c|-cuda' # GPU variants don't work on CPU runners, loki-c variant causes SIGFPE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[No action required!] I think we can skip the 21.9 builds. That compiler version is fairly outdated now and the 23.5 tests are much more meaningful. But that can be dealt with in a subsequent CI-cleanup that is on the horizon.
CMakeLists.txt
Outdated
DEFAULT ON ) | ||
|
||
ecbuild_find_package( NAME loki ) | ||
ecbuild_find_package( NAME atlas ) | ||
|
||
ecbuild_add_option( FEATURE FIELD_API_DISABLE_MAPPED_MEMORY | ||
DESCRIPTION "Use ACC mapped memory by default in Field API objects" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That description should probably read something like "Disable the use of ACC mapped memory in Field API objects"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thank you for spotting that, I missed to update the description when changing this option. I have changed it now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fantastic! Great contribution and enables a lot of great follow-on stuff.
Driver structure and data types look much closer to the full system in this and the structural issue are solved quite elegantly (eg. the packed FIELD_GANG implementation.
GTG from me.
This is an update of the Field API variants of cloudsc that aims to resemble the use of Field API in the IFS more closely than before. This includes the addition of a new global state type for the Field API variants:
CLOUDSC_FIELD_STATE_TYPE
and three types for aux vars, fluxes and tendencies that resemble similar types in the IFS:CLOUDSC_AUX_TYPE
CLOUDSC_FLUX_TYPE
CLOUDSC_STATE_TYPE
There has also been updates to the build structure, that makes it possible to build the CPU Field API version without OpenACC or CUDA and to build the GPU Field API version without CUDA support. The following ecbuild_options have been added to support this:
with-field-api
enables field-api variants to be builtwith-mapped-fields
builds field-api variants with field pointers automatically by OpenACC to device (requires OpenACC and CUDA)with-pinned-fields
builds field-api variants with fields allocated in pinned memory (requires OpenACC and CUDA)