Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kjetilly
Copy link
Contributor

@kjetilly kjetilly commented Jul 31, 2025

This is a resurrection of PR #4504 with some slight modifications. Making it draft as of now.

This PR adds the needed copy_to_gpu and make_view functions for the BlackOilFluidSystem. To keep the mental cost low for the newly added functions, a slight refactor has been done to the lower level copy_to_gpu and make_view functions for the multiplexer, PVTs and CO2 tables in that they no longer receive the storage classes as template arguments, but deduce them themselves.

This change is possible since we are using the newly introduced header file gpuistl_if_available.hpp which will include the gpu-ISTL headers (or the core of them, meaning the buffer, vector, view and smart_pointer) if HAVE_CUDA=1.

@kjetilly
Copy link
Contributor Author

jenkins build this serial rocm hipify please

@kjetilly kjetilly added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Jul 31, 2025
@kjetilly kjetilly changed the title Testblackoilfluidsystemnonstaticbykjetil GPU support for the black oil fluid system Jul 31, 2025
@kjetilly
Copy link
Contributor Author

jenkins build this serial rocm hipify please

@kjetilly
Copy link
Contributor Author

kjetilly commented Aug 4, 2025

Jenkins build this opm-simulators=6385 serial rocm hipify please

@kjetilly
Copy link
Contributor Author

kjetilly commented Aug 4, 2025

Jenkins build this opm-simulators=6385 serial rocm hipify please

2 similar comments
@kjetilly
Copy link
Contributor Author

kjetilly commented Aug 4, 2025

Jenkins build this opm-simulators=6385 serial rocm hipify please

@kjetilly
Copy link
Contributor Author

kjetilly commented Aug 4, 2025

Jenkins build this opm-simulators=6385 serial rocm hipify please

@kjetilly kjetilly marked this pull request as ready for review August 4, 2025 17:25
@kjetilly
Copy link
Contributor Author

kjetilly commented Aug 5, 2025

Jenkins build this opm-simulators=6385 serial rocm hipify please

@kjetilly kjetilly requested a review from atgeirr August 5, 2025 08:11
Copy link
Member

@atgeirr atgeirr left a comment

Choose a reason for hiding this comment

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

Partially reviewed only, stopping here to get feedback before continuing.

@kjetilly kjetilly force-pushed the testblackoilfluidsystemnonstaticbykjetil branch from b103af0 to 9c003b5 Compare August 11, 2025 17:03
@kjetilly
Copy link
Contributor Author

Jenkins build this opm-simulators=6385 serial rocm hipify please

2 similar comments
@kjetilly
Copy link
Contributor Author

Jenkins build this opm-simulators=6385 serial rocm hipify please

@kjetilly
Copy link
Contributor Author

Jenkins build this opm-simulators=6385 serial rocm hipify please

*/
#if HAVE_CUDA
#if USE_HIP
#include <opm/simulators/linalg/gpuistl_hip/GpuVector.hpp>
Copy link
Member

@multitalentloes multitalentloes Aug 13, 2025

Choose a reason for hiding this comment

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

As this pattern becomes more prevalent with the new PRs we should prioritize more either unifying these paths in cmake (i do not know how to do this), or maybe introduce a macro that handles this logic for us. Not necessary for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, for now at least, this file isolates it pretty well though, in the sense that one only has to include this file and not worry about it outside of this file.


} // namespace Opm

#endif // OPM_NULL_OIL_PVT_HPP No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

missing endline

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

* Used when oil phase is not active or not supported.
*/
template <class Scalar>
class NullOilPvt
Copy link
Member

Choose a reason for hiding this comment

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

The NullOilPvt is needed because we do not support Oil for now in the GPU-variant but still need to have some object with the oil interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly. The big change was that we removed pointers from the BOFS, meaning we could no longer simply put the OilPvt-pointer to null.

#include <opm/simulators/linalg/gpuistl_hip/GpuBuffer.hpp>
#include <opm/simulators/linalg/gpuistl_hip/GpuView.hpp>
#include <opm/simulators/linalg/gpuistl_hip/gpu_smart_pointer.hpp>
#else // USE_HIP
Copy link
Member

Choose a reason for hiding this comment

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

USE_HIP i guess annotates what the #if is based on, but it looks a bit misleading when it marks the start of the case where we are primarily interested i fact that USE_HIP is false and that HAVE_CUDA is true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@kjetilly kjetilly force-pushed the testblackoilfluidsystemnonstaticbykjetil branch from 4697233 to ee20570 Compare August 13, 2025 08:45
@kjetilly
Copy link
Contributor Author

Jenkins build this opm-simulators=6385 serial rocm hipify please

bool _enableVaporizedOil_,
bool _enableVaporizedWater_,
bool _enableDiffusion_,
Storage<std::array<Scalar, 3>> _referenceDensity_,
Copy link
Member

Choose a reason for hiding this comment

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

I propose taking an rvalue ref argument here, and using std::move on line 221, similar for the other data.

Copy link
Member

Choose a reason for hiding this comment

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

Apart from this, I have no further requests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@kjetilly
Copy link
Contributor Author

Jenkins build this opm-simulators=6385 serial rocm hipify please

1 similar comment
@kjetilly
Copy link
Contributor Author

Jenkins build this opm-simulators=6385 serial rocm hipify please

@kjetilly
Copy link
Contributor Author

Jenkins build this opm-simulators=6385 serial rocm hipify please

1 similar comment
@kjetilly
Copy link
Contributor Author

Jenkins build this opm-simulators=6385 serial rocm hipify please

@atgeirr
Copy link
Member

atgeirr commented Aug 14, 2025

Both this and the downstream PR have been reviewed and revised, all is green, merging.

@atgeirr atgeirr merged commit a9e6923 into OPM:master Aug 14, 2025
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