Skip to content

GPU assembly support on AMD and CUDA - #7042

Merged
atgeirr merged 2 commits into
OPM:masterfrom
multitalentloes:add_gpu_thermalgaswaterassembly2
Jun 5, 2026
Merged

atgeirr merged 2 commits into
OPM:masterfrom
multitalentloes:add_gpu_thermalgaswaterassembly2

Conversation

@multitalentloes

Copy link
Copy Markdown
Member

The GPU assembly support extracted from #7018
Still contains more code than necessary from that branch to support the assembly, but the goal is to reduce this PR to be as small as possible yet support the new GPU linearization.

@multitalentloes multitalentloes added the manual:irrelevant This PR is a minor fix and should not appear in the manual label May 7, 2026
@multitalentloes
multitalentloes force-pushed the add_gpu_thermalgaswaterassembly2 branch 2 times, most recently from d3c8416 to 60c8298 Compare May 8, 2026 07:59
@atgeirr
atgeirr requested a review from Copilot May 11, 2026 08:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extracts and wires up GPU matrix assembly/linearization support for Flow (CUDA + HIP/AMD), building on prior GPU POC work, and introduces GPU-oriented model/problem shims plus supporting GPU ISTL utilities.

Changes:

  • Add GPU TPFA linearization/assembly path with supporting GPU data transfers (intensive quantities, boundary info, residual/Jacobian buffers).
  • Introduce simplified GPU-friendly model/problem wrappers used by the GPU assembly kernels.
  • Extend GPU ISTL utilities (typed diagonal block pointers; GpuView access changes) and update build system to compile a flow_gpu variant.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/gpuistl/test_GpuSparseTable.cu Extends kernel test to validate SparseTable::dataSize() usage on device.
opm/simulators/linalg/gpuistl/GpuView.hpp Adjusts operator[] to return const T&; adds an extra include.
opm/simulators/linalg/gpuistl/detail/gpusparse_matrix_operations.hpp Declares typed diagonal block pointer extraction API.
opm/simulators/linalg/gpuistl/detail/gpusparse_matrix_operations.cu Implements getDiagPtrsTyped() and instantiates for MiniMatrix block sizes.
opm/simulators/flow/Transmissibility.hpp Adds accessor for thermal boundary half-transmissibility map.
opm/simulators/flow/Transmissibility_impl.hpp Implements new transmissibility map accessor.
opm/simulators/flow/SimplifiedGpuBlackOilModel.hpp Adds simplified FI black-oil model wrapper and GPU copy/view helpers.
opm/simulators/flow/SimplifiedFlowProblemGPU.hpp Adds simplified GPU problem wrapper for boundary thermal transmissibility (alpha) + module params.
opm/simulators/flow/NewTranFluxModule.hpp Generalizes pressure-diff calculation template to accept alternative module params type.
opm/simulators/flow/FlowProblem.hpp Exposes thermalLawManager() accessor.
opm/simulators/aquifers/BlackoilAquiferModel.hpp Disables SupportsFaceTag include (commented).
opm/simulators/aquifers/BlackoilAquiferModel_impl.hpp Disables grid SupportsFaceTag static_assert (commented).
opm/models/discretization/common/tpfalinearizer.hh Major: adds GPU assembly path (domain/neighbor/boundary transfers, kernels, GPU Jacobian/residual handling).
opm/models/discretization/common/fvbaseproperties.hh Introduces to_gpu_type(_t) mapping and a GpuFIBlackOilModel property hook.
opm/models/discretization/common/fvbasediscretization.hh Adds helpers to fetch all cached IQs (timeIdx 0/1) and a numDof() accessor.
opm/models/blackoil/blackoillocalresidualtpfa.hh Refactors boundary flux handling for GPU/non-static fluid system; adds GPU-related helpers.
opm/models/blackoil/blackoilintensivequantities.hh Adjusts assignment for host/device; adds GPU-switch constructors; changes withOtherFluidSystem() to accept a pointer.
opm/models/blackoil/blackoilextbomodules.hh Replaces a raw throw with OPM_THROW.
opm/models/blackoil/blackoildiffusionmodule.hh Adds accessors for diffusion/tortuosity arrays; marks update as host/device.
opm/models/blackoil/blackoilconvectivemixingmodule.hh Minor fluid-system index usage adjustments; adds a fluidsystem include.
flow/flow_gpu.hpp Adds GPU flow typetag mapping and declarations shared between CUDA/HIP entrypoints.
flow/flow_gpu.hip Adds HIP entrypoint implementation for GPU flow variant.
flow/flow_gpu.cu Adds CUDA entrypoint implementation for GPU flow variant.
flow/flow_gpu_main.cpp Adds standalone main for flow_gpu binary.
CMakeLists.txt Adds gpu Flow model variant and selects .cu/.hip source accordingly.
CMakeLists_files.cmake Adds per-file CUDA flags for new GPU sources and installs new public headers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread opm/simulators/linalg/gpuistl/GpuView.hpp Outdated
Comment thread opm/simulators/flow/SimplifiedFlowProblemGPU.hpp Outdated
Comment thread opm/simulators/flow/SimplifiedFlowProblemGPU.hpp Outdated
Comment thread opm/simulators/flow/SimpleFIBlackOilModel.hpp
Comment thread opm/simulators/aquifers/BlackoilAquiferModel.hpp Outdated
Comment thread opm/simulators/aquifers/BlackoilAquiferModel_impl.hpp Outdated
Comment thread opm/models/blackoil/blackoilintensivequantities.hh
Comment thread opm/models/discretization/common/fvbasediscretization.hh Outdated
@multitalentloes

