Skip to content

Commit 02ba100

Browse files
authored
Merge Pull Request #2954 from E3SM-Project/scream/mahf708/fix-rrtmgp-k-cuda
Automatically Merged using E3SM Pull Request AutoTester PR Title: fix errors and warning in rrtmgp-k PR Author: mahf708 PR LABELS: radiation, AT: AUTOMERGE, CUDA, pm-gpu
2 parents 1b69611 + 796403f commit 02ba100

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

components/eamxx/src/physics/rrtmgp/eamxx_rrtmgp_process_interface.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,10 +1171,24 @@ void RRTMGPRadiation::run_impl (const double dt) {
11711171
aero_tau_lw_k(i,k,b) = d_aero_tau_lw(icol,b,k);
11721172
});
11731173
} else {
1174-
Kokkos::deep_copy(aero_tau_sw_k, 0);
1175-
Kokkos::deep_copy(aero_ssa_sw_k, 0);
1176-
Kokkos::deep_copy(aero_g_sw_k , 0);
1177-
Kokkos::deep_copy(aero_tau_lw_k, 0);
1174+
// cuda complains (in warning only) about these being not allowed...
1175+
// Kokkos::deep_copy(aero_tau_sw_k, 0);
1176+
// Kokkos::deep_copy(aero_ssa_sw_k, 0);
1177+
// Kokkos::deep_copy(aero_g_sw_k , 0);
1178+
// Kokkos::deep_copy(aero_tau_lw_k, 0);
1179+
// So, do the manual labor instead:
1180+
Kokkos::parallel_for(Kokkos::TeamVectorRange(team, nswbands*nlay), [&] (const int&idx) {
1181+
auto b = idx / nlay;
1182+
auto k = idx % nlay;
1183+
aero_tau_sw_k(i,k,b) = 0.0;
1184+
aero_ssa_sw_k(i,k,b) = 0.0;
1185+
aero_g_sw_k (i,k,b) = 0.0;
1186+
});
1187+
Kokkos::parallel_for(Kokkos::TeamVectorRange(team, nlwbands*nlay), [&] (const int&idx) {
1188+
auto b = idx / nlay;
1189+
auto k = idx % nlay;
1190+
aero_tau_lw_k(i,k,b) = 0.0;
1191+
});
11781192
}
11791193
#endif
11801194
});

components/eamxx/src/physics/rrtmgp/rrtmgp_utils.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ bool check_range(T x, Real xmin, Real xmax, std::string msg, std::ostream& out=s
112112
}
113113
#endif
114114
#ifdef RRTMGP_ENABLE_KOKKOS
115-
template <class T, typename std::enable_if<T::rank == 1>::type* = nullptr>
115+
template <class T, typename std::enable_if<T::rank == 1>::type* dummy = nullptr>
116116
bool check_range_k(T x, typename T::const_value_type xmin, typename T::const_value_type xmax,
117117
std::string msg, std::ostream& out=std::cout) {
118118
bool pass = true;
@@ -137,7 +137,7 @@ bool check_range_k(T x, typename T::const_value_type xmin, typename T::const_val
137137
return pass;
138138
}
139139

140-
template <class T, typename std::enable_if<T::rank == 2>::type* = nullptr>
140+
template <class T, typename std::enable_if<T::rank == 2>::type* dummy = nullptr>
141141
bool check_range_k(T x, typename T::const_value_type xmin, typename T::const_value_type xmax,
142142
std::string msg, std::ostream& out=std::cout) {
143143
bool pass = true;
@@ -166,7 +166,7 @@ bool check_range_k(T x, typename T::const_value_type xmin, typename T::const_val
166166
return pass;
167167
}
168168

169-
template <class T, typename std::enable_if<T::rank == 3>::type* = nullptr>
169+
template <class T, typename std::enable_if<T::rank == 3>::type* dummy = nullptr>
170170
bool check_range_k(T x, typename T::const_value_type xmin, typename T::const_value_type xmax,
171171
std::string msg, std::ostream& out=std::cout) {
172172
bool pass = true;

components/eamxx/src/physics/rrtmgp/scream_rrtmgp_interface.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,14 +1190,14 @@ static void mixing_ratio_to_cloud_mass(
11901190
* property look-up tables, but could be used to limit other
11911191
* fields as well.
11921192
*/
1193-
template<typename InT, typename T, typename OutT, typename std::enable_if<OutT::rank == 1>::type* = nullptr>
1193+
template<typename InT, typename T, typename OutT, typename std::enable_if<OutT::rank == 1>::type* dummy = nullptr>
11941194
static void limit_to_bounds_k(InT const &arr_in, T const lower, T const upper, OutT &arr_out) {
11951195
Kokkos::parallel_for(arr_out.size(), KOKKOS_LAMBDA(int i) {
11961196
arr_out(i) = std::min(std::max(arr_in(i), lower), upper);
11971197
});
11981198
}
11991199

1200-
template<typename InT, typename T, typename OutT, typename std::enable_if<OutT::rank == 2>::type* = nullptr>
1200+
template<typename InT, typename T, typename OutT, typename std::enable_if<OutT::rank == 2>::type* dummy = nullptr>
12011201
static void limit_to_bounds_k(InT const &arr_in, T const lower, T const upper, OutT &arr_out) {
12021202
Kokkos::parallel_for(MDRP::template get<2>({arr_out.extent(0), arr_out.extent(1)}), KOKKOS_LAMBDA(int i, int j) {
12031203
arr_out(i, j) = std::min(std::max(arr_in(i, j), lower), upper);

0 commit comments

Comments
 (0)