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

FluidState & TwoPhaseMaterial on GPU #4194

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,11 @@ if(ENABLE_ECL_INPUT)
opm/material/fluidmatrixinteractions/EclHysteresisConfig.cpp
opm/material/fluidmatrixinteractions/EclMaterialLawManager.cpp
opm/material/fluidmatrixinteractions/EclMaterialLawManagerReadEffectiveParams.cpp
opm/material/fluidmatrixinteractions/EclMaterialLawManagerSimple.cpp
opm/material/fluidmatrixinteractions/EclMaterialLawManagerSimpleReadEffectiveParams.cpp
opm/material/fluidmatrixinteractions/EclMaterialLawManagerSimpleHystParams.cpp
opm/material/fluidmatrixinteractions/EclMaterialLawManagerInitParams.cpp
opm/material/fluidmatrixinteractions/EclMaterialLawManagerSimpleInitParams.cpp
opm/material/fluidmatrixinteractions/EclMaterialLawManagerHystParams.cpp
opm/material/fluidsystems/blackoilpvt/BrineCo2Pvt.cpp
opm/material/fluidsystems/blackoilpvt/Co2GasPvt.cpp
Expand Down Expand Up @@ -983,6 +987,7 @@ list( APPEND PUBLIC_HEADER_FILES
opm/material/fluidmatrixinteractions/EclEpsTwoPhaseLaw.hpp
opm/material/fluidmatrixinteractions/TwoPhaseLETCurves.hpp
opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp
opm/material/fluidmatrixinteractions/EclMaterialLawManagerSimple.hpp
opm/material/fluidmatrixinteractions/DirectionalMaterialLawParams.hpp
opm/material/fluidmatrixinteractions/DirectionalMaterialLawParams.hpp
opm/material/fluidmatrixinteractions/RegularizedVanGenuchten.hpp
Expand Down
6 changes: 3 additions & 3 deletions bin/genEvalSpecializations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# This script provides "hand loop-unrolled" specializations of the
# Evaluation class of dense automatic differentiation so that the
# compiler can more easily emit SIMD instructions. In an ideal world,
# C++ compilers should be smart enough to do this themselfs, but
# C++ compilers should be smart enough to do this themselves, but
# contemporary compilers don't seem to exhibit enough brains.
#
# Usage: In the opm-material top-level source directory, run
# Usage: In the opm-common top-level source directory, run
# `./bin/genEvalSpecializations.py [MAX_DERIVATIVES]`. The script then
# generates specializations for Evaluations with up to MAX_DERIVATIVES
# derivatives. The default for MAX_DERIVATIVES is 12. To run this
Expand Down Expand Up @@ -180,7 +180,7 @@ class Evaluation<ValueT, {{ numDerivs }}>
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
{% if numDerivs < 0 %}\
for (int i = dstart_(); i < dend_(); ++i)
Valgrind::CheckDefined(data_[i]);
Expand Down
3 changes: 2 additions & 1 deletion opm/material/common/EnsureFinalized.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ class EnsureFinalized

OPM_HOST_DEVICE void check() const
{
#if USE_OPM_CHECK_PARAM_FINALIZED
// TODO: find a proper way to handle this on the gpu, the whole purpose is avoided when not throwing
#if USE_OPM_CHECK_PARAM_FINALIZED && !OPM_IS_INSIDE_DEVICE_FUNCTION
if (!finalized_)
throw std::runtime_error("Parameter class has not been finalized before usage!");
#endif
Expand Down
2 changes: 1 addition & 1 deletion opm/material/densead/DynamicEvaluation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Evaluation<ValueT, DynamicSize, staticSize>
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
for (int i = dstart_(); i < dend_(); ++i)
Valgrind::CheckDefined(data_[i]);
#endif
Expand Down
2 changes: 1 addition & 1 deletion opm/material/densead/Evaluation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Evaluation
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
for (const auto& v: data_)
Valgrind::CheckDefined(v);
#endif
Expand Down
2 changes: 1 addition & 1 deletion opm/material/densead/Evaluation1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Evaluation<ValueT, 1>
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
for (const auto& v: data_)
Valgrind::CheckDefined(v);
#endif
Expand Down
2 changes: 1 addition & 1 deletion opm/material/densead/Evaluation10.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Evaluation<ValueT, 10>
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
for (const auto& v: data_)
Valgrind::CheckDefined(v);
#endif
Expand Down
2 changes: 1 addition & 1 deletion opm/material/densead/Evaluation11.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Evaluation<ValueT, 11>
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
for (const auto& v: data_)
Valgrind::CheckDefined(v);
#endif
Expand Down
2 changes: 1 addition & 1 deletion opm/material/densead/Evaluation12.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Evaluation<ValueT, 12>
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
for (const auto& v: data_)
Valgrind::CheckDefined(v);
#endif
Expand Down
2 changes: 1 addition & 1 deletion opm/material/densead/Evaluation2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Evaluation<ValueT, 2>
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
for (const auto& v: data_)
Valgrind::CheckDefined(v);
#endif
Expand Down
2 changes: 1 addition & 1 deletion opm/material/densead/Evaluation3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Evaluation<ValueT, 3>
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
for (const auto& v: data_)
Valgrind::CheckDefined(v);
#endif
Expand Down
2 changes: 1 addition & 1 deletion opm/material/densead/Evaluation4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Evaluation<ValueT, 4>
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
for (const auto& v: data_)
Valgrind::CheckDefined(v);
#endif
Expand Down
2 changes: 1 addition & 1 deletion opm/material/densead/Evaluation5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Evaluation<ValueT, 5>
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
for (const auto& v: data_)
Valgrind::CheckDefined(v);
#endif
Expand Down
2 changes: 1 addition & 1 deletion opm/material/densead/Evaluation6.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Evaluation<ValueT, 6>
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
for (const auto& v: data_)
Valgrind::CheckDefined(v);
#endif
Expand Down
2 changes: 1 addition & 1 deletion opm/material/densead/Evaluation7.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Evaluation<ValueT, 7>
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
for (const auto& v: data_)
Valgrind::CheckDefined(v);
#endif
Expand Down
2 changes: 1 addition & 1 deletion opm/material/densead/Evaluation8.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Evaluation<ValueT, 8>
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
for (const auto& v: data_)
Valgrind::CheckDefined(v);
#endif
Expand Down
2 changes: 1 addition & 1 deletion opm/material/densead/Evaluation9.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Evaluation<ValueT, 9>
//! Evaluation object are well-defined.
OPM_HOST_DEVICE void checkDefined_() const
{
#ifndef NDEBUG
#if !defined(NDEBUG) && !OPM_IS_INSIDE_DEVICE_FUNCTION
for (const auto& v: data_)
Valgrind::CheckDefined(v);
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class EclHysteresisTwoPhaseLaw : public EffectiveLawT::Traits
//! are dependent on the phase composition
static constexpr bool isCompositionDependent = false;

static constexpr bool isHysteresisDependent = true;

/*!
* \brief The capillary pressure-saturation curves depending on absolute saturations.
*
Expand Down
Loading