diff --git a/new_python/genericio.cpp b/new_python/genericio.cpp index 59cf08b5e5b50c2019634cd07ba18cfaf3b6df1d..8719477a9dbf27d70df43db99cf430fb2eba6951 100644 --- a/new_python/genericio.cpp +++ b/new_python/genericio.cpp @@ -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);