X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/63fdbfa257867cde545185eaa0eb7a6505506a89..523852ad8c806da0c22b613bb7dabc2d3bef5193:/examples/cpp/clusters-multicpu/s4u-clusters-multicpu.cpp diff --git a/examples/cpp/clusters-multicpu/s4u-clusters-multicpu.cpp b/examples/cpp/clusters-multicpu/s4u-clusters-multicpu.cpp index 8ef63370cc..b2ca2e78f7 100644 --- a/examples/cpp/clusters-multicpu/s4u-clusters-multicpu.cpp +++ b/examples/cpp/clusters-multicpu/s4u-clusters-multicpu.cpp @@ -87,8 +87,7 @@ public: * @param id Internal identifier in the torus (for information) * @return netpoint, gateway: the netpoint to the StarZone and CPU0 as gateway */ -static std::pair -create_hostzone(const sg4::NetZone* zone, const std::vector& /*coord*/, unsigned long id) +static sg4::NetZone* create_hostzone(const sg4::NetZone* zone, const std::vector& /*coord*/, unsigned long id) { constexpr int num_cpus = 8; //!< Number of CPUs in the zone constexpr double speed = 1e9; //!< Speed of each CPU @@ -101,14 +100,13 @@ create_hostzone(const sg4::NetZone* zone, const std::vector& /*co /* setting my Torus parent zone */ host_zone->set_parent(zone); - simgrid::kernel::routing::NetPoint* gateway = nullptr; /* create CPUs */ for (int i = 0; i < num_cpus; i++) { std::string cpu_name = hostname + "-cpu" + std::to_string(i); const sg4::Host* host = host_zone->create_host(cpu_name, speed); /* the first CPU is the gateway */ if (i == 0) - gateway = host->get_netpoint(); + host_zone->set_gateway(host->get_netpoint()); /* create split-duplex link */ auto* link = host_zone->create_split_duplex_link("link-" + cpu_name, link_bw)->set_latency(link_lat); /* connecting CPU to outer world */ @@ -116,7 +114,7 @@ create_hostzone(const sg4::NetZone* zone, const std::vector& /*co } /* seal newly created netzone */ host_zone->seal(); - return std::make_pair(host_zone->get_netpoint(), gateway); + return host_zone; } /*************************************************************************************************/