Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Useless tests for emptyness.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 1 Jun 2021 12:50:07 +0000 (14:50 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 1 Jun 2021 13:32:21 +0000 (15:32 +0200)
examples/cpp/routing-get-clusters/s4u-routing-get-clusters.cpp
src/instr/instr_platform.cpp
src/kernel/routing/TorusZone.cpp
src/smpi/mpi/smpi_request.cpp

index 22e7c1a..660f1eb 100644 (file)
@@ -27,13 +27,11 @@ int main(int argc, char* argv[])
   std::vector<simgrid::kernel::routing::DragonflyZone*> dragonfly_clusters =
       e.get_filtered_netzones<simgrid::kernel::routing::DragonflyZone>();
 
-  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);
     }
   }
 
index 3d81743..08b0fb1 100644 (file)
@@ -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);
index 21b83cf..9e67b80 100644 (file)
@@ -64,14 +64,13 @@ std::vector<unsigned int> TorusZone::parse_topo_parameters(const std::string& to
   boost::split(dimensions_str, topo_parameters, boost::is_any_of(","));
   std::vector<unsigned int> 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;
 }
 
index 5ba3993..fe8e35b 100644 (file)
@@ -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;
 }