Skip to content
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

dholladay00/separate get sg eos #245

Merged
merged 57 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
289f39c
Initial commit on splitting out get_sg_eos to a separate compilation …
dholladay00 Mar 23, 2023
e56b44b
Merge main.
dholladay00 Mar 23, 2023
4c948da
format.
dholladay00 Mar 27, 2023
8ba8a2a
Included file locations moved to correct place, mixed cell models onl…
dholladay00 Mar 27, 2023
ef62d59
format
dholladay00 Mar 27, 2023
27a66ee
Merge branch 'main' into dholladay00/separate_get_sg_eos
dholladay00 Apr 17, 2023
fffa84c
Split get sg eos into several compilation units to reduce compile tim…
Apr 25, 2023
98ad54c
Fixing non-kokkos build issues.
dholladay00 Apr 25, 2023
4d35a16
Formatting.
dholladay00 Apr 25, 2023
da798cc
guard the nowarn.
dholladay00 Apr 25, 2023
c5df26b
remove erroneous pragma from copy-paste.
dholladay00 Apr 25, 2023
acd3349
Added missing portable function.
dholladay00 Apr 25, 2023
1fbcfac
More missing function decorators.
dholladay00 Apr 26, 2023
54dfeec
Minor syntax change to preprocessor logic.
dholladay00 Apr 26, 2023
de35b08
Make macro on new line.
dholladay00 Apr 26, 2023
7f1997a
The macro I created won't work b/c the pragma needs a new line and ne…
dholladay00 Apr 26, 2023
30de7d3
Removed commented out code, get rid of warnings, try to improve compi…
dholladay00 Apr 26, 2023
53ef4db
Remove rdc references in spackages and cmake files.
dholladay00 May 22, 2023
cf23fd5
Make modifier checking/modification functionality inline constexpr to…
dholladay00 May 22, 2023
e196b55
Reverting template parameters, this change was an incorrect change.
dholladay00 May 22, 2023
be1268d
Using execution space arguments for deep copies. This may not improve…
dholladay00 May 22, 2023
2080ef6
Merge main, resolve conflict.
dholladay00 May 22, 2023
ecff459
Format
dholladay00 May 22, 2023
52dc1c9
Make cuda builds release and everything else the default value of rel…
dholladay00 May 22, 2023
9151751
fix mistakes in gitlab changes.
dholladay00 May 23, 2023
3f2cbf9
Updating the cuda compatibility patch to make more usage of constexpr…
dholladay00 May 23, 2023
ea59f83
Moving to earlier cuda versions that passed tests.
dholladay00 May 23, 2023
1c284b2
Adding fences to see if asynchrony was source of issues.
dholladay00 May 23, 2023
946720c
Fixing test failure from setting mutable member in a GPU kernel which…
dholladay00 May 26, 2023
fc07762
format.
dholladay00 May 26, 2023
9b3bdb0
Undoing unneccessary changes.
dholladay00 May 26, 2023
7650792
use global var and anchor in gitlab-ci.yml
ktsai7 May 26, 2023
05231e9
Merge branch 'main' into dholladay00/separate_get_sg_eos
dholladay00 Jun 21, 2023
cc6e5d1
First pass at cleaning up unneccessary functionality in variadic utils.
dholladay00 Jun 28, 2023
4fd4cfd
Merge main.
dholladay00 Aug 3, 2023
63456b3
Only build the get_sg files when closure and (fortran or testing), sh…
dholladay00 Aug 3, 2023
f7736f8
Fix more warnings. Some related to capturing this in modifiers, this …
dholladay00 Aug 3, 2023
0aab253
Fix ci warnings + format.
dholladay00 Aug 4, 2023
1f77a51
try to fix warning.
dholladay00 Aug 4, 2023
1d4fc85
Remove unused variables.
dholladay00 Aug 4, 2023
3748a69
Merge branch 'main' into dholladay00/separate_get_sg_eos
dholladay00 Aug 4, 2023
0dd0268
format.
dholladay00 Aug 4, 2023
ed4e55a
Merge branch 'main' into dholladay00/separate_get_sg_eos
dholladay00 Aug 8, 2023
9774621
Test refactor. The getsgeos tests are now in their own file that resp…
dholladay00 Aug 14, 2023
c9823d2
Merge branch 'main' into dholladay00/separate_get_sg_eos
dholladay00 Aug 14, 2023
bdf02e3
Format.
dholladay00 Aug 14, 2023
a77b090
Switch from lambdas with macros to functors.
dholladay00 Aug 15, 2023
0e37800
Merg main.
dholladay00 Aug 15, 2023
4179042
Merge branch 'main' into dholladay00/cleanup_variadic
dholladay00 Aug 15, 2023
7129f96
Merge branch 'dholladay00/cleanup_variadic' into dholladay00/separate…
dholladay00 Aug 15, 2023
ff334d2
Using individual functions instead of ptofre, this was the source of …
dholladay00 Aug 15, 2023
4b6c859
Change file name to reflect move from lambdas to functors.
dholladay00 Aug 15, 2023
a225052
Remove unused variables.
dholladay00 Aug 15, 2023
5ad4058
Merge branch 'main' into dholladay00/separate_get_sg_eos
dholladay00 Aug 15, 2023
55ceed2
format.
dholladay00 Aug 15, 2023
305f7e6
Correct cmake logic for get_sg_eos. Previously, built with closure an…
dholladay00 Aug 16, 2023
ed5a121
Edit changelog.
dholladay00 Aug 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions singularity-eos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#------------------------------------------------------------------------------#

