Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Meyer Andersen committed Oct 1, 2024
1 parent 118d891 commit 7d8f268
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion opm/simulators/linalg/gpuistl/GpuBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class GpuBuffer
* @brief size returns the size (number of T elements) in the buffer
* @return number of elements
*/
size_type size() const;
__host__ __device__ size_type size() const;

/**
* @brief resize the number of elements that fit in the buffer, shrinking it causes truncation
Expand Down
25 changes: 24 additions & 1 deletion tests/gpuistl/test_co2gaspvt.cu
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,34 @@ using CpuCo2Pvt = Opm::Co2GasPvt<double>;
using GpuBufCo2Pvt = Opm::Co2GasPvt<double, GpuB>;
using GpuViewCo2Pvt = Opm::Co2GasPvt<double, GpuV>;

namespace {
// TODO: understand why this particular class seemingly has to be explicitly instantiated
// template class Opm::Co2GasPvt<double, Opm::gpuistl::GpuBuffer<double> const>;
// template class Opm::Co2GasPvt<double, Opm::gpuistl::GpuView<double const>>;

namespace {

/*
This file containts tests using Co2GasPvt on the GPU in addition to helper objects
*/
// TODO: Rewrite these tests using a fixture pattern to greatly reduce the code duplication

// struct Fixture {
// Fixture(){
// double viscosity = Opm::CO2<double>::gasViscosity<Evaluation>(temp, pressure, true).value();

// // make a nonstatic version of the CPU CO2
// Opm::CO2NonStatic<double> CO2(Opm::CO2<double>::getEnthalpy(), Opm::CO2<double>::getDensity());

// const auto gpuEnthalpyBuffer = Opm::gpuistl::move_to_gpu<double, GpuB>(CO2.getEnthalpy());
// const auto gpuDensityBuffer = Opm::gpuistl::move_to_gpu<double, GpuB>(CO2.getDensity());

// const auto gpuEnthalpyView = Opm::gpuistl::make_view<double, GpuB, GpuV>(gpuEnthalpyBuffer);
// const auto gpuDensityView = Opm::gpuistl::make_view<double, GpuB, GpuV>(gpuDensityBuffer);
// }
// ~Fixture(){

// }
// };

// Kernel to evaluate a 2D function on the GPU
__global__ void gpuEvaluateUniformTabulated2DFunction(GpuTab gpuTab, Evaluation* inputX, Evaluation* inputY, double* res) {
Expand Down

0 comments on commit 7d8f268

Please sign in to comment.