ginkgo-project / ginkgo

Numerical linear algebra software package
https://ginkgo-project.github.io/
BSD 3-Clause "New" or "Revised" License
384 stars 86 forks source link

WIP read_distributed with pre-existing data #1631

Closed greole closed 4 days ago

greole commented 5 days ago

This PR adds a version of read_distributed that works on existing local data and non_local_data and comm_pattern.

yhmtsai commented 4 days ago

Is it more straight way in openFoam application? you can also do it with create function from existing linop and comm pattern.

greole commented 4 days ago

I'll add an extra constructor/create function. The reasoning is that we basically already local and non_local dataand the communication pattern already in place from OpenFOAM.

greole commented 4 days ago

I just realised that the following create method should be sufficient:

template <typename ValueType, typename LocalIndexType, typename GlobalIndexType>
std::unique_ptr<Matrix<ValueType, LocalIndexType, GlobalIndexType>>
Matrix<ValueType, LocalIndexType, GlobalIndexType>::create(
    std::shared_ptr<const Executor> exec, mpi::communicator comm, dim<2> size,
    std::shared_ptr<LinOp> local_linop, std::shared_ptr<LinOp> non_local_linop,
    std::vector<comm_index_type> recv_sizes,
    std::vector<comm_index_type> recv_offsets,
    array<local_index_type> recv_gather_idxs)
upsj commented 4 days ago

@greole Agreed in general, though we should be using the abstractions from #1588 and #1589 once they are available, instead of raw vectors/arrays