Skip to content

Commit 4bad094

Browse files
authored
make the NSE solver __device__ only on GPUs (#2012)
when running on GPUs we never have it use host this seems to be needed for the __device__ changes we are doing for HIP
1 parent 42bf384 commit 4bad094

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

integration/nse_update_sdc.H

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ using namespace amrex::literals;
3333
/// on input, *_source are the reactive sources at time t0 and on output
3434
/// they are the sources at time t0+dt
3535
///
36-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
36+
AMREX_GPU_DEVICE AMREX_INLINE
3737
void nse_derivs(const amrex::Real rho0, const amrex::Real rhoe0, const amrex::Real *rhoaux0,
3838
const amrex::Real dt, const amrex::Real *ydot_a,
3939
amrex::Real& drhoedt, amrex::Real* drhoauxdt, const amrex::Real T_fixed) {
@@ -168,7 +168,7 @@ void nse_derivs(const amrex::Real rho0, const amrex::Real rhoe0, const amrex::Re
168168
/// this version works with the tabulated NSE and requires AUX_THERMO
169169
///
170170
template <typename BurnT>
171-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
171+
AMREX_GPU_DEVICE AMREX_INLINE
172172
void sdc_nse_burn(BurnT& state, const amrex::Real dt) {
173173

174174
using namespace AuxZero;
@@ -307,7 +307,7 @@ void sdc_nse_burn(BurnT& state, const amrex::Real dt) {
307307
///
308308
/// This computes drhoedt and drhoyedt_weak for a given (rho, rho e, and rho Ye)
309309
///
310-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
310+
AMREX_GPU_DEVICE AMREX_INLINE
311311
void nse_derivs(const amrex::Real rho0, const amrex::Real rhoe0,
312312
const amrex::Real rhoYe0, amrex::Real &T0,
313313
amrex::Real &mu_p, amrex::Real &mu_n,
@@ -415,7 +415,7 @@ void nse_derivs(const amrex::Real rho0, const amrex::Real rhoe0,
415415
///
416416

417417
template <typename BurnT>
418-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
418+
AMREX_GPU_DEVICE AMREX_INLINE
419419
void sdc_nse_burn(BurnT& state, const amrex::Real dt) {
420420

421421
state.success = true;

nse_solver/nse_check.H

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <nse_solver.H>
1515

1616

17-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
17+
AMREX_GPU_DEVICE AMREX_INLINE
1818
void check_nse_molar(const amrex::Array1D<amrex::Real, 1, NumSpec>& Y,
1919
const amrex::Array1D<amrex::Real, 1, NumSpec>& Y_nse,
2020
bool& nse_check) {
@@ -65,7 +65,7 @@ void check_nse_molar(const amrex::Array1D<amrex::Real, 1, NumSpec>& Y,
6565
}
6666

6767

68-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
68+
AMREX_GPU_DEVICE AMREX_INLINE
6969
int get_root_index(const int nuc_idx, amrex::Array1D<int, 1, NumSpec>& group_idx) {
7070
// Returns the root index of the nuclei given the nuclei index [1, NumSpec]
7171
// Also updates all parent indices to point to the root index in group_idx
@@ -95,7 +95,7 @@ int get_root_index(const int nuc_idx, amrex::Array1D<int, 1, NumSpec>& group_idx
9595
}
9696

9797

98-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
98+
AMREX_GPU_DEVICE AMREX_INLINE
9999
void nse_union(const int nuc_idx_a, const int nuc_idx_b,
100100
amrex::Array1D<int, 1, NumSpec>& group_idx,
101101
amrex::Array1D<int, 1, NumSpec>& group_size) {
@@ -126,7 +126,7 @@ void nse_union(const int nuc_idx_a, const int nuc_idx_b,
126126
}
127127

128128

129-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
129+
AMREX_GPU_DEVICE AMREX_INLINE
130130
bool in_single_group(amrex::Array1D<int, 1, NumSpec>& group_idx) {
131131

132132
// This function checks whether all isotopes are either in the LIG group
@@ -146,7 +146,7 @@ bool in_single_group(amrex::Array1D<int, 1, NumSpec>& group_idx) {
146146

147147

148148
template <typename T>
149-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
149+
AMREX_GPU_DEVICE AMREX_INLINE
150150
void fill_reaction_timescale(amrex::Array1D<T, 1, NSE_INDEX::NumNSERatePairs>& reaction_timescales,
151151
const int current_rate_pair, const amrex::Real rho,
152152
const amrex::Array1D<amrex::Real, 1, NumSpec>& Y,
@@ -238,7 +238,7 @@ void fill_reaction_timescale(amrex::Array1D<T, 1, NSE_INDEX::NumNSERatePairs>& r
238238
}
239239

240240

241-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
241+
AMREX_GPU_DEVICE AMREX_INLINE
242242
void fill_merge_indices(int& merge_idx1, int& merge_idx2,
243243
const int current_rate_pair,
244244
amrex::Array1D<int, 1, NumSpec>& group_idx) {
@@ -288,7 +288,7 @@ void fill_merge_indices(int& merge_idx1, int& merge_idx2,
288288
}
289289

290290

291-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
291+
AMREX_GPU_DEVICE AMREX_INLINE
292292
void nse_grouping(amrex::Array1D<int, 1, NumSpec>& group_idx, const amrex::Real rho,
293293
const amrex::Array1D<amrex::Real, 1, NumSpec>& Y,
294294
const amrex::Array1D<amrex::Real, 1, Rates::NumRates>& screened_rates,
@@ -374,7 +374,7 @@ void nse_grouping(amrex::Array1D<int, 1, NumSpec>& group_idx, const amrex::Real
374374
}
375375

376376

377-
AMREX_GPU_HOST_DEVICE AMREX_INLINE
377+
AMREX_GPU_DEVICE AMREX_INLINE
378378
bool in_nse(burn_t& current_state, bool skip_molar_check=false) {
379379

380380
// This function returns the boolean that tells whether we're in nse or not

0 commit comments

Comments
 (0)