From: Arnaud Giersch Date: Tue, 1 Jun 2021 12:50:07 +0000 (+0200) Subject: Useless tests for emptyness. X-Git-Tag: v3.28~185 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/2e76d911c8346bb816bc9d1cc4d0c96bf28c56a5 Useless tests for emptyness. --- diff --git a/examples/cpp/routing-get-clusters/s4u-routing-get-clusters.cpp b/examples/cpp/routing-get-clusters/s4u-routing-get-clusters.cpp index 22e7c1ab80..660f1eb896 100644 --- a/examples/cpp/routing-get-clusters/s4u-routing-get-clusters.cpp +++ b/examples/cpp/routing-get-clusters/s4u-routing-get-clusters.cpp @@ -27,13 +27,11 @@ int main(int argc, char* argv[]) std::vector dragonfly_clusters = e.get_filtered_netzones(); - if (not dragonfly_clusters.empty()) { - for (auto d : dragonfly_clusters) { - XBT_INFO("%s' dragonfly topology:", d->get_cname()); - for (int i = 0; i < d->get_host_count(); i++) { - const simgrid::kernel::routing::DragonflyZone::Coords coords = d->rankId_to_coords(i); - XBT_INFO(" %d: (%u, %u, %u, %u)", i, coords.group, coords.chassis, coords.blade, coords.node); - } + for (auto d : dragonfly_clusters) { + XBT_INFO("%s' dragonfly topology:", d->get_cname()); + for (int i = 0; i < d->get_host_count(); i++) { + const simgrid::kernel::routing::DragonflyZone::Coords coords = d->rankId_to_coords(i); + XBT_INFO(" %d: (%u, %u, %u, %u)", i, coords.group, coords.chassis, coords.blade, coords.node); } } diff --git a/src/instr/instr_platform.cpp b/src/instr/instr_platform.cpp index 3d81743b32..08b0fb1c79 100644 --- a/src/instr/instr_platform.cpp +++ b/src/instr/instr_platform.cpp @@ -120,12 +120,11 @@ static void recursiveGraphExtraction(const simgrid::s4u::NetZone* netzone, simgr return; } XBT_DEBUG("Graph extraction for NetZone = %s", netzone->get_cname()); - if (not netzone->get_children().empty()) { - // bottom-up recursion - for (auto const& nz_son : netzone->get_children()) { - simgrid::instr::Container* child_container = container->children_.at(nz_son->get_name()); - recursiveGraphExtraction(nz_son, child_container, filter); - } + + // bottom-up recursion + for (auto const& nz_son : netzone->get_children()) { + simgrid::instr::Container* child_container = container->children_.at(nz_son->get_name()); + recursiveGraphExtraction(nz_son, child_container, filter); } auto* graph = xbt_graph_new_graph(0, nullptr); diff --git a/src/kernel/routing/TorusZone.cpp b/src/kernel/routing/TorusZone.cpp index 21b83cfab9..9e67b80c23 100644 --- a/src/kernel/routing/TorusZone.cpp +++ b/src/kernel/routing/TorusZone.cpp @@ -64,14 +64,13 @@ std::vector TorusZone::parse_topo_parameters(const std::string& to boost::split(dimensions_str, topo_parameters, boost::is_any_of(",")); std::vector dimensions; - if (not dimensions_str.empty()) { - /* We are in a torus cluster - * Parse attribute dimensions="dim1,dim2,dim3,...,dimN" and save them into a vector. - * Additionally, we need to know how many ranks we have in total - */ - std::transform(begin(dimensions_str), end(dimensions_str), std::back_inserter(dimensions), - [](const std::string& s) { return std::stoi(s); }); - } + /* We are in a torus cluster + * Parse attribute dimensions="dim1,dim2,dim3,...,dimN" and save them into a vector. + * Additionally, we need to know how many ranks we have in total + */ + std::transform(begin(dimensions_str), end(dimensions_str), std::back_inserter(dimensions), + [](const std::string& s) { return std::stoi(s); }); + return dimensions; } diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index 5ba3993881..fe8e35b36c 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -1174,12 +1174,9 @@ int Request::waitall(int count, MPI_Request requests[], MPI_Status status[]) } } - if (not accumulates.empty()) { - std::sort(accumulates.begin(), accumulates.end(), sort_accumulates); - for (auto& req : accumulates) { - finish_wait(&req, status); - } - } + std::sort(accumulates.begin(), accumulates.end(), sort_accumulates); + for (auto& req : accumulates) + finish_wait(&req, status); return retvalue; }