Commit 36a6fac5 authored by Michael Buehlmann's avatar Michael Buehlmann
Browse files

add eff_rank to python interface

parent 15bbb3f1
......@@ -64,7 +64,8 @@ public:
std::map<std::string, py::array> read(
std::optional<std::vector<std::string>> var_names,
bool print_stats=true,
bool collective_stats=true
bool collective_stats=true,
int eff_rank=-1
) {
// read number of elements
int64_t num_elem = readNumElems();
......@@ -108,7 +109,7 @@ public:
}
}
readData(-1, print_stats, collective_stats);
readData(eff_rank, print_stats, collective_stats);
#ifndef GENERICIO_NO_MPI
MPI_Barrier(MPI_COMM_WORLD);
#endif
......@@ -147,14 +148,15 @@ std::map<std::string, py::array> read_genericio(
PyGenericIO::MismatchBehavior redistribute=PyGenericIO::MismatchBehavior::MismatchRedistribute,
bool print_stats=true,
bool collective_stats=true,
bool rebalance_source_ranks=false
bool rebalance_source_ranks=false,
int eff_rank=-1
) {
PyGenericIO reader(filename, method, redistribute);
#ifndef GENERICIO_NO_MPI
if(rebalance_source_ranks)
reader.rebalanceSourceRanks();
#endif
return reader.read(var_names, print_stats, collective_stats);
return reader.read(var_names, print_stats, collective_stats, eff_rank);
}
void inspect_genericio(
......@@ -256,7 +258,12 @@ PYBIND11_MODULE(pygio, m) {
.def("read_total_num_elems", (uint64_t (PyGenericIO::*)(void))(&PyGenericIO::readTotalNumElems))
.def("read_phys_origin", &PyGenericIO::read_phys_origin)
.def("read_phys_scale", &PyGenericIO::read_phys_scale)
.def("read", &PyGenericIO::read, py::arg("variables")=nullptr, py::arg("print_stats")=true, py::arg("collective_stats")=true)
.def("read", &PyGenericIO::read,
py::kw_only(),
py::arg("variables")=nullptr,
py::arg("print_stats")=true,
py::arg("collective_stats")=true,
py::arg("eff_rank")=-1)
.def("get_source_ranks", &PyGenericIO::getSourceRanks)
#ifndef GENERICIO_NO_MPI
.def("rebalance_source_ranks", &PyGenericIO::rebalanceSourceRanks)
......@@ -281,7 +288,8 @@ PYBIND11_MODULE(pygio, m) {
py::arg("redistribute")=PyGenericIO::MismatchBehavior::MismatchRedistribute,
py::arg("print_stats")=true,
py::arg("collective_stats")=true,
py::arg("rebalance_sourceranks")=false,
py::arg("rebalance_sourceranks")=false,
py::arg("eff_rank")=-1,
py::return_value_policy::move);
m.def("inspect_genericio", &inspect_genericio,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment