8#include <pybind11/pybind11.h>
9#include <pybind11/stl.h>
11namespace py = pybind11;
29 Py_GlobalOffsetsMapping
39 py::keep_alive<0, 1>())
46 py::keep_alive<0, 1>())
48 {
return self.
search(globalQuery); }, py::arg(
"globalQuery"))
50 {
return self.operator()(rank, val); }, py::arg(
"rank"), py::arg(
"val"));
67 Py_OffsetAscendIndexMapping
71 std::vector<index> pullingIndexGlobal,
73 {
return std::make_shared<OffsetAscendIndexMapping>(nmainOffset, nmainSize, pullingIndexGlobal, LGlobalMapping, mpi); }),
74 py::arg(
"nmainOffset"), py::arg(
"nmainSize"),
75 py::arg(
"pullingIndexGlobal"),
76 py::arg(
"LGlobalMapping"), py::arg(
"mpi"))
78 py::init([](
index nmainOffset,
index nmainSize,
79 std::vector<index> pushingIndexesLocal,
80 std::vector<index> pushingStarts,
83 {
return std::make_shared<OffsetAscendIndexMapping>(
84 nmainOffset, nmainSize, pushingIndexesLocal, pushingStarts, LGlobalMapping, mpi); }),
85 py::arg(
"nmainOffset"), py::arg(
"nmainSize"),
86 py::arg(
"pushingIndexLocal"), py::arg(
"pushingStarts"),
87 py::arg(
"LGlobalMapping"), py::arg(
"mpi"))
89 .def_property_readonly(
95 py::keep_alive<0, 1>())
96 .def_property_readonly(
102 py::keep_alive<0, 1>())
103 .def_property_readonly(
109 py::keep_alive<0, 1>())
110 .def_property_readonly(
111 "pullingRequestLocal",
116 py::keep_alive<0, 1>())
117 .def_property_readonly(
118 "pushingIndexGlobal",
123 py::keep_alive<0, 1>())
124 .def_property_readonly(
130 py::keep_alive<0, 1>())
131 .def_property_readonly(
137 py::keep_alive<0, 1>())
139 {
return self.
search(globalQuery); }, py::arg(
"globalQuery"))
145 {
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.
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
py::classh< T > py_class_ssp
auto pybind11_GlobalOffsetsMapping_declare(py::module_ m)
void pybind11_bind_IndexMapping_All(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)
auto pybind11_OffsetAscendIndexMapping_get_class(py::module_ m)
void pybind11_GlobalOffsetsMapping_define(py::module_ m)
auto pybind11_GlobalOffsetsMapping_get_class(py::module_ m)
py::memoryview py_vector_as_memory_view(std::vector< T > &vec, bool readonly)
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.