19 #ifndef OPM_GPUISTL_GPUOBLIVIOUSMPISENDER_HPP 20 #define OPM_GPUISTL_GPUOBLIVIOUSMPISENDER_HPP 22 #include <dune/istl/owneroverlapcopy.hh> 24 #include <opm/simulators/linalg/FlowLinearSolverParameters.hpp> 25 #include <opm/simulators/linalg/gpuistl/GpuSender.hpp> 26 #include <opm/simulators/linalg/gpuistl/GpuVector.hpp> 42 template <
class field_type,
int block_size,
class OwnerOverlapCopyCommunicationType>
57 auto sourceAsDuneVector = source.template asDuneBlockVector<block_size>();
58 auto destAsDuneVector = dest.template asDuneBlockVector<block_size>();
59 this->m_cpuOwnerOverlapCopy.copyOwnerToAll(sourceAsDuneVector, destAsDuneVector);
60 dest.copyFromHost(destAsDuneVector);
64 void initIndexSet()
const override 68 const auto& pis = this->m_cpuOwnerOverlapCopy.indexSet();
69 std::vector<int> indicesCopyOnCPU;
70 std::vector<int> indicesOwnerCPU;
71 for (
const auto& index : pis) {
72 if (index.local().attribute() == Dune::OwnerOverlapCopyAttributeSet::copy) {
73 for (
int component = 0; component < block_size; ++component) {
74 indicesCopyOnCPU.push_back(index.local().local() * block_size + component);
78 if (index.local().attribute() == Dune::OwnerOverlapCopyAttributeSet::owner) {
79 for (
int component = 0; component < block_size; ++component) {
80 indicesOwnerCPU.push_back(index.local().local() * block_size + component);
85 this->m_indicesCopy = std::make_unique<GpuVector<int>>(indicesCopyOnCPU);
86 this->m_indicesOwner = std::make_unique<GpuVector<int>>(indicesOwnerCPU);
92 #endif // OPM_GPUISTL_GPUOBLIVIOUSMPISENDER_HPP
void copyOwnerToAll(const X &source, X &dest) const override
copyOwnerToAll will copy the data in source to all processes.
Definition: GpuObliviousMPISender.hpp:53
Derived class of GPUSender that handles MPI calls that should NOT use GPU direct communicatoin The im...
Definition: GpuObliviousMPISender.hpp:43
GPUSender is a wrapper class for classes which will implement copOwnerToAll This is implemented with ...
Definition: GpuSender.hpp:43
A small, fixed‑dimension MiniVector class backed by std::array that can be used in both host and CUD...
Definition: AmgxInterface.hpp:37