Skip to content

Commit

Permalink
Merge pull request #4420 from multitalentloes/refactor_move_to_gpu
Browse files Browse the repository at this point in the history
refactor move_to_gpu
  • Loading branch information
kjetilly authored Jan 13, 2025
2 parents 9851aff + 0b73f91 commit 93338de
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion opm/material/common/UniformTabulated2DFunction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ class UniformTabulated2DFunction
namespace Opm::gpuistl{
template<class Scalar, class GPUContainer>
UniformTabulated2DFunction<Scalar, GPUContainer>
move_to_gpu(const UniformTabulated2DFunction<Scalar>& tab){
copy_to_gpu(const UniformTabulated2DFunction<Scalar>& tab){
return UniformTabulated2DFunction<Scalar, GPUContainer>(tab.xMin(), tab.xMax(), tab.numX(), tab.yMin(), tab.yMax(), tab.numY(), GPUContainer(tab.samples()));
}

Expand Down
6 changes: 3 additions & 3 deletions opm/material/components/CO2Tables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ namespace Opm::gpuistl {

template <class Scalar, class OldContainerType, class NewContainerType>
CO2Tables<Scalar, NewContainerType>
move_to_gpu(const CO2Tables<Scalar, OldContainerType>& oldCO2Tables) {
copy_to_gpu(const CO2Tables<Scalar, OldContainerType>& oldCO2Tables) {
return CO2Tables<Scalar, NewContainerType>(
move_to_gpu<Scalar, NewContainerType>(oldCO2Tables.getTabulatedEnthalpy()),
move_to_gpu<Scalar, NewContainerType>(oldCO2Tables.getTabulatedDensity())
copy_to_gpu<Scalar, NewContainerType>(oldCO2Tables.getTabulatedEnthalpy()),
copy_to_gpu<Scalar, NewContainerType>(oldCO2Tables.getTabulatedDensity())
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class PiecewiseLinearTwoPhaseMaterialParams : public EnsureFinalized
finalize();
}
else{
// safe if we have a GPU type instantiated by move_to_gpu or make_view
// safe if we have a GPU type instantiated by copy_to_gpu or make_view
EnsureFinalized::finalize();
}
}
Expand Down Expand Up @@ -268,7 +268,7 @@ namespace Opm::gpuistl{
/// @param params the parameters object living on the CPU
/// @return the GPU PiecewiseLinearTwoPhaseMaterialParams object
template <class GPUContainerType, class TraitsT>
PiecewiseLinearTwoPhaseMaterialParams<TraitsT, GPUContainerType> move_to_gpu(const PiecewiseLinearTwoPhaseMaterialParams<TraitsT>& params) {
PiecewiseLinearTwoPhaseMaterialParams<TraitsT, GPUContainerType> copy_to_gpu(const PiecewiseLinearTwoPhaseMaterialParams<TraitsT>& params) {

// only create the GPU object if the CPU object is finalized
params.checkFinalized();
Expand Down
4 changes: 2 additions & 2 deletions opm/material/fluidsystems/blackoilpvt/BrineCo2Pvt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ namespace Opm::gpuistl

template<class Scalar, class Params, class GPUContainer>
BrineCo2Pvt<Scalar, Params, GPUContainer>
move_to_gpu(const BrineCo2Pvt<Scalar>& cpuBrineCo2)
copy_to_gpu(const BrineCo2Pvt<Scalar>& cpuBrineCo2)
{
return BrineCo2Pvt<Scalar, Params, GPUContainer>(
GPUContainer(cpuBrineCo2.getBrineReferenceDensity()),
Expand All @@ -807,7 +807,7 @@ namespace Opm::gpuistl
cpuBrineCo2.getActivityModel(),
cpuBrineCo2.getThermalMixingModelSalt(),
cpuBrineCo2.getThermalMixingModelLiquid(),
move_to_gpu<Scalar, std::vector<Scalar>, GPUContainer>(cpuBrineCo2.getParams())
copy_to_gpu<Scalar, std::vector<Scalar>, GPUContainer>(cpuBrineCo2.getParams())
);
}

Expand Down
4 changes: 2 additions & 2 deletions opm/material/fluidsystems/blackoilpvt/Co2GasPvt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,10 @@ class Co2GasPvt
namespace Opm::gpuistl{
template<class Scalar, class Params, class GPUContainer>
Co2GasPvt<Scalar, Params, GPUContainer>
move_to_gpu(const Co2GasPvt<Scalar>& cpuCo2)
copy_to_gpu(const Co2GasPvt<Scalar>& cpuCo2)
{
return Co2GasPvt<Scalar, Params, GPUContainer>(
move_to_gpu<Scalar, std::vector<Scalar>, GPUContainer>(cpuCo2.getParams()),
copy_to_gpu<Scalar, std::vector<Scalar>, GPUContainer>(cpuCo2.getParams()),
GPUContainer(cpuCo2.getBrineReferenceDensity()),
GPUContainer(cpuCo2.getGasReferenceDensity()),
GPUContainer(cpuCo2.getSalinity()),
Expand Down

0 comments on commit 93338de

Please sign in to comment.