Skip to content

define ice diag_ functions for multi_CUDA backend#485

Open
pdziekan wants to merge 1 commit intoigfuw:masterfrom
pdziekan:diag_ice_mcuda
Open

define ice diag_ functions for multi_CUDA backend#485
pdziekan wants to merge 1 commit intoigfuw:masterfrom
pdziekan:diag_ice_mcuda

Conversation

@pdziekan
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings March 31, 2026 11:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the multi_CUDA backend diagnostics surface to match existing ice-related diagnostics available in the single-GPU (CUDA) backend, by adding the missing wrapper methods that dispatch via pimpl->mcuda_run(...).

Changes:

  • Added multi_CUDA wrappers for ice shape range-selection diagnostics (diag_ice_a_rng, diag_ice_c_rng) and their consecutive-selection variants.
  • Added multi_CUDA wrappers for ice shape moment diagnostics (diag_ice_a_mom, diag_ice_c_mom) and ice mixing ratio (diag_ice_mix_ratio).
  • Added a multi_CUDA wrapper for diag_precip_rate_ice_mass.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +84 to +95
const real_t &r_mi, const real_t &r_mx
)
{
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_ice_a_rng, r_mi, r_mx);
}

template <typename real_t>
void particles_t<real_t, multi_CUDA>::diag_ice_c_rng(
const real_t &r_mi, const real_t &r_mx
)
{
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_ice_c_rng, r_mi, r_mx);
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

In these ice selection helpers, the parameters are named r_mi/r_mx, but they represent ice shape radii ("a" equatorial and "c" polar). Renaming them (e.g., a_mi/a_mx and c_mi/c_mx) would make the intent clearer and match the naming used in the public declarations in particles.hpp and the single-GPU implementation.

Suggested change
const real_t &r_mi, const real_t &r_mx
)
{
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_ice_a_rng, r_mi, r_mx);
}
template <typename real_t>
void particles_t<real_t, multi_CUDA>::diag_ice_c_rng(
const real_t &r_mi, const real_t &r_mx
)
{
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_ice_c_rng, r_mi, r_mx);
const real_t &a_mi, const real_t &a_mx
)
{
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_ice_a_rng, a_mi, a_mx);
}
template <typename real_t>
void particles_t<real_t, multi_CUDA>::diag_ice_c_rng(
const real_t &c_mi, const real_t &c_mx
)
{
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_ice_c_rng, c_mi, c_mx);

Copilot uses AI. Check for mistakes.
Comment on lines +175 to +183
void particles_t<real_t, multi_CUDA>::diag_ice_c_mom(const int &k)
{
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_ice_c_mom, k);
}

template <typename real_t>
void particles_t<real_t, multi_CUDA>::diag_ice_a_mom(const int &k)
{
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_ice_a_mom, k);
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

The moment diagnostics are implemented in c-then-a order here, while the rest of the API and the single-GPU implementation use a-then-c ordering. Reordering these two wrappers to keep diag_ice_a_mom adjacent and before diag_ice_c_mom would make the file easier to scan and keep the multi-GPU backend consistent with other backends.

Suggested change
void particles_t<real_t, multi_CUDA>::diag_ice_c_mom(const int &k)
{
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_ice_c_mom, k);
}
template <typename real_t>
void particles_t<real_t, multi_CUDA>::diag_ice_a_mom(const int &k)
{
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_ice_a_mom, k);
void particles_t<real_t, multi_CUDA>::diag_ice_a_mom(const int &k)
{
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_ice_a_mom, k);
}
template <typename real_t>
void particles_t<real_t, multi_CUDA>::diag_ice_c_mom(const int &k)
{
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_ice_c_mom, k);

Copilot uses AI. Check for mistakes.
Comment on lines +222 to +226
template <typename real_t>
void particles_t<real_t, multi_CUDA>::diag_ice_mix_ratio()
{
pimpl->mcuda_run(&particles_t<real_t, CUDA>::diag_ice_mix_ratio);
}
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

New multi-GPU wrappers are added for ice-related diagnostics (e.g., diag_ice_mix_ratio, diag_precip_rate_ice_mass, and the new diag_ice_[ac]_rng[_cons] / diag_ice_[ac]_mom). There don't appear to be any tests exercising these diagnostics on the multi_CUDA backend; consider adding a GPU-optional test (skip when multi_CUDA is unavailable) that enables ice_switch and smoke-tests these calls and their basic output invariants (e.g., non-negative, non-NaN).

Copilot uses AI. Check for mistakes.
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.

2 participants