Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "utils/spiner"]
path = utils/spiner
url = https://github.com/lanl/spiner.git
[submodule "utils/variant"]
path = utils/variant
url = https://github.com/mpark/variant.git
[submodule "utils/herumi-fmath"]
path = utils/herumi-fmath
url = https://github.com/herumi/fmath.git
Expand Down
7 changes: 0 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ endif()

set(CMAKE_EXPORT_COMPILE_COMMANDS On)

# Patches variant to be compatible with cuda
# Assumes "patch" is present on system
message(STATUS "Patching mpark::variant to support GPUs")
execute_process(COMMAND patch -N -s -V never
${CMAKE_CURRENT_SOURCE_DIR}/utils/variant/include/mpark/variant.hpp
${CMAKE_CURRENT_SOURCE_DIR}/utils/cuda_compatibility.patch)
Comment on lines -83 to -88

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should simplify downstream builds a bit.


# xl fix
target_compile_options(singularity-opac::flags INTERFACE
$<$<COMPILE_LANG_AND_ID:CXX,XL>:-std=c++1y;-qxflag=disable__cplusplusOverride>)
Expand Down
2 changes: 1 addition & 1 deletion singularity-opac/base/indexers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <fast-math/logs.hpp>
#include <spiner/databox.hpp>
#include <variant/include/mpark/variant.hpp>
#include <ports-of-call/variant.hpp>

#include <singularity-opac/chebyshev/chebyshev.hpp>

Expand Down
14 changes: 7 additions & 7 deletions singularity-opac/neutrinos/mean_neutrino_s_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#include <utility>

#include <ports-of-call/portability.hpp>
#include <ports-of-call/variant.hpp>
#include <singularity-opac/base/opac_error.hpp>
#include <singularity-opac/base/radiation_types.hpp>
#include <singularity-opac/neutrinos/neutrino_s_variant.hpp>
#include <variant/include/mpark/variant.hpp>

