Commit 130d5f6b authored by Michael Buehlmann's avatar Michael Buehlmann
Browse files

add print_stats to new_python

allows suprressing the "Read [...] variables ... " stdout logs
parent 5a76af8b
......@@ -61,7 +61,11 @@ public:
}
}
std::map<std::string, py::array> read(std::optional<std::vector<std::string>> var_names) {
std::map<std::string, py::array> read(
std::optional<std::vector<std::string>> var_names,
bool print_stats=true,
bool collective_stats=true
) {
// read number of elements
int64_t num_elem = readNumElems();
......@@ -104,7 +108,7 @@ public:
}
}
readData();
readData(-1, print_stats, collective_stats);
#ifndef GENERICIO_NO_MPI
MPI_Barrier(MPI_COMM_WORLD);
#endif
......@@ -141,6 +145,8 @@ std::map<std::string, py::array> read_genericio(
std::optional<std::vector<std::string>> var_names,
PyGenericIO::FileIO method=PyGenericIO::FileIO::FileIOPOSIX,
PyGenericIO::MismatchBehavior redistribute=PyGenericIO::MismatchBehavior::MismatchRedistribute,
bool print_stats=true,
bool collective_stats=true,
bool rebalance_source_ranks=false
) {
PyGenericIO reader(filename, method, redistribute);
......@@ -148,7 +154,7 @@ std::map<std::string, py::array> read_genericio(
if(rebalance_source_ranks)
reader.rebalanceSourceRanks();
#endif
return reader.read(var_names);
return reader.read(var_names, print_stats, collective_stats);
}
void inspect_genericio(
......@@ -250,7 +256,7 @@ 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)
.def("read", &PyGenericIO::read, py::arg("variables")=nullptr, py::arg("print_stats")=true, py::arg("collective_stats")=true)
.def("get_source_ranks", &PyGenericIO::getSourceRanks)
#ifndef GENERICIO_NO_MPI
.def("rebalance_source_ranks", &PyGenericIO::rebalanceSourceRanks)
......@@ -273,6 +279,8 @@ PYBIND11_MODULE(pygio, m) {
py::kw_only(),
py::arg("method")=PyGenericIO::FileIO::FileIOPOSIX,
py::arg("redistribute")=PyGenericIO::MismatchBehavior::MismatchRedistribute,
py::arg("print_stats")=true,
py::arg("collective_stats")=true,
py::arg("rebalance_sourceranks")=false,
py::return_value_policy::move);
......
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