set(EOS_HEADERS
closure/mixed_cell_models.hpp
base/fast-math/logs.hpp
base/robust_utils.hpp
base/root-finding-1d/root_finding.hpp
Expand Down Expand Up @@ -47,12 +46,22 @@ set(EOS_SRCS
)

if (SINGULARITY_BUILD_CLOSURE)
list(APPEND EOS_SRCS eos/singularity_eos.cpp)
list(APPEND EOS_HEADERS eos/singularity_eos.hpp closure/mixed_cell_models.hpp)
list(APPEND EOS_SRCS
eos/get_sg_eos_p_t.cpp
eos/get_sg_eos_rho_t.cpp
eos/get_sg_eos_rho_p.cpp
eos/get_sg_eos_rho_e.cpp
eos/get_sg_eos.cpp)
list(APPEND EOS_HEADERS
closure/mixed_cell_models.hpp
eos/get_sg_eos.hpp
eos/get_sg_eos_lambdas.hpp)
endif()

if (SINGULARITY_USE_FORTRAN)
list(APPEND EOS_SRCS eos/singularity_eos.f90)
list(APPEND EOS_SRCS eos/singularity_eos.cpp)
list(APPEND EOS_HEADERS eos/singularity_eos.hpp)
# would rather handle this more robustly, being sloppy for now
list(APPEND EOS_MODS singularity_eos.mod singularity_eos_types.mod)
endif()
Expand Down
2 changes: 1 addition & 1 deletion singularity-eos/eos/eos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace singularity {
template <typename... Ts>
using tl = singularity::detail::type_list<Ts...>;

template <template <typename> typename... Ts>
template <template <typename> class... Ts>
using al = singularity::detail::adapt_list<Ts...>;

// transform variadic list: applies modifiers to eos's
Expand Down
70 changes: 37 additions & 33 deletions singularity-eos/eos/eos_eospac.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,42 +41,46 @@ using namespace eos_base;

// Only really works in serial
// Not really supported on device
#define SG_PIF_NOWARN \
#pragma nv_exec_check_disable \
PORTABLE_INLINE_FUNCTION

Yurlungur marked this conversation as resolved.
Show resolved Hide resolved
class EOSPAC : public EosBase<EOSPAC> {
public:
inline EOSPAC() = default;
inline EOSPAC(int matid, bool invert_at_setup = false);
inline EOSPAC GetOnDevice() { return *this; }
PORTABLE_INLINE_FUNCTION Real TemperatureFromDensityInternalEnergy(
SG_PIF_NOWARN Real TemperatureFromDensityInternalEnergy(
const Real rho, const Real sie, Real *lambda = nullptr) const;
PORTABLE_INLINE_FUNCTION Real InternalEnergyFromDensityTemperature(
SG_PIF_NOWARN Real InternalEnergyFromDensityTemperature(
const Real rho, const Real temperature, Real *lambda = nullptr) const;
PORTABLE_INLINE_FUNCTION Real PressureFromDensityTemperature(
SG_PIF_NOWARN Real PressureFromDensityTemperature(
const Real rho, const Real temperature, Real *lambda = nullptr) const;
PORTABLE_INLINE_FUNCTION Real PressureFromDensityInternalEnergy(
SG_PIF_NOWARN Real PressureFromDensityInternalEnergy(
const Real rho, const Real sie, Real *lambda = nullptr) const;
PORTABLE_INLINE_FUNCTION Real EntropyFromDensityTemperature(
SG_PIF_NOWARN Real EntropyFromDensityTemperature(
const Real rho, const Real temperature, Real *lambda = nullptr) const;
PORTABLE_INLINE_FUNCTION Real EntropyFromDensityInternalEnergy(
SG_PIF_NOWARN Real EntropyFromDensityInternalEnergy(
const Real rho, const Real sie, Real *lambda = nullptr) const;
PORTABLE_INLINE_FUNCTION Real SpecificHeatFromDensityTemperature(
SG_PIF_NOWARN Real SpecificHeatFromDensityTemperature(
const Real rho, const Real temperature, Real *lambda = nullptr) const;
PORTABLE_INLINE_FUNCTION Real SpecificHeatFromDensityInternalEnergy(
SG_PIF_NOWARN Real SpecificHeatFromDensityInternalEnergy(
const Real rho, const Real sie, Real *lambda = nullptr) const;
PORTABLE_INLINE_FUNCTION Real BulkModulusFromDensityTemperature(
SG_PIF_NOWARN Real BulkModulusFromDensityTemperature(
const Real rho, const Real temperature, Real *lambda = nullptr) const;
PORTABLE_INLINE_FUNCTION Real BulkModulusFromDensityInternalEnergy(
SG_PIF_NOWARN Real BulkModulusFromDensityInternalEnergy(
const Real rho, const Real sie, Real *lambda = nullptr) const;
PORTABLE_INLINE_FUNCTION Real GruneisenParamFromDensityTemperature(
SG_PIF_NOWARN Real GruneisenParamFromDensityTemperature(
const Real rho, const Real temperature, Real *lambda = nullptr) const;
PORTABLE_INLINE_FUNCTION Real GruneisenParamFromDensityInternalEnergy(
SG_PIF_NOWARN Real GruneisenParamFromDensityInternalEnergy(
const Real rho, const Real sie, Real *lambda = nullptr) const;
PORTABLE_INLINE_FUNCTION void FillEos(Real &rho, Real &temp, Real &energy, Real &press,
SG_PIF_NOWARN void FillEos(Real &rho, Real &temp, Real &energy, Real &press,
Real &cv, Real &bmod, const unsigned long output,
Real *lambda = nullptr) const;
PORTABLE_INLINE_FUNCTION
SG_PIF_NOWARN
void DensityEnergyFromPressureTemperature(const Real press, const Real temp,
Real *lambda, Real &rho, Real &sie) const;
PORTABLE_INLINE_FUNCTION void ValuesAtReferenceState(Real &rho, Real &temp, Real &sie,
SG_PIF_NOWARN void ValuesAtReferenceState(Real &rho, Real &temp, Real &sie,
Real &press, Real &cv, Real &bmod,
Real &dpde, Real &dvdt,
Real *lambda = nullptr) const;
Expand Down Expand Up @@ -661,7 +665,7 @@ class EOSPAC : public EosBase<EOSPAC> {
});
}

PORTABLE_INLINE_FUNCTION
SG_PIF_NOWARN
void PTofRE(Real &rho, Real &sie, Real *lambda, Real &press, Real &temp, Real &dpdr,
Real &dpde, Real &dtdr, Real &dtde) const {

Expand Down Expand Up @@ -698,11 +702,11 @@ class EOSPAC : public EosBase<EOSPAC> {
}

static constexpr unsigned long PreferredInput() { return _preferred_input; }
PORTABLE_INLINE_FUNCTION int nlambda() const noexcept { return 0; }
SG_PIF_NOWARN int nlambda() const noexcept { return 0; }
inline void Finalize() {}
static std::string EosType() { return std::string("EOSPAC"); }
static std::string EosPyType() { return EosType(); }
inline void PrintParams() const { printf("EOSPAC parameters:\nmatid = %s\n", matid_); }
SG_PIF_NOWARN void PrintParams() const { printf("EOSPAC parameters:\nmatid = %i\n", matid_); }
PORTABLE_FORCEINLINE_FUNCTION Real MinimumDensity() const { return rho_min_; }
PORTABLE_FORCEINLINE_FUNCTION Real MinimumTemperature() const { return temp_min_; }

Expand Down Expand Up @@ -796,7 +800,7 @@ inline EOSPAC::EOSPAC(const int matid, bool invert_at_setup) : matid_(matid) {
robust::ratio(dpde_ref_ * cv_ref_, rho_ref_ * rho_ref_ * pressureFromSesame(DPDR));
}

PORTABLE_INLINE_FUNCTION Real EOSPAC::TemperatureFromDensityInternalEnergy(
SG_PIF_NOWARN Real EOSPAC::TemperatureFromDensityInternalEnergy(
const Real rho, const Real sie, Real *lambda) const {
using namespace EospacWrapper;
EOS_REAL R[1] = {rho}, E[1] = {sieToSesame(sie)}, T[1], dTdr[1], dTde[1];
Expand All @@ -806,7 +810,7 @@ PORTABLE_INLINE_FUNCTION Real EOSPAC::TemperatureFromDensityInternalEnergy(
return Real(temperatureFromSesame(T[0]));
}

PORTABLE_INLINE_FUNCTION Real EOSPAC::PressureFromDensityTemperature(const Real rho,
SG_PIF_NOWARN Real EOSPAC::PressureFromDensityTemperature(const Real rho,
const Real temp,
Real *lambda) const {
using namespace EospacWrapper;
Expand All @@ -817,13 +821,13 @@ PORTABLE_INLINE_FUNCTION Real EOSPAC::PressureFromDensityTemperature(const Real
return Real(pressureFromSesame(P[0]));
}

PORTABLE_INLINE_FUNCTION Real EOSPAC::EntropyFromDensityTemperature(
SG_PIF_NOWARN Real EOSPAC::EntropyFromDensityTemperature(
const Real rho, const Real temperature, Real *lambda) const {
EntropyIsNotEnabled("EOSPAC");
return 1.0;
}

PORTABLE_INLINE_FUNCTION void EOSPAC::FillEos(Real &rho, Real &temp, Real &sie,
SG_PIF_NOWARN void EOSPAC::FillEos(Real &rho, Real &temp, Real &sie,
Real &press, Real &cv, Real &bmod,
const unsigned long output,
Real *lambda) const {
Expand Down Expand Up @@ -906,56 +910,56 @@ PORTABLE_INLINE_FUNCTION void EOSPAC::FillEos(Real &rho, Real &temp, Real &sie,
}
}

PORTABLE_INLINE_FUNCTION Real EOSPAC::InternalEnergyFromDensityTemperature(
SG_PIF_NOWARN Real EOSPAC::InternalEnergyFromDensityTemperature(
const Real rho, const Real temp, Real *lambda) const {
using namespace EospacWrapper;
Real RHO = rho, TEMP = temp, sie, press, cv, bmod;
const unsigned long output = thermalqs::specific_internal_energy;
FillEos(RHO, TEMP, sie, press, cv, bmod, output, lambda);
return sie;
}
PORTABLE_INLINE_FUNCTION Real EOSPAC::BulkModulusFromDensityTemperature(
SG_PIF_NOWARN Real EOSPAC::BulkModulusFromDensityTemperature(
const Real rho, const Real temp, Real *lambda) const {
using namespace EospacWrapper;
Real RHO = rho, TEMP = temp, sie, press, cv, bmod;
const unsigned long output = thermalqs::bulk_modulus;
FillEos(RHO, TEMP, sie, press, cv, bmod, output, lambda);
return bmod;
}
PORTABLE_INLINE_FUNCTION Real EOSPAC::SpecificHeatFromDensityTemperature(
SG_PIF_NOWARN Real EOSPAC::SpecificHeatFromDensityTemperature(
const Real rho, const Real temp, Real *lambda) const {
using namespace EospacWrapper;
Real RHO = rho, TEMP = temp, sie, press, cv, bmod;
const unsigned long output = thermalqs::specific_heat;
FillEos(RHO, TEMP, sie, press, cv, bmod, output, lambda);
return cv;
}
PORTABLE_INLINE_FUNCTION Real EOSPAC::PressureFromDensityInternalEnergy(
SG_PIF_NOWARN Real EOSPAC::PressureFromDensityInternalEnergy(
const Real rho, const Real sie, Real *lambda) const {
using namespace EospacWrapper;
Real temp = TemperatureFromDensityInternalEnergy(rho, sie, lambda);
return PressureFromDensityTemperature(rho, temp, lambda);
}
PORTABLE_INLINE_FUNCTION Real EOSPAC::EntropyFromDensityInternalEnergy(
SG_PIF_NOWARN Real EOSPAC::EntropyFromDensityInternalEnergy(
const Real rho, const Real sie, Real *lambda) const {
using namespace EospacWrapper;
const Real temp = TemperatureFromDensityInternalEnergy(rho, sie, lambda);
return EntropyFromDensityTemperature(rho, temp, lambda);
}
PORTABLE_INLINE_FUNCTION Real EOSPAC::SpecificHeatFromDensityInternalEnergy(
SG_PIF_NOWARN Real EOSPAC::SpecificHeatFromDensityInternalEnergy(
const Real rho, const Real sie, Real *lambda) const {
using namespace EospacWrapper;
Real temp = TemperatureFromDensityInternalEnergy(rho, sie, lambda);
return SpecificHeatFromDensityTemperature(rho, temp, lambda);
}
PORTABLE_INLINE_FUNCTION Real EOSPAC::BulkModulusFromDensityInternalEnergy(
SG_PIF_NOWARN Real EOSPAC::BulkModulusFromDensityInternalEnergy(
const Real rho, const Real sie, Real *lambda) const {
using namespace EospacWrapper;
Real temp = TemperatureFromDensityInternalEnergy(rho, sie, lambda);
return BulkModulusFromDensityTemperature(rho, temp, lambda);
}

PORTABLE_INLINE_FUNCTION Real EOSPAC::GruneisenParamFromDensityTemperature(
SG_PIF_NOWARN Real EOSPAC::GruneisenParamFromDensityTemperature(
const Real rho, const Real temperature, Real *lambda) const {
using namespace EospacWrapper;
EOS_REAL R[1] = {rho}, T[1] = {temperatureToSesame(temperature)};
Expand All @@ -971,13 +975,13 @@ PORTABLE_INLINE_FUNCTION Real EOSPAC::GruneisenParamFromDensityTemperature(
DPDE = DPDT / DEDT;
return robust::ratio(pressureFromSesame(sieToSesame(DPDE)), rho);
}
PORTABLE_INLINE_FUNCTION Real EOSPAC::GruneisenParamFromDensityInternalEnergy(
SG_PIF_NOWARN Real EOSPAC::GruneisenParamFromDensityInternalEnergy(
const Real rho, const Real sie, Real *lambda) const {
Real temperature = TemperatureFromDensityInternalEnergy(rho, sie, lambda);
return GruneisenParamFromDensityTemperature(rho, temperature, lambda);
}

PORTABLE_INLINE_FUNCTION
SG_PIF_NOWARN
void EOSPAC::DensityEnergyFromPressureTemperature(const Real press, const Real temp,
Real *lambda, Real &rho,
Real &sie) const {
Expand All @@ -998,7 +1002,7 @@ void EOSPAC::DensityEnergyFromPressureTemperature(const Real press, const Real t
sie = sieFromSesame(E[0]);
}

PORTABLE_INLINE_FUNCTION void
SG_PIF_NOWARN void
EOSPAC::ValuesAtReferenceState(Real &rho, Real &temp, Real &sie, Real &press, Real &cv,
Real &bmod, Real &dpde, Real &dvdt, Real *lambda) const {
using namespace EospacWrapper;
Expand Down
Loading