-
Notifications
You must be signed in to change notification settings - Fork 19
Kokkos Thermodynamics #992
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
base: kokkos
Are you sure you want to change the base?
Conversation
* made device buffer init lazy * removed resize_arrays() * fix: moved sync state to ExtModelArray
* PDTestDynamics is registered under the proper name
bba9367 to
23e8a6e
Compare
updated CCSMIceAlbedo removed obsolete code restored old interface of FiniteElementSpecHum
Concerning virtual function calls in overElements kernelsThe files to look at:
Consequences of the new interface that I can't properly evaluate:
|
The ice albedo changes look fine, as they stand. We only ever need to calculate the ice albedo once per timestep, so it makes sense to use a
That looks fine, too.
Some of the peculiarities are due to me not fully analysing what the original code in Lagrangian nextSIM was doing and roughly replicating which parameters belonged to which components. It's not that (The |
Kokkos Thermodynamics
Work in progress on the Kokkos(GPU) thermodynamics. (issue #672)
To track changes in buffers and to sync data between host and device a more data oriented approach is needed. To this end, the management of fields was made more explicit through the
ModelArrayAccessor. The whole model and the tests have been updated to use this new interface which requires:See for example
physics/src/modules/LateralIceSpreadModule/HiblerSpread.cppThe USE_KOKKOS block should be ignored since is just a copy that has not been updated yet.To actually enable device execution, the code needs to be ported to Kokkos which involves further changes:
ModelArraySee for example
physics/src/modules/IceThermodynamicsModule/ThermoWinton.cpp.The question is, how should these two different code paths be separated? In the dynamics, the Kokkos code is kept in separate files that build on top of the existing reference implementation, replacing all the relevant parts. This is necessary to achieve a tight integration for the actual computations. In long-term, the idea was to focus on maintaining the Kokkos version since it runs on both CPU and GPU and perhaps remove the old implementation at some point.
Thermodynamics could be ported in the same way, but since the individual components are much smaller it is also feasible to insert the switch inside the update routines and reuse more of the code. In fact, I build a light abstraction layer that hides all the specifics so there is just one version of the code, see
ThermoWinton::update. Of course, the combined kernel foroverElementsstill needs to adhere to the stricter rules of a Kokkos kernel, so using these abstractions would not automatically make all the code compatible. This abstraction is also somewhat redundant because Kokkos does effectively the same thing with its execution space concept. It just brings the added benefit of working directly withModelArrayand not needing Kokkos to build NeXtSIM-DG.