namespace singularity {
namespace neutrinos {
Expand Down Expand Up @@ -60,11 +60,11 @@ class MeanSVariant {
!std::is_same<MeanSVariant, typename std::decay<Choice>::type>::value,
bool>::type = true>
Choice get() {
return mpark::get<Choice>(s_opac_);
return PortsOfCall::get<Choice>(s_opac_);
}

MeanSVariant GetOnDevice() {
return mpark::visit(
return PortsOfCall::visit(
[](auto &s_opac) {
return s_opac_variant<SOpacs...>(s_opac.GetOnDevice());
},
Expand All @@ -74,7 +74,7 @@ class MeanSVariant {
PORTABLE_INLINE_FUNCTION Real PlanckMeanTotalScatteringCoefficient(
const Real rho, const Real temp, const Real Ye,
const RadiationType type) const {
return mpark::visit(
return PortsOfCall::visit(
[=](const auto &s_opac) {
return s_opac.PlanckMeanTotalScatteringCoefficient(rho, temp, Ye,
type);
Expand All @@ -84,7 +84,7 @@ class MeanSVariant {
PORTABLE_INLINE_FUNCTION Real RosselandMeanTotalScatteringCoefficient(
const Real rho, const Real temp, const Real Ye,
const RadiationType type) const {
return mpark::visit(
return PortsOfCall::visit(
[=](const auto &s_opac) {
return s_opac.RosselandMeanTotalScatteringCoefficient(rho, temp, Ye,
type);
Expand All @@ -93,8 +93,8 @@ class MeanSVariant {
}

inline void Finalize() noexcept {
return mpark::visit([](auto &s_opac) { return s_opac.Finalize(); },
s_opac_);
return PortsOfCall::visit([](auto &s_opac) { return s_opac.Finalize(); },
s_opac_);
}
};

Expand Down
18 changes: 10 additions & 8 deletions singularity-opac/neutrinos/mean_neutrino_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#include <utility>

#include <ports-of-call/portability.hpp>
#include <ports-of-call/variant.hpp>
#include <singularity-opac/base/opac_error.hpp>
#include <singularity-opac/base/radiation_types.hpp>
#include <singularity-opac/neutrinos/neutrino_variant.hpp>
#include <variant/include/mpark/variant.hpp>

namespace singularity {
namespace neutrinos {
Expand Down Expand Up @@ -60,25 +60,25 @@ class MeanVariant {
!std::is_same<MeanVariant, typename std::decay<Choice>::type>::value,
bool>::type = true>
Choice get() {
return mpark::get<Choice>(opac_);
return PortsOfCall::get<Choice>(opac_);
}

MeanVariant GetOnDevice() {
return mpark::visit(
return PortsOfCall::visit(
[](auto &opac) { return opac_variant<Opacs...>(opac.GetOnDevice()); },
opac_);
}

PORTABLE_INLINE_FUNCTION RuntimePhysicalConstants
GetRuntimePhysicalConstants() const {
return mpark::visit(
return PortsOfCall::visit(
[](auto &opac) { return opac.GetRuntimePhysicalConstants(); }, opac_);
}

PORTABLE_INLINE_FUNCTION Real PlanckMeanAbsorptionCoefficient(
const Real rho, const Real temp, const Real Ye,
const RadiationType type) const {
return mpark::visit(
return PortsOfCall::visit(
[=](const auto &opac) {
return opac.PlanckMeanAbsorptionCoefficient(rho, temp, Ye, type);
},
Expand All @@ -87,20 +87,22 @@ class MeanVariant {
PORTABLE_INLINE_FUNCTION Real RosselandMeanAbsorptionCoefficient(
const Real rho, const Real temp, const Real Ye,
const RadiationType type) const {
return mpark::visit(
return PortsOfCall::visit(
[=](const auto &opac) {
return opac.RosselandMeanAbsorptionCoefficient(rho, temp, Ye, type);
},
opac_);
}

inline void Finalize() noexcept {
return mpark::visit([](auto &opac) { return opac.Finalize(); }, opac_);
return PortsOfCall::visit([](auto &opac) { return opac.Finalize(); },
opac_);
}

#ifdef SPINER_USE_HDF
void Save(const std::string &filename) const {
return mpark::visit([=](auto &opac) { return opac.Save(filename); }, opac_);
return PortsOfCall::visit([=](auto &opac) { return opac.Save(filename); },
opac_);
}
#endif
};
Expand Down
28 changes: 14 additions & 14 deletions singularity-opac/neutrinos/neutrino_s_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
#include <utility>

#include <ports-of-call/portability.hpp>
#include <ports-of-call/variant.hpp>
#include <singularity-opac/base/opac_error.hpp>
#include <singularity-opac/base/radiation_types.hpp>
#include <variant/include/mpark/variant.hpp>

namespace singularity {
namespace neutrinos {
namespace impl {

template <typename... Ts>
using s_opac_variant = mpark::variant<Ts...>;
using s_opac_variant = PortsOfCall::variant<Ts...>;

template <typename... S_Opacs>
class S_Variant {
Expand Down Expand Up @@ -62,11 +62,11 @@ class S_Variant {
!std::is_same<S_Variant, typename std::decay<Choice>::type>::value,
bool>::type = true>
Choice get() {
return mpark::get<Choice>(s_opac_);
return PortsOfCall::get<Choice>(s_opac_);
}

S_Variant GetOnDevice() {
return mpark::visit(
return PortsOfCall::visit(
[](auto &s_opac) {
return s_opac_variant<S_Opacs...>(s_opac.GetOnDevice());
},
Expand All @@ -79,7 +79,7 @@ class S_Variant {
PORTABLE_INLINE_FUNCTION Real TotalCrossSection(
const Real rho, const Real temp, const Real Ye, const RadiationType type,
const Real nu, Real *lambda = nullptr) const {
return mpark::visit(
return PortsOfCall::visit(
[=](const auto &s_opac) {
return s_opac.TotalCrossSection(rho, temp, Ye, type, nu, lambda);
},
Expand All @@ -92,7 +92,7 @@ class S_Variant {
PORTABLE_INLINE_FUNCTION Real DifferentialCrossSection(
const Real rho, const Real temp, const Real Ye, const RadiationType type,
const Real nu, const Real mu, Real *lambda = nullptr) const {
return mpark::visit(
return PortsOfCall::visit(
[=](const auto &s_opac) {
return s_opac.DifferentialCrossSection(rho, temp, Ye, type, nu, mu,
lambda);
Expand All @@ -106,7 +106,7 @@ class S_Variant {
PORTABLE_INLINE_FUNCTION Real TotalScatteringCoefficient(
const Real rho, const Real temp, const Real Ye, const RadiationType type,
const Real nu, Real *lambda = nullptr) const {
return mpark::visit(
return PortsOfCall::visit(
[=](const auto &s_opac) {
return s_opac.TotalScatteringCoefficient(rho, temp, Ye, type, nu,
lambda);
Expand All @@ -116,24 +116,24 @@ class S_Variant {

PORTABLE_INLINE_FUNCTION
int nlambda() const noexcept {
return mpark::visit([](const auto &s_opac) { return s_opac.nlambda(); },
s_opac_);
return PortsOfCall::visit(
[](const auto &s_opac) { return s_opac.nlambda(); }, s_opac_);
}

template <typename T>
PORTABLE_INLINE_FUNCTION bool IsType() const noexcept {
return mpark::holds_alternative<T>(s_opac_);
return PortsOfCall::holds_alternative<T>(s_opac_);
}

PORTABLE_INLINE_FUNCTION
void PrintParams() const noexcept {
return mpark::visit([](const auto &s_opac) { return s_opac.PrintParams(); },
s_opac_);
return PortsOfCall::visit(
[](const auto &s_opac) { return s_opac.PrintParams(); }, s_opac_);
}

inline void Finalize() noexcept {
return mpark::visit([](auto &s_opac) { return s_opac.Finalize(); },
s_opac_);
return PortsOfCall::visit([](auto &s_opac) { return s_opac.Finalize(); },
s_opac_);
}
};

Expand Down
Loading