Skip to content

Commit

Permalink
run singularity tests through clang warnings, clang address sanitizer…
Browse files Browse the repository at this point in the history
…, clang undefined behavior sanitizer
  • Loading branch information
jonahm-LANL committed Nov 29, 2024
1 parent 14bc298 commit b8d4385
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 19 deletions.
6 changes: 3 additions & 3 deletions singularity-eos/closure/mixed_cell_models.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ class PTESolverBase {
const RealIndexer &vfrac_, const RealIndexer &sie_,
const RealIndexer &temp_, const RealIndexer &press_, Real *&scratch,
Real Tnorm, const MixParams &params = MixParams())
: nmat(nmats), neq(neqs), niter(0), eos(eos_), vfrac_total(vfrac_tot),
sie_total(sie_tot), rho(rho_), vfrac(vfrac_), sie(sie_), temp(temp_),
press(press_), Tnorm(Tnorm), params_(params) {
: params_(params), nmat(nmats), neq(neqs), niter(0), vfrac_total(vfrac_tot),
sie_total(sie_tot), eos(eos_), rho(rho_), vfrac(vfrac_), sie(sie_), temp(temp_),
press(press_), Tnorm(Tnorm) {
jacobian = AssignIncrement(scratch, neq * neq);
dx = AssignIncrement(scratch, neq);
sol_scratch = AssignIncrement(scratch, 2 * neq);
Expand Down
4 changes: 2 additions & 2 deletions singularity-eos/eos/eos_gruneisen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,14 @@ PORTABLE_INLINE_FUNCTION Real Gruneisen::PressureFromDensityInternalEnergy(
template <typename Indexer_t>
PORTABLE_INLINE_FUNCTION Real
Gruneisen::MinInternalEnergyFromDensity(const Real rho_in, Indexer_t &&lambda) const {
const Real rho = std::min(rho_in, _rho_max);
// const Real rho = std::min(rho_in, _rho_max);
MinInternalEnergyIsNotEnabled("Gruneisen");
return 0.0;
}
template <typename Indexer_t>
PORTABLE_INLINE_FUNCTION Real Gruneisen::EntropyFromDensityInternalEnergy(
const Real rho_in, const Real sie, Indexer_t &&lambda) const {
const Real rho = std::min(rho_in, _rho_max);
// const Real rho = std::min(rho_in, _rho_max);
EntropyIsNotEnabled("Gruneisen");
return 1.0;
}
Expand Down
2 changes: 1 addition & 1 deletion singularity-eos/eos/eos_mgusup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ MGUsup::FillEos(Real &rho, Real &temp, Real &sie, Real &press, Real &cv, Real &b
}
if (output & thermalqs::temperature)
temp = TemperatureFromDensityInternalEnergy(rho, sie);
if (output & thermalqs::specific_internal_energy) sie = sie;
// if (output & thermalqs::specific_internal_energy) sie = sie;
if (output & thermalqs::pressure) press = PressureFromDensityInternalEnergy(rho, sie);
if (output & thermalqs::specific_heat)
cv = SpecificHeatFromDensityInternalEnergy(rho, sie);
Expand Down
2 changes: 1 addition & 1 deletion singularity-eos/eos/eos_powermg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ PowerMG::FillEos(Real &rho, Real &temp, Real &sie, Real &press, Real &cv, Real &
}
if (output & thermalqs::temperature)
temp = TemperatureFromDensityInternalEnergy(rho, sie);
if (output & thermalqs::specific_internal_energy) sie = sie;
// if (output & thermalqs::specific_internal_energy) sie = sie;
if (output & thermalqs::pressure) press = PressureFromDensityInternalEnergy(rho, sie);
if (output & thermalqs::specific_heat)
cv = SpecificHeatFromDensityInternalEnergy(rho, sie);
Expand Down
4 changes: 2 additions & 2 deletions singularity-eos/eos/eos_sap_polynomial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class SAP_Polynomial : public EosBase<SAP_Polynomial> {
SAP_Polynomial(const Real rho0, const Real a0, const Real a1, const Real a2c,
const Real a2e, const Real a3, const Real b0, const Real b1,
const Real b2c, const Real b2e, const Real b3)
: _rho0(rho0), _a0(a0), _a1(a1), _a2c(a2c), _a2e(a2e), _a3(a3), _b0(b0), _b1(b1),
_b2c(b2c), _b2e(b2e), _b3(b3) {
: _a0(a0), _a1(a1), _a2c(a2c), _a2e(a2e), _a3(a3), _b0(b0), _b1(b1), _b2c(b2c),
_b2e(b2e), _b3(b3), _rho0(rho0) {
CheckParams();
}

Expand Down
2 changes: 1 addition & 1 deletion singularity-eos/eos/eos_vinet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ Vinet::FillEos(Real &rho, Real &temp, Real &sie, Real &press, Real &cv, Real &bm
}
Real Vout[8];
Vinet_F_DT_func(rho, temp, Vout);
if (output & thermalqs::temperature) temp = temp;
// if (output & thermalqs::temperature) temp = temp;
if (output & thermalqs::specific_internal_energy) sie = Vout[0];
if (output & thermalqs::pressure) press = Vout[1];
if (output & thermalqs::specific_heat) cv = Vout[4];
Expand Down
14 changes: 11 additions & 3 deletions singularity-eos/eos/get_sg_eos_rho_e.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,18 @@ void get_sg_eos_rho_e(const char *name, int ncell, indirection_v &offsets_v,
// eos accessor
singularity::EOSAccessor_ eos_inx(eos_v, &pte_idxs(tid, 0));
// reset inputs
// JMM: Address sanitizer likes these named. My guess is
// that the forwarding references are not being resolved
// properly.
Real *prho_pte = &rho_pte(tid, 0);
Real *pvfrac_pte = &vfrac_pte(tid, 0);
Real *psie_pte = &sie_pte(tid, 0);
Real *ptemp_pte = &temp_pte(tid, 0);
Real *ppress_pte = &press_pte(tid, 0);
Real *pscratch = &solver_scratch(tid, 0);
PTESolverRhoT<singularity::EOSAccessor_, Real *, Real **> method(
npte, eos_inx, vfrac_sum, sie_v(i), &rho_pte(tid, 0), &vfrac_pte(tid, 0),
&sie_pte(tid, 0), &temp_pte(tid, 0), &press_pte(tid, 0), cache,
&solver_scratch(tid, 0));
npte, eos_inx, vfrac_sum, sie_v(i), prho_pte, pvfrac_pte, psie_pte,
ptemp_pte, ppress_pte, cache, pscratch);
auto status = PTESolver(method);
pte_converged = status.converged;
} else {
Expand Down
12 changes: 9 additions & 3 deletions singularity-eos/eos/get_sg_eos_rho_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,16 @@ void get_sg_eos_rho_p(const char *name, int ncell, indirection_v &offsets_v,
// create solver lambda
// eos accessor
singularity::EOSAccessor_ eos_inx(eos_v, &pte_idxs(tid, 0));
// JMM: Address sanitizer likes these named.
Real *prho_pte = &rho_pte(tid, 0);
Real *pvfrac_pte = &vfrac_pte(tid, 0);
Real *psie_pte = &sie_pte(tid, 0);
Real *ptemp_pte = &temp_pte(tid, 0);
Real *ppress_pte = &press_pte(tid, 0);
Real *pscratch = &solver_scratch(tid, 0);
PTESolverFixedP<singularity::EOSAccessor_, Real *, Real *> method(
npte, eos_inx, vfrac_sum, press_pte(tid, 0), &rho_pte(tid, 0),
&vfrac_pte(tid, 0), &sie_pte(tid, 0), &temp_pte(tid, 0), &press_pte(tid, 0),
cache[0], &solver_scratch(tid, 0));
npte, eos_inx, vfrac_sum, press_pte(tid, 0), prho_pte, pvfrac_pte, psie_pte,
ptemp_pte, ppress_pte, cache[0], pscratch);
auto status = PTESolver(method);
pte_converged = status.converged;
// calculate total sie
Expand Down
13 changes: 10 additions & 3 deletions singularity-eos/eos/get_sg_eos_rho_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,17 @@ void get_sg_eos_rho_t(const char *name, int ncell, indirection_v &offsets_v,
// create solver lambda
// eos accessor
singularity::EOSAccessor_ eos_inx(eos_v, &pte_idxs(tid, 0));
// JMM: Address sanitizer does not like passing these in
// through the function call.
Real *prho_pte = &rho_pte(tid, 0);
Real *pvfrac_pte = &vfrac_pte(tid, 0);
Real *psie_pte = &sie_pte(tid, 0);
Real *ptemp_pte = &temp_pte(tid, 0);
Real *ppress_pte = &press_pte(tid, 0);
Real *pscratch = &solver_scratch(tid, 0);
PTESolverFixedT<singularity::EOSAccessor_, Real *, Real **> method(
npte, eos_inx, vfrac_sum, temp_pte(tid, 0), &rho_pte(tid, 0),
&vfrac_pte(tid, 0), &sie_pte(tid, 0), &temp_pte(tid, 0), &press_pte(tid, 0),
cache, &solver_scratch(tid, 0));
npte, eos_inx, vfrac_sum, temp_pte(tid, 0), prho_pte, pvfrac_pte, psie_pte,
ptemp_pte, ppress_pte, cache, pscratch);
auto status = PTESolver(method);
pte_converged = status.converged;
// calculate total internal energy
Expand Down

0 comments on commit b8d4385

Please sign in to comment.