From cf7eb13f40357cfab3e47e84e704e121df9ed800 Mon Sep 17 00:00:00 2001 From: Benjamin Ransom Ryan Date: Wed, 25 Sep 2024 08:40:53 -0600 Subject: [PATCH 01/14] power law opacity --- .../photons/powerlaw_opacity_photons.hpp | 181 ++++++++++++++++++ utils/spiner | 2 +- 2 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 singularity-opac/photons/powerlaw_opacity_photons.hpp diff --git a/singularity-opac/photons/powerlaw_opacity_photons.hpp b/singularity-opac/photons/powerlaw_opacity_photons.hpp new file mode 100644 index 0000000..f512757 --- /dev/null +++ b/singularity-opac/photons/powerlaw_opacity_photons.hpp @@ -0,0 +1,181 @@ +// ====================================================================== +// © 2024. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract +// 89233218CNA000001 for Los Alamos National Laboratory (LANL), which +// is operated by Triad National Security, LLC for the U.S. +// Department of Energy/National Nuclear Security Administration. All +// rights in the program are reserved by Triad National Security, LLC, +// and the U.S. Department of Energy/National Nuclear Security +// Administration. The Government is granted for itself and others +// acting on its behalf a nonexclusive, paid-up, irrevocable worldwide +// license in this material to reproduce, prepare derivative works, +// distribute copies to the public, perform publicly and display +// publicly, and to permit others to do so. +// ====================================================================== + +#ifndef SINGULARITY_OPAC_PHOTONS_POWERLAW_OPACITY_PHOTONS_ +#define SINGULARITY_OPAC_PHOTONS_POWERLAW_OPACITY_PHOTONS_ + +#include +#include +#include + +#include +#include +#include + +namespace singularity { +namespace photons { + +template +class PowerLawOpacity { + public: + PowerLawOpacity() = default; + PowerLawOpacity(const Real kappa0, const Real A, const Real B) + : kappa0_(kappa0), A_(A), B_(B) {} + PowerLawOpacity(const PlanckDistribution &dist, const Real kappa0, + const Real A, const Real B) + : dist_(dist), kappa0_(kappa0), A_(A), B_(B) {} + + GrayOpacity GetOnDevice() { return *this; } + PORTABLE_INLINE_FUNCTION + int nlambda() const noexcept { return 0; } + PORTABLE_INLINE_FUNCTION + void PrintParams() const noexcept { + printf("Power law opacity. kappa0 = %g A = %g B = %g\n", kappa0_, A_, B_); + } + inline void Finalize() noexcept {} + + PORTABLE_INLINE_FUNCTION + Real AbsorptionCoefficient(const Real rho, const Real temp, const Real nu, + Real *lambda = nullptr) const { + return dist_.AbsorptionCoefficientFromKirkhoff(*this, rho, temp, nu, + lambda); + } + + template + PORTABLE_INLINE_FUNCTION void + AbsorptionCoefficient(const Real rho, const Real temp, + FrequencyIndexer &nu_bins, DataIndexer &coeffs, + const int nbins, Real *lambda = nullptr) const { + for (int i = 0; i < nbins; ++i) { + coeffs[i] = AbsorptionCoefficient(rho, temp, nu_bins[i], lambda); + } + } + + PORTABLE_INLINE_FUNCTION + Real AngleAveragedAbsorptionCoefficient(const Real rho, const Real temp, + const Real nu, + Real *lambda = nullptr) const { + return dist_.AngleAveragedAbsorptionCoefficientFromKirkhoff( + *this, rho, temp, nu, lambda); + } + + template + PORTABLE_INLINE_FUNCTION void AngleAveragedAbsorptionCoefficient( + const Real rho, const Real temp, FrequencyIndexer &nu_bins, + DataIndexer &coeffs, const int nbins, Real *lambda = nullptr) const { + for (int i = 0; i < nbins; ++i) { + coeffs[i] = + AngleAveragedAbsorptionCoefficient(rho, temp, nu_bins[i], lambda); + } + } + + PORTABLE_INLINE_FUNCTION + Real EmissivityPerNuOmega(const Real rho, const Real temp, const Real nu, + Real *lambda = nullptr) const { + Real Bnu = dist_.ThermalDistributionOfTNu(temp, nu, lambda); + return rho * (kappa0_ * std::pow(rho, A_) * std::pow(temp, B_) * Bnu; + } + + template + PORTABLE_INLINE_FUNCTION void + EmissivityPerNuOmega(const Real rho, const Real temp, + FrequencyIndexer &nu_bins, DataIndexer &coeffs, + const int nbins, Real *lambda = nullptr) const { + for (int i = 0; i < nbins; ++i) { + coeffs[i] = EmissivityPerNuOmega(rho, temp, nu_bins[i], lambda); + } + } + + PORTABLE_INLINE_FUNCTION + Real EmissivityPerNu(const Real rho, const Real temp, const Real nu, + Real *lambda = nullptr) const { + return 4 * M_PI * EmissivityPerNuOmega(rho, temp, nu, lambda); + } + + template + PORTABLE_INLINE_FUNCTION void + EmissivityPerNu(const Real rho, const Real temp, FrequencyIndexer &nu_bins, + DataIndexer &coeffs, const int nbins, + Real *lambda = nullptr) const { + for (int i = 0; i < nbins; ++i) { + coeffs[i] = EmissivityPerNu(rho, temp, nu_bins[i], lambda); + } + } + + PORTABLE_INLINE_FUNCTION + Real Emissivity(const Real rho, const Real temp, + Real *lambda = nullptr) const { + Real B = dist_.ThermalDistributionOfT(temp, lambda); + return rho * (kappa0_ * std::pow(rho, A_) * std::pow(temp, B_)) * B; + } + + PORTABLE_INLINE_FUNCTION + Real NumberEmissivity(const Real rho, const Real temp, + Real *lambda = nullptr) const { + return (kappa0_ * std::pow(rho, A_) * std::pow(temp, B_)) * + dist_.ThermalNumberDistributionOfT(temp, lambda); + } + + PORTABLE_INLINE_FUNCTION + Real ThermalDistributionOfTNu(const Real temp, const Real nu, + Real *lambda = nullptr) const { + return dist_.ThermalDistributionOfTNu(temp, nu, lambda); + } + + PORTABLE_INLINE_FUNCTION + Real DThermalDistributionOfTNuDT(const Real temp, const Real nu, + Real *lambda = nullptr) const { + return dist_.DThermalDistributionOfTNuDT(temp, nu, lambda); + } + + PORTABLE_INLINE_FUNCTION + Real ThermalDistributionOfT(const Real temp, Real *lambda = nullptr) const { + return dist_.ThermalDistributionOfT(temp, lambda); + } + + PORTABLE_INLINE_FUNCTION Real + ThermalNumberDistributionOfT(const Real temp, Real *lambda = nullptr) const { + return dist_.ThermalNumberDistributionOfT(temp, lambda); + } + + PORTABLE_INLINE_FUNCTION + Real EnergyDensityFromTemperature(const Real temp, + Real *lambda = nullptr) const { + return dist_.EnergyDensityFromTemperature(temp, lambda); + } + + PORTABLE_INLINE_FUNCTION + Real TemperatureFromEnergyDensity(const Real er, + Real *lambda = nullptr) const { + return dist_.TemperatureFromEnergyDensity(er, lambda); + } + + PORTABLE_INLINE_FUNCTION + Real NumberDensityFromTemperature(const Real temp, + Real *lambda = nullptr) const { + return dist_.NumberDensityFromTemperature(temp, lambda); + } + + private: + Real kappa0_; // Opacity scale. Units of cm^2/g + Real A_; // Power law index of density + Real B_; // Power law index of temperature + PlanckDistribution dist_; +}; + +} // namespace photons +} // namespace singularity + +#endif // SINGULARITY_OPAC_PHOTONS_POWERLAW_OPACITY_PHOTONS_ diff --git a/utils/spiner b/utils/spiner index 33862f8..cadaf1e 160000 --- a/utils/spiner +++ b/utils/spiner @@ -1 +1 @@ -Subproject commit 33862f831be65e2dd2284b42f05c477b6fe7367a +Subproject commit cadaf1e3f759251176f58cec0961093ae9019a18 From b195ff02887e046aafe5a5841f5a3c89b41a0dcd Mon Sep 17 00:00:00 2001 From: Benjamin Ransom Ryan Date: Wed, 25 Sep 2024 10:18:08 -0600 Subject: [PATCH 02/14] fix spiner version --- test/CMakeLists.txt | 3 +- test/test_powerlaw_opacities.cpp | 323 +++++++++++++++++++++++++++++++ utils/spiner | 2 +- 3 files changed, 326 insertions(+), 2 deletions(-) create mode 100644 test/test_powerlaw_opacities.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 06f6a86..47f13e3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -39,9 +39,10 @@ PRIVATE test_thermal_dist.cpp test_scalefree_opacities.cpp test_gray_opacities.cpp - test_epbremsstrahlung_opacities.cpp test_gray_s_opacities.cpp + test_epbremsstrahlung_opacities.cpp test_brt_opacities.cpp + test_powerlaw_opacities.cpp test_thomson_s_opacities.cpp test_chebyshev.cpp test_spiner_opac_neutrinos.cpp diff --git a/test/test_powerlaw_opacities.cpp b/test/test_powerlaw_opacities.cpp new file mode 100644 index 0000000..5ea4313 --- /dev/null +++ b/test/test_powerlaw_opacities.cpp @@ -0,0 +1,323 @@ +// ====================================================================== +// © 2024. Triad National Security, LLC. All rights reserved. This +// program was produced under U.S. Government contract +// 89233218CNA000001 for Los Alamos National Laboratory (LANL), which +// is operated by Triad National Security, LLC for the U.S. +// Department of Energy/National Nuclear Security Administration. All +// rights in the program are reserved by Triad National Security, LLC, +// and the U.S. Department of Energy/National Nuclear Security +// Administration. The Government is granted for itself and others +// acting on its behalf a nonexclusive, paid-up, irrevocable worldwide +// license in this material to reproduce, prepare derivative works, +// distribute copies to the public, perform publicly and display +// publicly, and to permit others to do so. +// ====================================================================== + +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +using namespace singularity; + +using pc = PhysicalConstantsCGS; +using DataBox = Spiner::DataBox; + +#ifdef PORTABILITY_STRATEGY_KOKKOS +using atomic_view = Kokkos::MemoryTraits; +#endif + +template +PORTABLE_INLINE_FUNCTION T FractionalDifference(const T &a, const T &b) { + return 2 * std::abs(b - a) / (std::abs(a) + std::abs(b) + 1e-20); +} +constexpr Real EPS_TEST = 1e-3; + +TEST_CASE("Power law photon opacities", "[PowerLawPhotonOpacities]") { + WHEN("We initialize a power law photon opacity") { + constexpr Real rho = 1.e0; // g/cc + constexpr Real temp = 1.e3; // K + constexpr Real nu = 1.e14; // Hz + + photons::PowerLaw opac_host(1); + photons::Opacity opac = opac_host.GetOnDevice(); + + THEN("The emissivity per nu omega is consistent with the emissity per nu") { + int n_wrong_h = 0; +#ifdef PORTABILITY_STRATEGY_KOKKOS + Kokkos::View n_wrong_d("wrong"); +#else + PortableMDArray n_wrong_d(&n_wrong_h, 1); +#endif + + portableFor( + "calc emissivities", 0, 100, PORTABLE_LAMBDA(const int &i) { + Real jnu = opac.EmissivityPerNuOmega(rho, temp, Ye, type, nu); + Real Jnu = opac.EmissivityPerNu(rho, temp, Ye, type, nu); + if (FractionalDifference(Jnu, 4 * M_PI * jnu) > EPS_TEST) { + n_wrong_d() += 1; + } + }); + +#ifdef PORTABILITY_STRATEGY_KOKKOS + Kokkos::deep_copy(n_wrong_h, n_wrong_d); +#endif + REQUIRE(n_wrong_h == 0); + } + + WHEN("We create a gray opacity object in non-cgs units") { + constexpr Real time_unit = 123; + constexpr Real mass_unit = 456; + constexpr Real length_unit = 789; + constexpr Real temp_unit = 276; + constexpr Real rho_unit = + mass_unit / (length_unit * length_unit * length_unit); + constexpr Real j_unit = mass_unit / (length_unit * time_unit * time_unit); + neutrinos::Opacity funny_units_host = + neutrinos::NonCGSUnits( + neutrinos::Gray(1), time_unit, mass_unit, length_unit, temp_unit); + auto funny_units = funny_units_host.GetOnDevice(); + + THEN("We can convert meaningfully into and out of funny units") { + int n_wrong_h = 0; +#ifdef PORTABILITY_STRATEGY_KOKKOS + Kokkos::View n_wrong_d("wrong"); +#else + PortableMDArray n_wrong_d(&n_wrong_h, 1); +#endif + + portableFor( + "emissivities in funny units", 0, 100, + PORTABLE_LAMBDA(const int &i) { + Real jnu_funny = funny_units.EmissivityPerNuOmega( + rho / rho_unit, temp / temp_unit, Ye, type, nu * time_unit); + Real jnu = opac.EmissivityPerNuOmega(rho, temp, Ye, type, nu); + if (FractionalDifference(jnu, jnu_funny * j_unit) > EPS_TEST) { + n_wrong_d() += 1; + } + }); +#ifdef PORTABILITY_STRATEGY_KOKKOS + Kokkos::deep_copy(n_wrong_h, n_wrong_d); +#endif + REQUIRE(n_wrong_h == 0); + } + } + + THEN("We can fill an indexer allocated in a cell") { + int n_wrong_h = 0; +#ifdef PORTABILITY_STRATEGY_KOKKOS + Kokkos::View n_wrong_d("wrong"); +#else + PortableMDArray n_wrong_d(&n_wrong_h, 1); +#endif + constexpr int nbins = 9; + constexpr int ntemps = 100; + + Real lnu_min = 0 + std::log10(MeV2Hz); + Real lnu_max = 1 + std::log10(MeV2Hz); + Real nu_min = std::pow(10, lnu_min); + Real nu_max = std::pow(10, lnu_max); + + constexpr Real lt_min = -1; + constexpr Real lt_max = 2; + Real dt = (lt_max - lt_min) / (Real)(ntemps - 1); + + Real *nu_bins = (Real *)PORTABLE_MALLOC(nbins * sizeof(Real)); + Real *lnu_bins = (Real *)PORTABLE_MALLOC(nbins * sizeof(Real)); + Real *temp_bins = (Real *)PORTABLE_MALLOC(ntemps * sizeof(Real)); + portableFor( + "set nu bins", 0, 1, PORTABLE_LAMBDA(const int &i) { + chebyshev::GetPoints(lnu_min, lnu_max, nbins, lnu_bins); + for (int j = 0; j < nbins; ++j) { + nu_bins[j] = std::pow(10, lnu_bins[j]); + } + }); + portableFor( + "set temp bins", 0, ntemps, PORTABLE_LAMBDA(const int &i) { + temp_bins[i] = std::pow(10, lt_min + dt * i) * MeV2K; + }); + + Real *vm9 = (Real *)PORTABLE_MALLOC(9 * 9 * sizeof(Real)); + portableFor( + "Fill vm", 0, 1, + PORTABLE_LAMBDA(const int &i) { chebyshev::get_vmbox(vm9); }); + + portableFor( + "Fill the indexers", 0, ntemps, PORTABLE_LAMBDA(const int &i) { + Real temp = temp_bins[i]; + + Real *nu_data = (Real *)malloc(nbins * sizeof(Real)); + Real *lnu_data = (Real *)malloc(nbins * sizeof(Real)); + Real *nu_coeffs = (Real *)malloc(nbins * sizeof(Real)); + indexers::LogCheb J_cheb(nu_data, lnu_data, + nu_coeffs, nu_min, nu_max); + opac.EmissivityPerNu(rho, temp, Ye, type, nu_bins, J_cheb, nbins); + Real Jtrue = opac.EmissivityPerNu(rho, temp, Ye, type, nu); + J_cheb.SetInterpCoeffs(DataBox(vm9, 9, 9)); + if (std::isnan(J_cheb(nu)) || + ((std::abs(Jtrue) >= 1e-14 || J_cheb(nu) >= 1e-14) && + FractionalDifference(J_cheb(nu), Jtrue) > EPS_TEST)) { + n_wrong_d() += 1; + } + free(nu_data); + free(lnu_data); + free(nu_coeffs); + }); + +#ifdef PORTABILITY_STRATEGY_KOKKOS + Kokkos::deep_copy(n_wrong_h, n_wrong_d); +#endif + + REQUIRE(n_wrong_h == 0); + + PORTABLE_FREE(vm9); + PORTABLE_FREE(nu_bins); + PORTABLE_FREE(lnu_bins); + PORTABLE_FREE(temp_bins); + } + + opac.Finalize(); + } +} + +TEST_CASE("Gray photon opacities", "[GrayPhotons]") { + WHEN("We initialize a gray photon opacity") { + constexpr Real rho = 1e3; // g/cc. + constexpr Real temp = 1e5; // Kelvin. + constexpr Real nu = 3e9; // Hz. UHF microwave + + photons::Opacity opac_host = photons::Gray(1); + photons::Opacity opac = opac_host.GetOnDevice(); + THEN("The emissivity per nu omega is consistent with the emissity per nu") { + int n_wrong_h = 0; +#ifdef PORTABILITY_STRATEGY_KOKKOS + Kokkos::View n_wrong_d("wrong"); +#else + PortableMDArray n_wrong_d(&n_wrong_h, 1); +#endif + portableFor( + "calc emissivities", 0, 100, PORTABLE_LAMBDA(const int &i) { + Real jnu = opac.EmissivityPerNuOmega(rho, temp, nu); + Real Jnu = opac.EmissivityPerNu(rho, temp, nu); + if (FractionalDifference(Jnu, 4 * M_PI * jnu) > EPS_TEST) { + n_wrong_d() += 1; + } + }); +#ifdef PORTABILITY_STRATEGY_KOKKOS + Kokkos::deep_copy(n_wrong_h, n_wrong_d); +#endif + REQUIRE(n_wrong_h == 0); + } + + WHEN("We create a gray opacity object in non-cgs units") { + constexpr Real time_unit = 123; + constexpr Real mass_unit = 456; + constexpr Real length_unit = 789; + constexpr Real temp_unit = 276; + constexpr Real rho_unit = + mass_unit / (length_unit * length_unit * length_unit); + constexpr Real j_unit = mass_unit / (length_unit * time_unit * time_unit); + photons::Opacity funny_units_host = photons::NonCGSUnits( + photons::Gray(1), time_unit, mass_unit, length_unit, temp_unit); + auto funny_units = funny_units_host.GetOnDevice(); + + THEN("We can convert meaningfully into and out of funny units") { + int n_wrong_h = 0; +#ifdef PORTABILITY_STRATEGY_KOKKOS + Kokkos::View n_wrong_d("wrong"); +#else + PortableMDArray n_wrong_d(&n_wrong_h, 1); +#endif + + portableFor( + "emissivities in funny units", 0, 100, + PORTABLE_LAMBDA(const int &i) { + Real jnu_funny = funny_units.EmissivityPerNuOmega( + rho / rho_unit, temp / temp_unit, nu * time_unit); + Real jnu = opac.EmissivityPerNuOmega(rho, temp, nu); + if (FractionalDifference(jnu, jnu_funny * j_unit) > EPS_TEST) { + n_wrong_d() += 1; + } + }); +#ifdef PORTABILITY_STRATEGY_KOKKOS + Kokkos::deep_copy(n_wrong_h, n_wrong_d); +#endif + REQUIRE(n_wrong_h == 0); + } + } + + THEN("We can fill an indexer allocated in a cell") { + int n_wrong_h = 0; +#ifdef PORTABILITY_STRATEGY_KOKKOS + Kokkos::View n_wrong_d("wrong"); +#else + PortableMDArray n_wrong_d(&n_wrong_h, 1); +#endif + constexpr int nbins = 100; + constexpr int ntemps = 100; + + constexpr Real lnu_min = 8; + constexpr Real lnu_max = 10; + Real nu_min = std::pow(10, lnu_min); + Real nu_max = std::pow(10, lnu_max); + Real dnu = (lnu_max - lnu_min) / (Real)(nbins - 1); + + constexpr Real lt_min = 2; + constexpr Real lt_max = 4; + Real dt = (lt_max - lt_min) / (Real)(ntemps - 1); + + Real *nu_bins = (Real *)PORTABLE_MALLOC(nbins * sizeof(Real)); + Real *temp_bins = (Real *)PORTABLE_MALLOC(ntemps * sizeof(Real)); + DataBox loglin_bins(Spiner::AllocationTarget::Device, ntemps, nbins); + + portableFor( + "set nu bins", 0, nbins, PORTABLE_LAMBDA(const int &i) { + nu_bins[i] = std::pow(10, lnu_min + dnu * i); + }); + portableFor( + "set temp bins", 0, ntemps, PORTABLE_LAMBDA(const int &i) { + temp_bins[i] = std::pow(10, lt_min + dt * i); + }); + + portableFor( + "Fill the indexers", 0, ntemps, PORTABLE_LAMBDA(const int &i) { + Real temp = temp_bins[i]; + auto bins = loglin_bins.slice(i); + indexers::LogLinear J_log(bins, nu_min, nu_max, nbins); + opac.EmissivityPerNu(rho, temp, nu_bins, J_log, nbins); + Real Jtrue = opac.EmissivityPerNu(rho, temp, nu); + if (FractionalDifference(Jtrue, J_log(nu)) > EPS_TEST) { + n_wrong_d() += 1; + } + }); + +#ifdef PORTABILITY_STRATEGY_KOKKOS + Kokkos::deep_copy(n_wrong_h, n_wrong_d); +#endif + REQUIRE(n_wrong_h == 0); + + PORTABLE_FREE(nu_bins); + PORTABLE_FREE(temp_bins); + free(loglin_bins); + } + + opac.Finalize(); + } +} + +TEST_CASE("Tophat Opacities", "[TopHat]") { + WHEN("We initialize a tophat neutrino opacity") { + neutrinos::Opacity opac = neutrinos::Tophat(1, 1e-2, 1e2); + } +} diff --git a/utils/spiner b/utils/spiner index cadaf1e..33862f8 160000 --- a/utils/spiner +++ b/utils/spiner @@ -1 +1 @@ -Subproject commit cadaf1e3f759251176f58cec0961093ae9019a18 +Subproject commit 33862f831be65e2dd2284b42f05c477b6fe7367a From 7d1456adae1ba8accb411a49a4d715b003dc049e Mon Sep 17 00:00:00 2001 From: Benjamin Ransom Ryan Date: Wed, 25 Sep 2024 11:58:12 -0600 Subject: [PATCH 03/14] Testing is behaving --- cmake/SetupDeps.cmake | 11 +- singularity-opac/photons/opac_photons.hpp | 8 +- .../photons/powerlaw_opacity_photons.hpp | 4 +- test/test_powerlaw_opacities.cpp | 284 ++++-------------- 4 files changed, 68 insertions(+), 239 deletions(-) diff --git a/cmake/SetupDeps.cmake b/cmake/SetupDeps.cmake index 16455f5..be2f30e 100644 --- a/cmake/SetupDeps.cmake +++ b/cmake/SetupDeps.cmake @@ -21,10 +21,13 @@ target_link_libraries(singularity-opac::flags INTERFACE PortsofCall::PortsofCall # Setup Kokkos # - provides Kokkos::kokkos #======================================= -if (NOT TARGET Kokkos::kokkos) - find_package(Kokkos QUIET) -else() - message(status "Kokkos::kokkos provided by parent package") +if (SINGULARITY_USE_KOKKOS) + if (NOT TARGET Kokkos::kokkos) + add_subdirectory(utils/kokkos) + find_package(Kokkos QUIET) + else() + message(status "Kokkos::kokkos provided by parent package") + endif() endif() #======================================= diff --git a/singularity-opac/photons/opac_photons.hpp b/singularity-opac/photons/opac_photons.hpp index 2128a2c..9495e05 100644 --- a/singularity-opac/photons/opac_photons.hpp +++ b/singularity-opac/photons/opac_photons.hpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -29,10 +30,13 @@ namespace photons { using ScaleFree = GrayOpacity; using Gray = GrayOpacity; +using PowerLawScaleFree = PowerLawOpacity; +using PowerLaw = PowerLawOpacity; using EPBremss = EPBremsstrahlungOpacity; -using Opacity = impl::Variant, - NonCGSUnits>; +using Opacity = + impl::Variant, NonCGSUnits>; } // namespace photons } // namespace singularity diff --git a/singularity-opac/photons/powerlaw_opacity_photons.hpp b/singularity-opac/photons/powerlaw_opacity_photons.hpp index f512757..736f639 100644 --- a/singularity-opac/photons/powerlaw_opacity_photons.hpp +++ b/singularity-opac/photons/powerlaw_opacity_photons.hpp @@ -37,7 +37,7 @@ class PowerLawOpacity { const Real A, const Real B) : dist_(dist), kappa0_(kappa0), A_(A), B_(B) {} - GrayOpacity GetOnDevice() { return *this; } + PowerLawOpacity GetOnDevice() { return *this; } PORTABLE_INLINE_FUNCTION int nlambda() const noexcept { return 0; } PORTABLE_INLINE_FUNCTION @@ -85,7 +85,7 @@ class PowerLawOpacity { Real EmissivityPerNuOmega(const Real rho, const Real temp, const Real nu, Real *lambda = nullptr) const { Real Bnu = dist_.ThermalDistributionOfTNu(temp, nu, lambda); - return rho * (kappa0_ * std::pow(rho, A_) * std::pow(temp, B_) * Bnu; + return rho * (kappa0_ * std::pow(rho, A_) * std::pow(temp, B_)) * Bnu; } template diff --git a/test/test_powerlaw_opacities.cpp b/test/test_powerlaw_opacities.cpp index 5ea4313..aa590e3 100644 --- a/test/test_powerlaw_opacities.cpp +++ b/test/test_powerlaw_opacities.cpp @@ -22,16 +22,10 @@ #include #include -#include -#include -#include -#include -#include #include using namespace singularity; -using pc = PhysicalConstantsCGS; using DataBox = Spiner::DataBox; #ifdef PORTABILITY_STRATEGY_KOKKOS @@ -42,15 +36,29 @@ template PORTABLE_INLINE_FUNCTION T FractionalDifference(const T &a, const T &b) { return 2 * std::abs(b - a) / (std::abs(a) + std::abs(b) + 1e-20); } -constexpr Real EPS_TEST = 1e-3; +PORTABLE_INLINE_FUNCTION Real CalcFrequency(const int n, const Real nu_min, + const Real nu_max, const int n_nu) { + const Real lnu_min = std::log(nu_min); + const Real lnu_max = std::log(nu_max); + const Real dlnu = (lnu_max - lnu_min) / static_cast(n_nu); + return std::exp(lnu_min + (n + 0.5) * dlnu); +} -TEST_CASE("Power law photon opacities", "[PowerLawPhotonOpacities]") { - WHEN("We initialize a power law photon opacity") { - constexpr Real rho = 1.e0; // g/cc - constexpr Real temp = 1.e3; // K - constexpr Real nu = 1.e14; // Hz +constexpr Real EPS_TEST = 1e-3; - photons::PowerLaw opac_host(1); +TEST_CASE("Scale free power law photon opacities", + "[PowerLawScaleFreePhotonOpacities]") { + WHEN("We initialize a scale-free power law photon opacity") { + constexpr Real rho = 1.e0; + constexpr Real temp = 1.e0; + constexpr Real nu_min = 1.e-1; + constexpr Real nu_max = 1.e1; + constexpr int n_nu = 100; + constexpr Real kappa0 = 1.5; + constexpr Real A = 2.; + constexpr Real B = 2.5; + + photons::PowerLawScaleFree opac_host(kappa0, A, B); photons::Opacity opac = opac_host.GetOnDevice(); THEN("The emissivity per nu omega is consistent with the emissity per nu") { @@ -62,143 +70,45 @@ TEST_CASE("Power law photon opacities", "[PowerLawPhotonOpacities]") { #endif portableFor( - "calc emissivities", 0, 100, PORTABLE_LAMBDA(const int &i) { - Real jnu = opac.EmissivityPerNuOmega(rho, temp, Ye, type, nu); - Real Jnu = opac.EmissivityPerNu(rho, temp, Ye, type, nu); - if (FractionalDifference(Jnu, 4 * M_PI * jnu) > EPS_TEST) { + "calc emissivities", 0, n_nu, PORTABLE_LAMBDA(const int &i) { + const Real nu = CalcFrequency(i, nu_min, nu_max, n_nu); + const Real jnu = opac.EmissivityPerNuOmega(rho, temp, nu); + const Real Jnu = opac.EmissivityPerNu(rho, temp, nu); + const Real kappa = kappa0 * std::pow(rho, A) * std::pow(temp, B); + if (FractionalDifference(jnu, rho * kappa * + opac.ThermalDistributionOfTNu( + temp, nu)) > EPS_TEST) { n_wrong_d() += 1; } - }); - -#ifdef PORTABILITY_STRATEGY_KOKKOS - Kokkos::deep_copy(n_wrong_h, n_wrong_d); -#endif - REQUIRE(n_wrong_h == 0); - } - - WHEN("We create a gray opacity object in non-cgs units") { - constexpr Real time_unit = 123; - constexpr Real mass_unit = 456; - constexpr Real length_unit = 789; - constexpr Real temp_unit = 276; - constexpr Real rho_unit = - mass_unit / (length_unit * length_unit * length_unit); - constexpr Real j_unit = mass_unit / (length_unit * time_unit * time_unit); - neutrinos::Opacity funny_units_host = - neutrinos::NonCGSUnits( - neutrinos::Gray(1), time_unit, mass_unit, length_unit, temp_unit); - auto funny_units = funny_units_host.GetOnDevice(); - - THEN("We can convert meaningfully into and out of funny units") { - int n_wrong_h = 0; -#ifdef PORTABILITY_STRATEGY_KOKKOS - Kokkos::View n_wrong_d("wrong"); -#else - PortableMDArray n_wrong_d(&n_wrong_h, 1); -#endif - - portableFor( - "emissivities in funny units", 0, 100, - PORTABLE_LAMBDA(const int &i) { - Real jnu_funny = funny_units.EmissivityPerNuOmega( - rho / rho_unit, temp / temp_unit, Ye, type, nu * time_unit); - Real jnu = opac.EmissivityPerNuOmega(rho, temp, Ye, type, nu); - if (FractionalDifference(jnu, jnu_funny * j_unit) > EPS_TEST) { - n_wrong_d() += 1; - } - }); -#ifdef PORTABILITY_STRATEGY_KOKKOS - Kokkos::deep_copy(n_wrong_h, n_wrong_d); -#endif - REQUIRE(n_wrong_h == 0); - } - } - - THEN("We can fill an indexer allocated in a cell") { - int n_wrong_h = 0; -#ifdef PORTABILITY_STRATEGY_KOKKOS - Kokkos::View n_wrong_d("wrong"); -#else - PortableMDArray n_wrong_d(&n_wrong_h, 1); -#endif - constexpr int nbins = 9; - constexpr int ntemps = 100; - - Real lnu_min = 0 + std::log10(MeV2Hz); - Real lnu_max = 1 + std::log10(MeV2Hz); - Real nu_min = std::pow(10, lnu_min); - Real nu_max = std::pow(10, lnu_max); - - constexpr Real lt_min = -1; - constexpr Real lt_max = 2; - Real dt = (lt_max - lt_min) / (Real)(ntemps - 1); - - Real *nu_bins = (Real *)PORTABLE_MALLOC(nbins * sizeof(Real)); - Real *lnu_bins = (Real *)PORTABLE_MALLOC(nbins * sizeof(Real)); - Real *temp_bins = (Real *)PORTABLE_MALLOC(ntemps * sizeof(Real)); - portableFor( - "set nu bins", 0, 1, PORTABLE_LAMBDA(const int &i) { - chebyshev::GetPoints(lnu_min, lnu_max, nbins, lnu_bins); - for (int j = 0; j < nbins; ++j) { - nu_bins[j] = std::pow(10, lnu_bins[j]); - } - }); - portableFor( - "set temp bins", 0, ntemps, PORTABLE_LAMBDA(const int &i) { - temp_bins[i] = std::pow(10, lt_min + dt * i) * MeV2K; - }); - - Real *vm9 = (Real *)PORTABLE_MALLOC(9 * 9 * sizeof(Real)); - portableFor( - "Fill vm", 0, 1, - PORTABLE_LAMBDA(const int &i) { chebyshev::get_vmbox(vm9); }); - - portableFor( - "Fill the indexers", 0, ntemps, PORTABLE_LAMBDA(const int &i) { - Real temp = temp_bins[i]; - - Real *nu_data = (Real *)malloc(nbins * sizeof(Real)); - Real *lnu_data = (Real *)malloc(nbins * sizeof(Real)); - Real *nu_coeffs = (Real *)malloc(nbins * sizeof(Real)); - indexers::LogCheb J_cheb(nu_data, lnu_data, - nu_coeffs, nu_min, nu_max); - opac.EmissivityPerNu(rho, temp, Ye, type, nu_bins, J_cheb, nbins); - Real Jtrue = opac.EmissivityPerNu(rho, temp, Ye, type, nu); - J_cheb.SetInterpCoeffs(DataBox(vm9, 9, 9)); - if (std::isnan(J_cheb(nu)) || - ((std::abs(Jtrue) >= 1e-14 || J_cheb(nu) >= 1e-14) && - FractionalDifference(J_cheb(nu), Jtrue) > EPS_TEST)) { + if (FractionalDifference(Jnu, 4 * M_PI * jnu) > EPS_TEST) { n_wrong_d() += 1; } - free(nu_data); - free(lnu_data); - free(nu_coeffs); }); #ifdef PORTABILITY_STRATEGY_KOKKOS Kokkos::deep_copy(n_wrong_h, n_wrong_d); #endif - REQUIRE(n_wrong_h == 0); - - PORTABLE_FREE(vm9); - PORTABLE_FREE(nu_bins); - PORTABLE_FREE(lnu_bins); - PORTABLE_FREE(temp_bins); } opac.Finalize(); } } -TEST_CASE("Gray photon opacities", "[GrayPhotons]") { - WHEN("We initialize a gray photon opacity") { - constexpr Real rho = 1e3; // g/cc. - constexpr Real temp = 1e5; // Kelvin. - constexpr Real nu = 3e9; // Hz. UHF microwave - - photons::Opacity opac_host = photons::Gray(1); +TEST_CASE("CGS power law photon opacities", "[PowerLawCGSPhotonOpacities]") { + WHEN("We initialize a CGS power law photon opacity") { + constexpr Real rho = 1.e0; // g/cc + constexpr Real temp = 1.e3; // K + constexpr Real nu_min = 1.e10; // Hz + constexpr Real nu_max = 1.e14; // Hz + constexpr int n_nu = 100; + constexpr Real kappa0 = 1.5; // cm^2 / g + constexpr Real A = 2.; + constexpr Real B = 2.5; + + photons::PowerLaw opac_host(kappa0, A, B); photons::Opacity opac = opac_host.GetOnDevice(); + THEN("The emissivity per nu omega is consistent with the emissity per nu") { int n_wrong_h = 0; #ifdef PORTABILITY_STRATEGY_KOKKOS @@ -206,98 +116,19 @@ TEST_CASE("Gray photon opacities", "[GrayPhotons]") { #else PortableMDArray n_wrong_d(&n_wrong_h, 1); #endif + portableFor( - "calc emissivities", 0, 100, PORTABLE_LAMBDA(const int &i) { - Real jnu = opac.EmissivityPerNuOmega(rho, temp, nu); - Real Jnu = opac.EmissivityPerNu(rho, temp, nu); - if (FractionalDifference(Jnu, 4 * M_PI * jnu) > EPS_TEST) { + "calc emissivities", 0, n_nu, PORTABLE_LAMBDA(const int &i) { + const Real nu = CalcFrequency(i, nu_min, nu_max, n_nu); + const Real jnu = opac.EmissivityPerNuOmega(rho, temp, nu); + const Real Jnu = opac.EmissivityPerNu(rho, temp, nu); + const Real kappa = kappa0 * std::pow(rho, A) * std::pow(temp, B); + if (FractionalDifference(jnu, rho * kappa * + opac.ThermalDistributionOfTNu( + temp, nu)) > EPS_TEST) { n_wrong_d() += 1; } - }); -#ifdef PORTABILITY_STRATEGY_KOKKOS - Kokkos::deep_copy(n_wrong_h, n_wrong_d); -#endif - REQUIRE(n_wrong_h == 0); - } - - WHEN("We create a gray opacity object in non-cgs units") { - constexpr Real time_unit = 123; - constexpr Real mass_unit = 456; - constexpr Real length_unit = 789; - constexpr Real temp_unit = 276; - constexpr Real rho_unit = - mass_unit / (length_unit * length_unit * length_unit); - constexpr Real j_unit = mass_unit / (length_unit * time_unit * time_unit); - photons::Opacity funny_units_host = photons::NonCGSUnits( - photons::Gray(1), time_unit, mass_unit, length_unit, temp_unit); - auto funny_units = funny_units_host.GetOnDevice(); - - THEN("We can convert meaningfully into and out of funny units") { - int n_wrong_h = 0; -#ifdef PORTABILITY_STRATEGY_KOKKOS - Kokkos::View n_wrong_d("wrong"); -#else - PortableMDArray n_wrong_d(&n_wrong_h, 1); -#endif - - portableFor( - "emissivities in funny units", 0, 100, - PORTABLE_LAMBDA(const int &i) { - Real jnu_funny = funny_units.EmissivityPerNuOmega( - rho / rho_unit, temp / temp_unit, nu * time_unit); - Real jnu = opac.EmissivityPerNuOmega(rho, temp, nu); - if (FractionalDifference(jnu, jnu_funny * j_unit) > EPS_TEST) { - n_wrong_d() += 1; - } - }); -#ifdef PORTABILITY_STRATEGY_KOKKOS - Kokkos::deep_copy(n_wrong_h, n_wrong_d); -#endif - REQUIRE(n_wrong_h == 0); - } - } - - THEN("We can fill an indexer allocated in a cell") { - int n_wrong_h = 0; -#ifdef PORTABILITY_STRATEGY_KOKKOS - Kokkos::View n_wrong_d("wrong"); -#else - PortableMDArray n_wrong_d(&n_wrong_h, 1); -#endif - constexpr int nbins = 100; - constexpr int ntemps = 100; - - constexpr Real lnu_min = 8; - constexpr Real lnu_max = 10; - Real nu_min = std::pow(10, lnu_min); - Real nu_max = std::pow(10, lnu_max); - Real dnu = (lnu_max - lnu_min) / (Real)(nbins - 1); - - constexpr Real lt_min = 2; - constexpr Real lt_max = 4; - Real dt = (lt_max - lt_min) / (Real)(ntemps - 1); - - Real *nu_bins = (Real *)PORTABLE_MALLOC(nbins * sizeof(Real)); - Real *temp_bins = (Real *)PORTABLE_MALLOC(ntemps * sizeof(Real)); - DataBox loglin_bins(Spiner::AllocationTarget::Device, ntemps, nbins); - - portableFor( - "set nu bins", 0, nbins, PORTABLE_LAMBDA(const int &i) { - nu_bins[i] = std::pow(10, lnu_min + dnu * i); - }); - portableFor( - "set temp bins", 0, ntemps, PORTABLE_LAMBDA(const int &i) { - temp_bins[i] = std::pow(10, lt_min + dt * i); - }); - - portableFor( - "Fill the indexers", 0, ntemps, PORTABLE_LAMBDA(const int &i) { - Real temp = temp_bins[i]; - auto bins = loglin_bins.slice(i); - indexers::LogLinear J_log(bins, nu_min, nu_max, nbins); - opac.EmissivityPerNu(rho, temp, nu_bins, J_log, nbins); - Real Jtrue = opac.EmissivityPerNu(rho, temp, nu); - if (FractionalDifference(Jtrue, J_log(nu)) > EPS_TEST) { + if (FractionalDifference(Jnu, 4 * M_PI * jnu) > EPS_TEST) { n_wrong_d() += 1; } }); @@ -306,18 +137,9 @@ TEST_CASE("Gray photon opacities", "[GrayPhotons]") { Kokkos::deep_copy(n_wrong_h, n_wrong_d); #endif REQUIRE(n_wrong_h == 0); - - PORTABLE_FREE(nu_bins); - PORTABLE_FREE(temp_bins); - free(loglin_bins); } opac.Finalize(); } } -TEST_CASE("Tophat Opacities", "[TopHat]") { - WHEN("We initialize a tophat neutrino opacity") { - neutrinos::Opacity opac = neutrinos::Tophat(1, 1e-2, 1e2); - } -} From d218895a27fc096ba58190633c4197dd3659d79c Mon Sep 17 00:00:00 2001 From: Benjamin Ransom Ryan Date: Wed, 25 Sep 2024 12:24:39 -0600 Subject: [PATCH 04/14] non-cgs units test --- singularity-opac/photons/opac_photons.hpp | 6 +- test/test_powerlaw_opacities.cpp | 69 ++++++++++++++++++++--- 2 files changed, 63 insertions(+), 12 deletions(-) diff --git a/singularity-opac/photons/opac_photons.hpp b/singularity-opac/photons/opac_photons.hpp index 9495e05..50918a5 100644 --- a/singularity-opac/photons/opac_photons.hpp +++ b/singularity-opac/photons/opac_photons.hpp @@ -34,9 +34,9 @@ using PowerLawScaleFree = PowerLawOpacity; using PowerLaw = PowerLawOpacity; using EPBremss = EPBremsstrahlungOpacity; -using Opacity = - impl::Variant, NonCGSUnits>; +using Opacity = impl::Variant, + NonCGSUnits, NonCGSUnits>; } // namespace photons } // namespace singularity diff --git a/test/test_powerlaw_opacities.cpp b/test/test_powerlaw_opacities.cpp index aa590e3..de83ba4 100644 --- a/test/test_powerlaw_opacities.cpp +++ b/test/test_powerlaw_opacities.cpp @@ -96,16 +96,16 @@ TEST_CASE("Scale free power law photon opacities", } TEST_CASE("CGS power law photon opacities", "[PowerLawCGSPhotonOpacities]") { - WHEN("We initialize a CGS power law photon opacity") { - constexpr Real rho = 1.e0; // g/cc - constexpr Real temp = 1.e3; // K - constexpr Real nu_min = 1.e10; // Hz - constexpr Real nu_max = 1.e14; // Hz - constexpr int n_nu = 100; - constexpr Real kappa0 = 1.5; // cm^2 / g - constexpr Real A = 2.; - constexpr Real B = 2.5; + constexpr Real rho = 1.e0; // g/cc + constexpr Real temp = 1.e3; // K + constexpr Real nu_min = 1.e10; // Hz + constexpr Real nu_max = 1.e14; // Hz + constexpr int n_nu = 100; + constexpr Real kappa0 = 1.5; // cm^2 / g + constexpr Real A = 2.; + constexpr Real B = 2.5; + WHEN("We initialize a CGS power law photon opacity") { photons::PowerLaw opac_host(kappa0, A, B); photons::Opacity opac = opac_host.GetOnDevice(); @@ -133,6 +133,57 @@ TEST_CASE("CGS power law photon opacities", "[PowerLawCGSPhotonOpacities]") { } }); +#ifdef PORTABILITY_STRATEGY_KOKKOS + Kokkos::deep_copy(n_wrong_h, n_wrong_d); +#endif + REQUIRE(n_wrong_h == 0); + } + + opac.Finalize(); + } + + WHEN("We initialize a CGS power law photon opacity with non-CGS units") { + constexpr Real time_unit = 123.; + constexpr Real mass_unit = 456.; + constexpr Real length_unit = 789.; + constexpr Real temp_unit = 276.; + constexpr Real rho_unit = + mass_unit / (length_unit * length_unit * length_unit); + constexpr Real j_unit = mass_unit / (length_unit * time_unit * time_unit); + + photons::NonCGSUnits opac_host( + photons::PowerLaw(kappa0, A, B), time_unit, mass_unit, length_unit, + temp_unit); + photons::Opacity opac = opac_host.GetOnDevice(); + photons::PowerLaw opac_cgs_host(kappa0, A, B); + photons::Opacity opac_cgs = opac_cgs_host.GetOnDevice(); + + THEN("The emissivity per nu omega is consistent with the emissity per nu") { + int n_wrong_h = 0; +#ifdef PORTABILITY_STRATEGY_KOKKOS + Kokkos::View n_wrong_d("wrong"); +#else + PortableMDArray n_wrong_d(&n_wrong_h, 1); +#endif + + portableFor( + "calc emissivities", 0, n_nu, PORTABLE_LAMBDA(const int &i) { + const Real nu = CalcFrequency(i, nu_min, nu_max, n_nu); + const Real jnu = opac.EmissivityPerNuOmega( + rho / rho_unit, temp / temp_unit, nu * time_unit); + const Real Jnu = opac.EmissivityPerNu( + rho / rho_unit, temp / temp_unit, nu * time_unit); + const Real kappa = kappa0 * std::pow(rho, A) * std::pow(temp, B); + if (FractionalDifference( + jnu * j_unit, + opac_cgs.EmissivityPerNuOmega(rho, temp, nu)) > EPS_TEST) { + n_wrong_d() += 1; + } + if (FractionalDifference(Jnu, 4 * M_PI * jnu) > EPS_TEST) { + n_wrong_d() += 1; + } + }); + #ifdef PORTABILITY_STRATEGY_KOKKOS Kokkos::deep_copy(n_wrong_h, n_wrong_d); #endif From fdb05d9e31545c704cc7f8cd49763fa4ad9ce6fe Mon Sep 17 00:00:00 2001 From: Benjamin Ransom Ryan Date: Wed, 25 Sep 2024 12:31:37 -0600 Subject: [PATCH 05/14] done --- .../photons/powerlaw_opacity_photons.hpp | 26 ++++++++------- test/test_powerlaw_opacities.cpp | 32 ++++++++++--------- 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/singularity-opac/photons/powerlaw_opacity_photons.hpp b/singularity-opac/photons/powerlaw_opacity_photons.hpp index 736f639..7efe5e6 100644 --- a/singularity-opac/photons/powerlaw_opacity_photons.hpp +++ b/singularity-opac/photons/powerlaw_opacity_photons.hpp @@ -31,18 +31,19 @@ template class PowerLawOpacity { public: PowerLawOpacity() = default; - PowerLawOpacity(const Real kappa0, const Real A, const Real B) - : kappa0_(kappa0), A_(A), B_(B) {} + PowerLawOpacity(const Real kappa0, const Real rho_exp, const Real temp_exp) + : kappa0_(kappa0), rho_exp_(rho_exp), temp_exp_(temp_exp) {} PowerLawOpacity(const PlanckDistribution &dist, const Real kappa0, - const Real A, const Real B) - : dist_(dist), kappa0_(kappa0), A_(A), B_(B) {} + const Real rho_exp, const Real temp_exp) + : dist_(dist), kappa0_(kappa0), rho_exp_(rho_exp), temp_exp_(temp_exp) {} PowerLawOpacity GetOnDevice() { return *this; } PORTABLE_INLINE_FUNCTION int nlambda() const noexcept { return 0; } PORTABLE_INLINE_FUNCTION void PrintParams() const noexcept { - printf("Power law opacity. kappa0 = %g A = %g B = %g\n", kappa0_, A_, B_); + printf("Power law opacity. kappa0 = %g rho_exp = %g temp_exp = %g\n", + kappa0_, rho_exp_, temp_exp_); } inline void Finalize() noexcept {} @@ -85,7 +86,9 @@ class PowerLawOpacity { Real EmissivityPerNuOmega(const Real rho, const Real temp, const Real nu, Real *lambda = nullptr) const { Real Bnu = dist_.ThermalDistributionOfTNu(temp, nu, lambda); - return rho * (kappa0_ * std::pow(rho, A_) * std::pow(temp, B_)) * Bnu; + return rho * + (kappa0_ * std::pow(rho, rho_exp_) * std::pow(temp, temp_exp_)) * + Bnu; } template @@ -118,13 +121,14 @@ class PowerLawOpacity { Real Emissivity(const Real rho, const Real temp, Real *lambda = nullptr) const { Real B = dist_.ThermalDistributionOfT(temp, lambda); - return rho * (kappa0_ * std::pow(rho, A_) * std::pow(temp, B_)) * B; + return rho * + (kappa0_ * std::pow(rho, rho_exp_) * std::pow(temp, temp_exp_)) * B; } PORTABLE_INLINE_FUNCTION Real NumberEmissivity(const Real rho, const Real temp, Real *lambda = nullptr) const { - return (kappa0_ * std::pow(rho, A_) * std::pow(temp, B_)) * + return (kappa0_ * std::pow(rho, rho_exp_) * std::pow(temp, temp_exp_)) * dist_.ThermalNumberDistributionOfT(temp, lambda); } @@ -169,9 +173,9 @@ class PowerLawOpacity { } private: - Real kappa0_; // Opacity scale. Units of cm^2/g - Real A_; // Power law index of density - Real B_; // Power law index of temperature + Real kappa0_; // Opacity scale. Units of cm^2/g + Real rho_exp_; // Power law index of density + Real temp_exp_; // Power law index of temperature PlanckDistribution dist_; }; diff --git a/test/test_powerlaw_opacities.cpp b/test/test_powerlaw_opacities.cpp index de83ba4..73e39b1 100644 --- a/test/test_powerlaw_opacities.cpp +++ b/test/test_powerlaw_opacities.cpp @@ -46,19 +46,20 @@ PORTABLE_INLINE_FUNCTION Real CalcFrequency(const int n, const Real nu_min, constexpr Real EPS_TEST = 1e-3; +constexpr Real rho_exp = 2.; +constexpr Real temp_exp = 2.5; + TEST_CASE("Scale free power law photon opacities", "[PowerLawScaleFreePhotonOpacities]") { WHEN("We initialize a scale-free power law photon opacity") { - constexpr Real rho = 1.e0; - constexpr Real temp = 1.e0; + constexpr Real rho = 1.5e0; + constexpr Real temp = 3.2e0; constexpr Real nu_min = 1.e-1; constexpr Real nu_max = 1.e1; constexpr int n_nu = 100; constexpr Real kappa0 = 1.5; - constexpr Real A = 2.; - constexpr Real B = 2.5; - photons::PowerLawScaleFree opac_host(kappa0, A, B); + photons::PowerLawScaleFree opac_host(kappa0, rho_exp, temp_exp); photons::Opacity opac = opac_host.GetOnDevice(); THEN("The emissivity per nu omega is consistent with the emissity per nu") { @@ -74,7 +75,8 @@ TEST_CASE("Scale free power law photon opacities", const Real nu = CalcFrequency(i, nu_min, nu_max, n_nu); const Real jnu = opac.EmissivityPerNuOmega(rho, temp, nu); const Real Jnu = opac.EmissivityPerNu(rho, temp, nu); - const Real kappa = kappa0 * std::pow(rho, A) * std::pow(temp, B); + const Real kappa = + kappa0 * std::pow(rho, rho_exp) * std::pow(temp, temp_exp); if (FractionalDifference(jnu, rho * kappa * opac.ThermalDistributionOfTNu( temp, nu)) > EPS_TEST) { @@ -96,17 +98,15 @@ TEST_CASE("Scale free power law photon opacities", } TEST_CASE("CGS power law photon opacities", "[PowerLawCGSPhotonOpacities]") { - constexpr Real rho = 1.e0; // g/cc + constexpr Real rho = 1.5e0; // g/cc constexpr Real temp = 1.e3; // K constexpr Real nu_min = 1.e10; // Hz constexpr Real nu_max = 1.e14; // Hz constexpr int n_nu = 100; constexpr Real kappa0 = 1.5; // cm^2 / g - constexpr Real A = 2.; - constexpr Real B = 2.5; WHEN("We initialize a CGS power law photon opacity") { - photons::PowerLaw opac_host(kappa0, A, B); + photons::PowerLaw opac_host(kappa0, rho_exp, temp_exp); photons::Opacity opac = opac_host.GetOnDevice(); THEN("The emissivity per nu omega is consistent with the emissity per nu") { @@ -122,7 +122,8 @@ TEST_CASE("CGS power law photon opacities", "[PowerLawCGSPhotonOpacities]") { const Real nu = CalcFrequency(i, nu_min, nu_max, n_nu); const Real jnu = opac.EmissivityPerNuOmega(rho, temp, nu); const Real Jnu = opac.EmissivityPerNu(rho, temp, nu); - const Real kappa = kappa0 * std::pow(rho, A) * std::pow(temp, B); + const Real kappa = + kappa0 * std::pow(rho, rho_exp) * std::pow(temp, temp_exp); if (FractionalDifference(jnu, rho * kappa * opac.ThermalDistributionOfTNu( temp, nu)) > EPS_TEST) { @@ -152,10 +153,10 @@ TEST_CASE("CGS power law photon opacities", "[PowerLawCGSPhotonOpacities]") { constexpr Real j_unit = mass_unit / (length_unit * time_unit * time_unit); photons::NonCGSUnits opac_host( - photons::PowerLaw(kappa0, A, B), time_unit, mass_unit, length_unit, - temp_unit); + photons::PowerLaw(kappa0, rho_exp, temp_exp), time_unit, mass_unit, + length_unit, temp_unit); photons::Opacity opac = opac_host.GetOnDevice(); - photons::PowerLaw opac_cgs_host(kappa0, A, B); + photons::PowerLaw opac_cgs_host(kappa0, rho_exp, temp_exp); photons::Opacity opac_cgs = opac_cgs_host.GetOnDevice(); THEN("The emissivity per nu omega is consistent with the emissity per nu") { @@ -173,7 +174,8 @@ TEST_CASE("CGS power law photon opacities", "[PowerLawCGSPhotonOpacities]") { rho / rho_unit, temp / temp_unit, nu * time_unit); const Real Jnu = opac.EmissivityPerNu( rho / rho_unit, temp / temp_unit, nu * time_unit); - const Real kappa = kappa0 * std::pow(rho, A) * std::pow(temp, B); + const Real kappa = + kappa0 * std::pow(rho, rho_exp) * std::pow(temp, temp_exp); if (FractionalDifference( jnu * j_unit, opac_cgs.EmissivityPerNuOmega(rho, temp, nu)) > EPS_TEST) { From 77817543555a954187fba011e77df832a07220a0 Mon Sep 17 00:00:00 2001 From: Benjamin Ransom Ryan Date: Wed, 25 Sep 2024 12:53:26 -0600 Subject: [PATCH 06/14] Latest submodule versions --- CMakeLists.txt | 4 ++-- cmake/SetupDeps.cmake | 14 +++++++------- cmake/SetupFlags.cmake | 11 ++++++++--- utils/kokkos | 2 +- utils/ports-of-call | 2 +- utils/spiner | 2 +- utils/variant | 2 +- 7 files changed, 21 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e34cb89..cfdfc9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,10 +53,10 @@ target_include_directories(singularity-opac::flags INTERFACE $) -include (SetupDeps) include (SetupOptions) -include (SetupCompilers) include (SetupFlags) +include (SetupDeps) +include (SetupCompilers) if (SINGULARITY_USE_HDF5) message(STATUS "HDF5 enabled. Requesting it in spiner") diff --git a/cmake/SetupDeps.cmake b/cmake/SetupDeps.cmake index be2f30e..048d700 100644 --- a/cmake/SetupDeps.cmake +++ b/cmake/SetupDeps.cmake @@ -14,6 +14,8 @@ endif() # Setup ports of call # - provides PortsofCall::PortsofCall #======================================= +get_target_property(defs ${PROJECT_NAME} INTERFACE_COMPILE_DEFINITIONS) +message(STATUS "POC Compile Definitions for ${PROJECT_NAME}: ${defs}") find_package(PortsofCall REQUIRED) target_link_libraries(singularity-opac::flags INTERFACE PortsofCall::PortsofCall) @@ -21,13 +23,11 @@ target_link_libraries(singularity-opac::flags INTERFACE PortsofCall::PortsofCall # Setup Kokkos # - provides Kokkos::kokkos #======================================= -if (SINGULARITY_USE_KOKKOS) - if (NOT TARGET Kokkos::kokkos) - add_subdirectory(utils/kokkos) - find_package(Kokkos QUIET) - else() - message(status "Kokkos::kokkos provided by parent package") - endif() +if (NOT TARGET Kokkos::kokkos) + add_subdirectory(utils/kokkos) + find_package(Kokkos QUIET) +else() + message(status "Kokkos::kokkos provided by parent package") endif() #======================================= diff --git a/cmake/SetupFlags.cmake b/cmake/SetupFlags.cmake index d0f6896..b491f8e 100644 --- a/cmake/SetupFlags.cmake +++ b/cmake/SetupFlags.cmake @@ -63,17 +63,22 @@ INTERFACE > # with_kokkos ) +get_target_property(defs ${PROJECT_NAME} INTERFACE_COMPILE_DEFINITIONS) +message(STATUS "BEFORE compile Definitions for ${PROJECT_NAME}: ${defs}") target_compile_definitions(${PROJECT_NAME} INTERFACE - $<${with_kokkos}: - PORTABILITY_STRATEGY_KOKKOS - > + #$<${with_kokkos}: + # PORTABILITY_STRATEGY_KOKKOS + #> $<${without_kokkos}: $<${with_fmath}: SINGULARITY_USE_FMATH > + PORTABILITY_STRATEGY_NONE > ) +get_target_property(defs ${PROJECT_NAME} INTERFACE_COMPILE_DEFINITIONS) +message(STATUS "Compile Definitions for ${PROJECT_NAME}: ${defs}") # target_link_libraries brings in compile flags, compile defs, link flags. target_link_libraries(${PROJECT_NAME} diff --git a/utils/kokkos b/utils/kokkos index 1fb0c28..08ceff9 160000 --- a/utils/kokkos +++ b/utils/kokkos @@ -1 +1 @@ -Subproject commit 1fb0c284d458c75370094921d9f202c287502325 +Subproject commit 08ceff92bcf3a828844480bc1e6137eb74028517 diff --git a/utils/ports-of-call b/utils/ports-of-call index 993d820..58ce118 160000 --- a/utils/ports-of-call +++ b/utils/ports-of-call @@ -1 +1 @@ -Subproject commit 993d8209de98da186c5e0b445a4d6c359afa8c81 +Subproject commit 58ce1181b2d835bd32673ad70550c9130381f91b diff --git a/utils/spiner b/utils/spiner index 33862f8..bd57161 160000 --- a/utils/spiner +++ b/utils/spiner @@ -1 +1 @@ -Subproject commit 33862f831be65e2dd2284b42f05c477b6fe7367a +Subproject commit bd57161576a62a13341dada183f2b336a3e99b08 diff --git a/utils/variant b/utils/variant index 3c7fc82..23cb94f 160000 --- a/utils/variant +++ b/utils/variant @@ -1 +1 @@ -Subproject commit 3c7fc8266bb46046b42c2dc2663f9f505f0cec28 +Subproject commit 23cb94f027d4ef33bf48133acc2695c7e5c6f1e7 From e5119b6f3ff534306a82626bd28d6deca8397f42 Mon Sep 17 00:00:00 2001 From: Benjamin Ransom Ryan Date: Wed, 25 Sep 2024 13:12:37 -0600 Subject: [PATCH 07/14] I give up --- CMakeLists.txt | 1 + cmake/SetupDeps.cmake | 2 ++ cmake/SetupFlags.cmake | 10 +++------- cmake/SetupOptions.cmake | 4 ++++ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cfdfc9d..3fc17af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,3 +123,4 @@ feature_summary(WHAT ALL DESCRIPTION "Enabled Features:" VAR enabledFeaturesText) message(STATUS "${enabledFeaturesText}") +message(STATUS "NOW 127 Compile Definitions for ${PROJECT_NAME}: ${defs}") diff --git a/cmake/SetupDeps.cmake b/cmake/SetupDeps.cmake index 048d700..5196437 100644 --- a/cmake/SetupDeps.cmake +++ b/cmake/SetupDeps.cmake @@ -93,3 +93,5 @@ cmake_dependent_option(SINGULARITY_USE_MPI if (NOT TARGET Catch2::Catch2) find_package(Catch2 QUIET) endif() + +message(STATUS "NOW Compile Definitions for ${PROJECT_NAME}: ${defs}") diff --git a/cmake/SetupFlags.cmake b/cmake/SetupFlags.cmake index b491f8e..beaa533 100644 --- a/cmake/SetupFlags.cmake +++ b/cmake/SetupFlags.cmake @@ -63,13 +63,11 @@ INTERFACE > # with_kokkos ) -get_target_property(defs ${PROJECT_NAME} INTERFACE_COMPILE_DEFINITIONS) -message(STATUS "BEFORE compile Definitions for ${PROJECT_NAME}: ${defs}") target_compile_definitions(${PROJECT_NAME} INTERFACE - #$<${with_kokkos}: - # PORTABILITY_STRATEGY_KOKKOS - #> + $<${with_kokkos}: + PORTABILITY_STRATEGY_KOKKOS + > $<${without_kokkos}: $<${with_fmath}: SINGULARITY_USE_FMATH @@ -77,8 +75,6 @@ INTERFACE PORTABILITY_STRATEGY_NONE > ) -get_target_property(defs ${PROJECT_NAME} INTERFACE_COMPILE_DEFINITIONS) -message(STATUS "Compile Definitions for ${PROJECT_NAME}: ${defs}") # target_link_libraries brings in compile flags, compile defs, link flags. target_link_libraries(${PROJECT_NAME} diff --git a/cmake/SetupOptions.cmake b/cmake/SetupOptions.cmake index 21a857c..be18dc9 100644 --- a/cmake/SetupOptions.cmake +++ b/cmake/SetupOptions.cmake @@ -51,3 +51,7 @@ if(SINGULARITY_USE_CUDA) message(FATAL_ERROR "Cuda without kokkos is not currently supported") endif() endif() + +if(NOT SINGULARITY_USE_KOKKOS) + message(FATAL_ERROR "For unknown reasons PORTABILITY_STRATEGY_KOKKOS will always be provided to ports-of-call. For now you must use Kokkos with singularity-opac.") +endif() From 495499b5ec1813dc414e8dd4fe4b2649d42ec41b Mon Sep 17 00:00:00 2001 From: Benjamin Ransom Ryan Date: Wed, 25 Sep 2024 13:15:32 -0600 Subject: [PATCH 08/14] Clean up --- CMakeLists.txt | 4 ++-- cmake/SetupDeps.cmake | 3 --- cmake/SetupOptions.cmake | 4 +++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fc17af..98a757f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,10 +53,10 @@ target_include_directories(singularity-opac::flags INTERFACE $) -include (SetupOptions) -include (SetupFlags) include (SetupDeps) +include (SetupOptions) include (SetupCompilers) +include (SetupFlags) if (SINGULARITY_USE_HDF5) message(STATUS "HDF5 enabled. Requesting it in spiner") diff --git a/cmake/SetupDeps.cmake b/cmake/SetupDeps.cmake index 5196437..c112a79 100644 --- a/cmake/SetupDeps.cmake +++ b/cmake/SetupDeps.cmake @@ -14,8 +14,6 @@ endif() # Setup ports of call # - provides PortsofCall::PortsofCall #======================================= -get_target_property(defs ${PROJECT_NAME} INTERFACE_COMPILE_DEFINITIONS) -message(STATUS "POC Compile Definitions for ${PROJECT_NAME}: ${defs}") find_package(PortsofCall REQUIRED) target_link_libraries(singularity-opac::flags INTERFACE PortsofCall::PortsofCall) @@ -94,4 +92,3 @@ if (NOT TARGET Catch2::Catch2) find_package(Catch2 QUIET) endif() -message(STATUS "NOW Compile Definitions for ${PROJECT_NAME}: ${defs}") diff --git a/cmake/SetupOptions.cmake b/cmake/SetupOptions.cmake index be18dc9..d8935ca 100644 --- a/cmake/SetupOptions.cmake +++ b/cmake/SetupOptions.cmake @@ -53,5 +53,7 @@ if(SINGULARITY_USE_CUDA) endif() if(NOT SINGULARITY_USE_KOKKOS) - message(FATAL_ERROR "For unknown reasons PORTABILITY_STRATEGY_KOKKOS will always be provided to ports-of-call. For now you must use Kokkos with singularity-opac.") + message(FATAL_ERROR + "For unknown reasons PORTABILITY_STRATEGY_KOKKOS will always be provided to ports-of-call. " + "For now you must use Kokkos with singularity-opac.") endif() From c6c868977ae03d320e149afc3e4d3249f6fbeab2 Mon Sep 17 00:00:00 2001 From: Benjamin Ransom Ryan Date: Wed, 25 Sep 2024 13:39:24 -0600 Subject: [PATCH 09/14] Extra print statement --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 98a757f..e34cb89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,4 +123,3 @@ feature_summary(WHAT ALL DESCRIPTION "Enabled Features:" VAR enabledFeaturesText) message(STATUS "${enabledFeaturesText}") -message(STATUS "NOW 127 Compile Definitions for ${PROJECT_NAME}: ${defs}") From 00cd8254952e077cc28652829262a02462d313b9 Mon Sep 17 00:00:00 2001 From: Benjamin Ransom Ryan Date: Wed, 25 Sep 2024 13:42:11 -0600 Subject: [PATCH 10/14] extra newline --- cmake/SetupDeps.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/SetupDeps.cmake b/cmake/SetupDeps.cmake index c112a79..deb3c51 100644 --- a/cmake/SetupDeps.cmake +++ b/cmake/SetupDeps.cmake @@ -91,4 +91,3 @@ cmake_dependent_option(SINGULARITY_USE_MPI if (NOT TARGET Catch2::Catch2) find_package(Catch2 QUIET) endif() - From da8727f8590388c3eba4bc011b430872361426c3 Mon Sep 17 00:00:00 2001 From: Benjamin Ransom Ryan Date: Wed, 25 Sep 2024 13:44:35 -0600 Subject: [PATCH 11/14] Does CI work with this? --- cmake/SetupOptions.cmake | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cmake/SetupOptions.cmake b/cmake/SetupOptions.cmake index d8935ca..21a857c 100644 --- a/cmake/SetupOptions.cmake +++ b/cmake/SetupOptions.cmake @@ -51,9 +51,3 @@ if(SINGULARITY_USE_CUDA) message(FATAL_ERROR "Cuda without kokkos is not currently supported") endif() endif() - -if(NOT SINGULARITY_USE_KOKKOS) - message(FATAL_ERROR - "For unknown reasons PORTABILITY_STRATEGY_KOKKOS will always be provided to ports-of-call. " - "For now you must use Kokkos with singularity-opac.") -endif() From 11f23b7364c4d15ae80f9d8cb06463e751cd6aab Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Wed, 25 Sep 2024 18:23:42 -0600 Subject: [PATCH 12/14] cleanup various little cmake things that were causing problems --- cmake/SetupDeps.cmake | 30 +++++++++++++++++++----------- cmake/SetupOptions.cmake | 6 ++++-- test/CMakeLists.txt | 2 +- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/cmake/SetupDeps.cmake b/cmake/SetupDeps.cmake index deb3c51..99e1ba0 100644 --- a/cmake/SetupDeps.cmake +++ b/cmake/SetupDeps.cmake @@ -10,6 +10,25 @@ else() message(status "CUDA::toolkit provided by parent package") endif() +#======================================= +# Setup Kokkos +# - provides Kokkos::kokkos +#======================================= +if (SINGULARITY_USE_KOKKOS) + if (NOT TARGET Kokkos::kokkos) + message(status "Kokkos::kokkos must be found") + if (SINGULARITY_KOKKOS_IN_TREE) + message(status "Using in-tree Kokkos") + add_subdirectory(utils/kokkos) + else() + message(status "Using system Kokkos if available") + find_package(Kokkos REQUIRED) + endif() + else() + message(status "Kokkos::kokkos provided by parent package") + endif() +endif() + #======================================= # Setup ports of call # - provides PortsofCall::PortsofCall @@ -17,17 +36,6 @@ endif() find_package(PortsofCall REQUIRED) target_link_libraries(singularity-opac::flags INTERFACE PortsofCall::PortsofCall) -#======================================= -# Setup Kokkos -# - provides Kokkos::kokkos -#======================================= -if (NOT TARGET Kokkos::kokkos) - add_subdirectory(utils/kokkos) - find_package(Kokkos QUIET) -else() - message(status "Kokkos::kokkos provided by parent package") -endif() - #======================================= # Find HDF5 # - cmake@3.20+ provides HDF5::HDF5, but diff --git a/cmake/SetupOptions.cmake b/cmake/SetupOptions.cmake index 21a857c..c8f6ced 100644 --- a/cmake/SetupOptions.cmake +++ b/cmake/SetupOptions.cmake @@ -17,11 +17,13 @@ option (SINGULARITY_USE_FMATH "Enable fast-math logarithms" ON) # Dependency options #======================================= # check for using in-tree third-party dependencies -option (SINULARITY_KOKKOS_IN_TREE "Use in-tree dependencies" OFF) - option (SINGULARITY_USE_KOKKOS "Use Kokkos for portability" OFF) option (SINGULARITY_USE_CUDA "Enable cuda support" OFF) option (SINGULARITY_USE_HDF5 "Pull in hdf5" OFF) +cmake_dependent_option(SINULARITY_KOKKOS_IN_TREE + "Use in-tree dependencies" OFF + ${SINGULARITY_USE_KOKKOS} OFF) + # If the conditional is TRUE, it's the first default, else it's the # second. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 47f13e3..21be197 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -59,7 +59,7 @@ PRIVATE # Ensure code works with C++11 and earlier # TODO(MM): Remove this later when it's not needed. set_target_properties(${PROJECT_NAME}_unit_tests - PROPERTIES CXX_STANDARD 14 + PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO) From dbb44bfad5565cecca1f50e1ab810832e7e65925 Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Wed, 25 Sep 2024 18:30:27 -0600 Subject: [PATCH 13/14] fix more weirdness. Disable package registry when appropriate. --- CMakeLists.txt | 2 +- cmake/SetupOptions.cmake | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e34cb89..b34b014 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,8 +53,8 @@ target_include_directories(singularity-opac::flags INTERFACE $) -include (SetupDeps) include (SetupOptions) +include (SetupDeps) include (SetupCompilers) include (SetupFlags) diff --git a/cmake/SetupOptions.cmake b/cmake/SetupOptions.cmake index c8f6ced..9c9e53d 100644 --- a/cmake/SetupOptions.cmake +++ b/cmake/SetupOptions.cmake @@ -24,6 +24,11 @@ cmake_dependent_option(SINULARITY_KOKKOS_IN_TREE "Use in-tree dependencies" OFF ${SINGULARITY_USE_KOKKOS} OFF) +# Kill cmake's package registry because it can interfere +if (SINGULARITY_KOKKOS_IN_TREE) + set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY ON CACHE BOOL "" FORCE) + set(CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY ON CACHE BOOL "" FORCE) +endif() # If the conditional is TRUE, it's the first default, else it's the # second. From dca807fa38e4a15cad033ddb7485fb58016282bd Mon Sep 17 00:00:00 2001 From: Ben Ryan Date: Wed, 25 Sep 2024 19:39:35 -0600 Subject: [PATCH 14/14] Add option to README --- README.md | 1 + cmake/SetupFlags.cmake | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a34156..459588f 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ A number of options are avaialable for compiling: | --------------------------------- | ------- | ------------------------------------------------------------------------------------ | | SINGULARITY_BUILD_TESTS | OFF | Build test infrastructure. | | SINGULARITY_USE_HDF5 | ON | Enables HDF5. Required for Spiner opacities. | +| SINGULARITY_KOKKOS_IN_TREE | OFF | Force cmake to use Kokkos source included in tree. | ## Copyright diff --git a/cmake/SetupFlags.cmake b/cmake/SetupFlags.cmake index beaa533..d0f6896 100644 --- a/cmake/SetupFlags.cmake +++ b/cmake/SetupFlags.cmake @@ -72,7 +72,6 @@ INTERFACE $<${with_fmath}: SINGULARITY_USE_FMATH > - PORTABILITY_STRATEGY_NONE > )