Copy link
Copy Markdown
Member Author

jenkins build this rocm hipify please

1 similar comment
@multitalentloes

Copy link
Copy Markdown
Member Author

jenkins build this rocm hipify please

@multitalentloes
multitalentloes force-pushed the add_gpu_thermalgaswaterassembly2 branch from cf63b1d to 00cda7b Compare May 19, 2026 11:30
@multitalentloes

Copy link
Copy Markdown
Member Author

jenkins build this rocm hipify please

@multitalentloes

Copy link
Copy Markdown
Member Author

jenkins build this rocm hipify please

2 similar comments
@multitalentloes

Copy link
Copy Markdown
Member Author

jenkins build this rocm hipify please

@multitalentloes

Copy link
Copy Markdown
Member Author

jenkins build this rocm hipify please

@multitalentloes
multitalentloes force-pushed the add_gpu_thermalgaswaterassembly2 branch from 5119d1b to e2008b5 Compare May 27, 2026 13:00
@multitalentloes

Copy link
Copy Markdown
Member Author

jenkins build this rocm hipify please

@multitalentloes
multitalentloes force-pushed the add_gpu_thermalgaswaterassembly2 branch 2 times, most recently from 652c705 to 6df49d5 Compare May 28, 2026 13:22
@multitalentloes

Copy link
Copy Markdown
Member Author

jenkins build this rocm hipify please

1 similar comment
@multitalentloes

Copy link
Copy Markdown
Member Author

jenkins build this rocm hipify please

@multitalentloes
multitalentloes force-pushed the add_gpu_thermalgaswaterassembly2 branch from 73fa1a4 to f5b497e Compare June 2, 2026 10:03
@multitalentloes

Copy link
Copy Markdown
Member Author

jenkins build this rocm hipify please

1 similar comment
@multitalentloes

Copy link
Copy Markdown
Member Author

jenkins build this rocm hipify please

@multitalentloes

Copy link
Copy Markdown
Member Author

Tests now pass after reverting a small and recent change in OPM/opm-common#5200

@multitalentloes
multitalentloes force-pushed the add_gpu_thermalgaswaterassembly2 branch from f810144 to 9a3a4f5 Compare June 3, 2026 14:42
@multitalentloes
multitalentloes force-pushed the add_gpu_thermalgaswaterassembly2 branch from 9a3a4f5 to 5900098 Compare June 4, 2026 11:44
@atgeirr

atgeirr commented Jun 4, 2026

Copy link
Copy Markdown
Member

jenkins build this rocm hipify please

@atgeirr atgeirr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This has been a lot of work, but I think we have reached the point where it can be merged when green!

@atgeirr
atgeirr merged commit 44b8b5a into OPM:master Jun 5, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:irrelevant This PR is a minor fix and should not appear in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants