8#include <pybind11/pybind11.h>
9#include <pybind11/stl.h>
13namespace py = pybind11;
31 Py_GlobalOffsetsMapping
41 py::keep_alive<0, 1>())
48 py::keep_alive<0, 1>())
50 {
return self.
search(globalQuery); }, py::arg(
"globalQuery"))
52 {
return self.operator()(rank, val); }, py::arg(
"rank"), py::arg(
"val"));
69 Py_OffsetAscendIndexMapping
73 std::vector<index> pullingIndexGlobal,
75 {
return std::make_shared<OffsetAscendIndexMapping>(nmainOffset, nmainSize, pullingIndexGlobal, LGlobalMapping, mpi); }),
76 py::arg(
"nmainOffset"), py::arg(
"nmainSize"),
77 py::arg(
"pullingIndexGlobal"),
78 py::arg(
"LGlobalMapping"), py::arg(
"mpi"))
80 py::init([](
index nmainOffset,
index nmainSize,
81 std::vector<index> pushingIndexesLocal,
82 std::vector<index> pushingStarts,
85 {
return std::make_shared<OffsetAscendIndexMapping>(
86 nmainOffset, nmainSize, pushingIndexesLocal, pushingStarts, LGlobalMapping, mpi); }),
87 py::arg(
"nmainOffset"), py::arg(
"nmainSize"),
88 py::arg(
"pushingIndexLocal"), py::arg(
"pushingStarts"),
89 py::arg(
"LGlobalMapping"), py::arg(
"mpi"))
91 .def_property_readonly(
97 py::keep_alive<0, 1>())
98 .def_property_readonly(
104 py::keep_alive<0, 1>())
105 .def_property_readonly(
111 py::keep_alive<0, 1>())
112 .def_property_readonly(
113 "pullingRequestLocal",
118 py::keep_alive<0, 1>())
119 .def_property_readonly(
120 "pushingIndexGlobal",
125 py::keep_alive<0, 1>())
126 .def_property_readonly(
132 py::keep_alive<0, 1>())
133 .def_property_readonly(
139 py::keep_alive<0, 1>())
141 {
return self.
search(globalQuery); }, py::arg(
"globalQuery"))
147 {
return self.operator()(rank, val); }, py::arg(
"rank"), py::arg(
"val"));
Shared pybind11 plumbing used by every *_bind.hpp in DNDS (buffer-protocol type check,...
Global-to-local index mapping for distributed arrays.
Eigen::Matrix< real, 3, 3 > m
Table mapping rank-local row indices to the global index space.
index globalSize() const
Total number of rows across all ranks.
t_IndexVec & ROffsets()
Prefix-sum offsets vector (size == nRanks + 1, last element == globalSize).
void setMPIAlignBcast(const MPIInfo &mpi, index myLength)
Broadcast each rank's length, then compute the global prefix sums.
bool search(index globalQuery, MPI_int &rank, index &val) const
Convert a global index to (rank, local). Returns false if out of range.
t_IndexVec & RLengths()
Per-rank lengths vector (size == nRanks).
Mapping between a rank's main data and its ghost copies.
bool search_indexAppend(index globalQuery, MPI_int &rank, index &val) const
Like search, but the returned val is in the concatenated father+son address space.
t_IndexVec ghostIndex
Global indices of all ghost rows on this rank, ascending. (a.k.a. pullingIndexGlobal)
t_IndexVec pushingIndexGlobal
Global indices this rank sends to others, grouped by receiver.
bool search_indexRank(index globalQuery, MPI_int &rank, index &val) const
Like search, but val is expressed relative to the owner rank's ghost slab (ghostStart[rank]-relative)...
index & ghostAt(MPI_int rank, index ighost)
Direct mutable access to the ighost-th ghost global index for peer rank.
tMPI_intVec pushIndexSizes
Per-peer number of rows this rank will send out on a push.
t_MapIndexVec ghostStart
Per-peer prefix-sum offsets into ghostIndex (size == nRanks + 1). (a.k.a. pullIndexStarts)
tMPI_intVec ghostSizes
Number of ghost rows pulled from each peer rank. (a.k.a. pullIndexSizes)
t_IndexVec pullingRequestLocal
Optional cached local-index form of ghostIndex (unused in current code).
t_MapIndexVec pushIndexStarts
Per-peer prefix-sum offsets into pushingIndexGlobal.
bool search(index globalQuery, MPI_int &rank, index &val) const
Search main + ghost in one call. rank == -1 signals "hit in main".
the host side operators are provided as implemented
void pybind11_bind_IndexMapping_All(const py::module_ &m)
py::classh< T > py_class_ssp
auto pybind11_GlobalOffsetsMapping_declare(py::module_ m)
void pybind11_OffsetAscendIndexMapping_define(py::module_ m)
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
auto pybind11_OffsetAscendIndexMapping_declare(py::module_ m)
void pybind11_GlobalOffsetsMapping_define(py::module_ m)
auto pybind11_OffsetAscendIndexMapping_get_class(const py::module_ &m)
py::memoryview py_vector_as_memory_view(std::vector< T > &vec, bool readonly)
auto pybind11_GlobalOffsetsMapping_get_class(const py::module_ &m)
int MPI_int
MPI counterpart type for MPI_int (= C int). Used for counts and ranks in MPI calls.
Lightweight bundle of an MPI communicator and the calling rank's coordinates.