From: Bruno Donassolo Date: Tue, 2 Mar 2021 17:50:41 +0000 (+0100) Subject: clang-format before starting changing files X-Git-Tag: v3.27~201^2~14 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d7c957a488bb2ebd0ef5ea7a3323f1ccea620f30?hp=d73f6e9c920e1a054f94c3117281fded81c6cc5b clang-format before starting changing files --- diff --git a/src/kernel/activity/CommImpl.cpp b/src/kernel/activity/CommImpl.cpp index 0191ebf65d..469cfdb8f3 100644 --- a/src/kernel/activity/CommImpl.cpp +++ b/src/kernel/activity/CommImpl.cpp @@ -80,8 +80,8 @@ XBT_PRIVATE simgrid::kernel::activity::ActivityImplPtr simcall_HANDLER_comm_isen } /* Setup the communication synchro */ - other_comm->src_actor_ = src_proc; - other_comm->src_data_ = data; + other_comm->src_actor_ = src_proc; + other_comm->src_data_ = data; (*other_comm).set_src_buff(src_buff, src_buff_size).set_size(task_size).set_rate(rate); other_comm->match_fun = match_fun; @@ -162,8 +162,8 @@ simcall_HANDLER_comm_irecv(smx_simcall_t /*simcall*/, smx_actor_t receiver, smx_ } /* Setup communication synchro */ - other_comm->dst_actor_ = receiver; - other_comm->dst_data_ = data; + other_comm->dst_actor_ = receiver; + other_comm->dst_data_ = data; other_comm->set_dst_buff(dst_buff, dst_buff_size); if (rate > -1.0 && (other_comm->get_rate() < 0.0 || rate < other_comm->get_rate())) diff --git a/src/kernel/resource/DiskImpl.cpp b/src/kernel/resource/DiskImpl.cpp index d8eeae5c04..75222290da 100644 --- a/src/kernel/resource/DiskImpl.cpp +++ b/src/kernel/resource/DiskImpl.cpp @@ -54,13 +54,13 @@ DiskImpl* DiskImpl::set_write_bandwidth(double write_bw) DiskImpl* DiskImpl::set_read_constraint(lmm::Constraint* constraint_read) { - constraint_read_ = constraint_read; + constraint_read_ = constraint_read; return this; } DiskImpl* DiskImpl::set_write_constraint(lmm::Constraint* constraint_write) { - constraint_write_ = constraint_write; + constraint_write_ = constraint_write; return this; } diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index 9c6f3c098d..d0a894ac72 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -296,14 +296,14 @@ bool NetZoneImpl::get_bypass_route(NetPoint* src, NetPoint* dst, for (int max = 0; max <= max_index && not bypassedRoute; max++) { for (int i = 0; i < max && not bypassedRoute; i++) { if (i <= max_index_src && max <= max_index_dst) { - key = {path_src.at(i)->netpoint_, path_dst.at(max)->netpoint_}; + key = {path_src.at(i)->netpoint_, path_dst.at(max)->netpoint_}; auto bpr = bypass_routes_.find(key); if (bpr != bypass_routes_.end()) { bypassedRoute = bpr->second; } } if (not bypassedRoute && max <= max_index_src && i <= max_index_dst) { - key = {path_src.at(max)->netpoint_, path_dst.at(i)->netpoint_}; + key = {path_src.at(max)->netpoint_, path_dst.at(i)->netpoint_}; auto bpr = bypass_routes_.find(key); if (bpr != bypass_routes_.end()) { bypassedRoute = bpr->second; @@ -312,7 +312,7 @@ bool NetZoneImpl::get_bypass_route(NetPoint* src, NetPoint* dst, } if (not bypassedRoute && max <= max_index_src && max <= max_index_dst) { - key = {path_src.at(max)->netpoint_, path_dst.at(max)->netpoint_}; + key = {path_src.at(max)->netpoint_, path_dst.at(max)->netpoint_}; auto bpr = bypass_routes_.find(key); if (bpr != bypass_routes_.end()) { bypassedRoute = bpr->second; @@ -348,9 +348,9 @@ void NetZoneImpl::get_global_route(NetPoint* src, NetPoint* dst, XBT_DEBUG("Resolve route from '%s' to '%s'", src->get_cname(), dst->get_cname()); /* Find how src and dst are interconnected */ - NetZoneImpl *common_ancestor; - NetZoneImpl *src_ancestor; - NetZoneImpl *dst_ancestor; + NetZoneImpl* common_ancestor; + NetZoneImpl* src_ancestor; + NetZoneImpl* dst_ancestor; find_common_ancestors(src, dst, &common_ancestor, &src_ancestor, &dst_ancestor); XBT_DEBUG("elements_father: common ancestor '%s' src ancestor '%s' dst ancestor '%s'", common_ancestor->get_cname(), src_ancestor->get_cname(), dst_ancestor->get_cname()); diff --git a/src/plugins/vm/VirtualMachineImpl.cpp b/src/plugins/vm/VirtualMachineImpl.cpp index eefe1e5c9c..6de255d40a 100644 --- a/src/plugins/vm/VirtualMachineImpl.cpp +++ b/src/plugins/vm/VirtualMachineImpl.cpp @@ -85,7 +85,7 @@ static void add_active_activity(kernel::activity::ActivityImpl const& act) { const s4u::VirtualMachine* vm = get_vm_from_activity(act); if (vm != nullptr) { - VirtualMachineImpl *vm_impl = vm->get_impl(); + VirtualMachineImpl* vm_impl = vm->get_impl(); vm_impl->add_active_exec(); vm_impl->update_action_weight(); } @@ -95,7 +95,7 @@ static void remove_active_activity(kernel::activity::ActivityImpl const& act) { const s4u::VirtualMachine* vm = get_vm_from_activity(act); if (vm != nullptr) { - VirtualMachineImpl *vm_impl = vm->get_impl(); + VirtualMachineImpl* vm_impl = vm->get_impl(); vm_impl->remove_active_exec(); vm_impl->update_action_weight(); } @@ -324,7 +324,8 @@ void VirtualMachineImpl::set_bound(double bound) update_action_weight(); } -void VirtualMachineImpl::update_action_weight(){ +void VirtualMachineImpl::update_action_weight() +{ /* The impact of the VM over its PM is the min between its vCPU amount and the amount of tasks it contains */ int impact = std::min(active_execs_, get_core_amount()); @@ -338,5 +339,5 @@ void VirtualMachineImpl::update_action_weight(){ action_->set_bound(std::min(impact * physical_host_->get_speed(), user_bound_)); } -} -} +} // namespace vm +} // namespace simgrid diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index ee3430c357..3d0122eb29 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -210,7 +210,7 @@ int CpuCas01Action::requested_core() const return requested_core_; } -CpuCas01Action::~CpuCas01Action()=default; +CpuCas01Action::~CpuCas01Action() = default; } // namespace resource } // namespace kernel diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 89cc142f4a..564bbfb782 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -26,8 +26,8 @@ namespace resource { CpuTiProfile::CpuTiProfile(const profile::Profile* profile) { - double integral = 0; - double time = 0; + double integral = 0; + double time = 0; unsigned nb_points = profile->event_list.size() + 1; time_points_.reserve(nb_points); integral_.reserve(nb_points); @@ -55,7 +55,8 @@ double CpuTiTmgr::integrate(double a, double b) const { if ((a < 0.0) || (a > b)) { xbt_die("Error, invalid integration interval [%.2f,%.2f]. " - "You probably have a task executing with negative computation amount. Check your code.", a, b); + "You probably have a task executing with negative computation amount. Check your code.", + a, b); } if (fabs(a - b) < EPSILON) return 0.0; @@ -71,7 +72,7 @@ double CpuTiTmgr::integrate(double a, double b) const a_index = ceil(a / last_time_); double b_index = floor(b / last_time_); - if (a_index > b_index) { /* Same chunk */ + if (a_index > b_index) { /* Same chunk */ return profile_->integrate_simple(a - (a_index - 1) * last_time_, b - b_index * last_time_); } @@ -102,7 +103,7 @@ double CpuTiProfile::integrate_simple(double a, double b) const double CpuTiProfile::integrate_simple_point(double a) const { double integral = 0; - double a_aux = a; + double a_aux = a; int ind = binary_search(time_points_, a); integral += integral_[ind]; @@ -138,8 +139,9 @@ double CpuTiTmgr::solve(double a, double amount) const /* Sanity checks */ if ((a < 0.0) || (amount < 0.0)) { - XBT_CRITICAL ("Error, invalid parameters [a = %.2f, amount = %.2f]. " - "You probably have a task executing with negative computation amount. Check your code.", a, amount); + XBT_CRITICAL("Error, invalid parameters [a = %.2f, amount = %.2f]. " + "You probably have a task executing with negative computation amount. Check your code.", + a, amount); xbt_abort(); } @@ -202,7 +204,7 @@ double CpuTiProfile::solve_simple(double a, double amount) const */ double CpuTiTmgr::get_power_scale(double a) const { - double reduced_a = a - floor(a / last_time_) * last_time_; + double reduced_a = a - floor(a / last_time_) * last_time_; int point = CpuTiProfile::binary_search(profile_->time_points_, reduced_a); kernel::profile::DatedValue val = speed_profile_->event_list.at(point); return val.value_; diff --git a/src/surf/host_clm03.cpp b/src/surf/host_clm03.cpp index 0e232e68c5..3b4cf2a457 100644 --- a/src/surf/host_clm03.cpp +++ b/src/surf/host_clm03.cpp @@ -38,9 +38,8 @@ double HostCLM03Model::next_occurring_event(double now) surf_network_model->next_occurring_event_is_idempotent() ? surf_network_model->next_occurring_event(now) : -1; double min_by_dsk = surf_disk_model->next_occurring_event(now); - XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_dsk %f", this, - typeid(surf_cpu_model_pm).name(), min_by_cpu, typeid(surf_network_model).name(), min_by_net, - typeid(surf_disk_model).name(), min_by_dsk); + XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_dsk %f", this, typeid(surf_cpu_model_pm).name(), + min_by_cpu, typeid(surf_network_model).name(), min_by_net, typeid(surf_disk_model).name(), min_by_dsk); double res = min_by_cpu; if (res < 0 || (min_by_net >= 0.0 && min_by_net < res)) diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index cc1574205e..54c5b920cc 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -16,9 +16,9 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_network); -double sg_latency_factor = 1.0; /* default value; can be set by model or from command line */ -double sg_bandwidth_factor = 1.0; /* default value; can be set by model or from command line */ -double sg_weight_S_parameter = 0.0; /* default value; can be set by model or from command line */ +double sg_latency_factor = 1.0; /* default value; can be set by model or from command line */ +double sg_bandwidth_factor = 1.0; /* default value; can be set by model or from command line */ +double sg_weight_S_parameter = 0.0; /* default value; can be set by model or from command line */ /************************************************************************/ /* New model based on optimizations discussed during Pedro Velho's thesis*/ @@ -216,8 +216,8 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz action = new NetworkCm02Action(this, *src, *dst, size, failed); else action = new NetworkWifiAction(this, *src, *dst, size, failed, src_wifi_link, dst_wifi_link); - action->sharing_penalty_ = latency; - action->latency_ = latency; + action->sharing_penalty_ = latency; + action->latency_ = latency; action->set_user_bound(rate); if (is_update_lazy()) { @@ -361,7 +361,7 @@ void NetworkCm02Link::set_bandwidth(double value) const kernel::lmm::Variable* var; const kernel::lmm::Element* elem = nullptr; const kernel::lmm::Element* nextelem = nullptr; - int numelem = 0; + int numelem = 0; while ((var = get_constraint()->get_variable_safe(&elem, &nextelem, &numelem))) { auto* action = static_cast(var->get_id()); action->sharing_penalty_ += delta; @@ -375,14 +375,14 @@ LinkImpl* NetworkCm02Link::set_latency(double value) { latency_check(value); - double delta = value - latency_.peak; + double delta = value - latency_.peak; const kernel::lmm::Variable* var; const kernel::lmm::Element* elem = nullptr; const kernel::lmm::Element* nextelem = nullptr; - int numelem = 0; + int numelem = 0; latency_.scale = 1.0; - latency_.peak = value; + latency_.peak = value; while ((var = get_constraint()->get_variable_safe(&elem, &nextelem, &numelem))) { auto* action = static_cast(var->get_id()); diff --git a/src/surf/network_ib.cpp b/src/surf/network_ib.cpp index 9653b666e9..12ae79771f 100644 --- a/src/surf/network_ib.cpp +++ b/src/surf/network_ib.cpp @@ -19,7 +19,7 @@ static void IB_create_host_callback(simgrid::s4u::Host const& host) using simgrid::kernel::resource::IBNode; using simgrid::kernel::resource::NetworkIBModel; - static int id=0; + static int id = 0; ((NetworkIBModel*)surf_network_model)->active_nodes.emplace(host.get_name(), IBNode(id)); id++; diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 569b6c6d11..5bf5dbf174 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -11,15 +11,15 @@ #include "xbt/string.hpp" #include "xbt/utility.hpp" +#include #include #include +#include #include #include #include #include #include -#include -#include #include "ns3/mobility-module.h" #include "ns3/wifi-module.h" @@ -48,7 +48,7 @@ extern std::map> sink_from_s static ns3::InternetStackHelper stack; -static int number_of_links = 1; +static int number_of_links = 1; static int number_of_networks = 1; /* wifi globals */ @@ -85,99 +85,98 @@ static void resumeWifiDevice(ns3::Ptr device) * Callbacks * *************/ -static void zoneCreation_cb(simgrid::s4u::NetZone const& zone) { - simgrid::kernel::routing::WifiZone* wifizone = dynamic_cast (zone.get_impl()); - if (wifizone == nullptr) return; +static void zoneCreation_cb(simgrid::s4u::NetZone const& zone) +{ + simgrid::kernel::routing::WifiZone* wifizone = dynamic_cast(zone.get_impl()); + if (wifizone == nullptr) + return; #if NS3_MINOR_VERSION < 32 - wifi.SetStandard(ns3::WIFI_PHY_STANDARD_80211n_5GHZ); + wifi.SetStandard(ns3::WIFI_PHY_STANDARD_80211n_5GHZ); #else - wifi.SetStandard(ns3::WIFI_STANDARD_80211n_5GHZ); + wifi.SetStandard(ns3::WIFI_STANDARD_80211n_5GHZ); #endif - std::string ssid = wifizone->get_name(); - const char* mcs = wifizone->get_property("mcs"); - const char* nss = wifizone->get_property("nss"); - int mcs_value = mcs ? atoi(mcs) : 3; - int nss_value = nss ? atoi(nss) : 1; + std::string ssid = wifizone->get_name(); + const char* mcs = wifizone->get_property("mcs"); + const char* nss = wifizone->get_property("nss"); + int mcs_value = mcs ? atoi(mcs) : 3; + int nss_value = nss ? atoi(nss) : 1; #if NS3_MINOR_VERSION < 30 - if(nss_value != 1+(mcs_value/8)) - xbt_die("On NS3 < 3.30, NSS value has to satisfy NSS == 1+(MCS/8) constraint. Bailing out"); + if (nss_value != 1 + (mcs_value / 8)) + xbt_die("On NS3 < 3.30, NSS value has to satisfy NSS == 1+(MCS/8) constraint. Bailing out"); #endif - wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", - "ControlMode", ns3::StringValue("HtMcs0"), - "DataMode", ns3::StringValue("HtMcs" + std::to_string(mcs_value))); - wifiPhy.SetChannel(wifiChannel.Create()); - wifiPhy.Set("Antennas", ns3::UintegerValue(nss_value)); - wifiPhy.Set("MaxSupportedTxSpatialStreams", ns3::UintegerValue(nss_value)); - wifiPhy.Set("MaxSupportedRxSpatialStreams", ns3::UintegerValue(nss_value)); - wifiMac.SetType("ns3::ApWifiMac", - "Ssid", ns3::SsidValue(ssid)); - - mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel"); - ns3::Ptr positionAllocS = ns3::CreateObject(); - positionAllocS->Add(ns3::Vector(0, 0, 255 * 100 * number_of_networks + 100 * number_of_links)); - - ns3::NetDeviceContainer netDevices; - NetPointNs3* access_point_netpoint_ns3 = wifizone->get_access_point()->extension(); - - ns3::Ptr access_point_ns3_node = access_point_netpoint_ns3->ns3_node_; - ns3::NodeContainer nodes = {access_point_ns3_node}; - std::vector hosts_netpoints = {access_point_netpoint_ns3}; - netDevices.Add(wifi.Install(wifiPhy, wifiMac,access_point_ns3_node)); - - wifiMac.SetType ("ns3::StaWifiMac", - "Ssid", ns3::SsidValue(ssid), - "ActiveProbing", ns3::BooleanValue(false)); - - NetPointNs3* station_netpoint_ns3 = nullptr; - ns3::Ptr station_ns3_node = nullptr; - double distance; - double angle = 0; - int nb_stations = wifizone->get_all_hosts().size() - 1; - double step = 2 * M_PI / nb_stations; - for (auto station_host : wifizone->get_all_hosts()) { - station_netpoint_ns3 = station_host->get_netpoint()->extension(); - if (station_netpoint_ns3 == access_point_netpoint_ns3) - continue; - hosts_netpoints.push_back(station_netpoint_ns3); - distance = station_host->get_property("wifi_distance") ? atof(station_host->get_property("wifi_distance")) : 10.0; - positionAllocS->Add(ns3::Vector(distance * std::cos(angle), distance * std::sin(angle), 255 * 100 * number_of_networks + 100 * number_of_links)); - angle += step; - station_ns3_node = station_netpoint_ns3->ns3_node_; - nodes.Add(station_ns3_node); - netDevices.Add(wifi.Install(wifiPhy, wifiMac, station_ns3_node)); - } + wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "ControlMode", ns3::StringValue("HtMcs0"), "DataMode", + ns3::StringValue("HtMcs" + std::to_string(mcs_value))); + wifiPhy.SetChannel(wifiChannel.Create()); + wifiPhy.Set("Antennas", ns3::UintegerValue(nss_value)); + wifiPhy.Set("MaxSupportedTxSpatialStreams", ns3::UintegerValue(nss_value)); + wifiPhy.Set("MaxSupportedRxSpatialStreams", ns3::UintegerValue(nss_value)); + wifiMac.SetType("ns3::ApWifiMac", "Ssid", ns3::SsidValue(ssid)); + + mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel"); + ns3::Ptr positionAllocS = ns3::CreateObject(); + positionAllocS->Add(ns3::Vector(0, 0, 255 * 100 * number_of_networks + 100 * number_of_links)); + + ns3::NetDeviceContainer netDevices; + NetPointNs3* access_point_netpoint_ns3 = wifizone->get_access_point()->extension(); + + ns3::Ptr access_point_ns3_node = access_point_netpoint_ns3->ns3_node_; + ns3::NodeContainer nodes = {access_point_ns3_node}; + std::vector hosts_netpoints = {access_point_netpoint_ns3}; + netDevices.Add(wifi.Install(wifiPhy, wifiMac, access_point_ns3_node)); + + wifiMac.SetType("ns3::StaWifiMac", "Ssid", ns3::SsidValue(ssid), "ActiveProbing", ns3::BooleanValue(false)); + + NetPointNs3* station_netpoint_ns3 = nullptr; + ns3::Ptr station_ns3_node = nullptr; + double distance; + double angle = 0; + int nb_stations = wifizone->get_all_hosts().size() - 1; + double step = 2 * M_PI / nb_stations; + for (auto station_host : wifizone->get_all_hosts()) { + station_netpoint_ns3 = station_host->get_netpoint()->extension(); + if (station_netpoint_ns3 == access_point_netpoint_ns3) + continue; + hosts_netpoints.push_back(station_netpoint_ns3); + distance = station_host->get_property("wifi_distance") ? atof(station_host->get_property("wifi_distance")) : 10.0; + positionAllocS->Add(ns3::Vector(distance * std::cos(angle), distance * std::sin(angle), + 255 * 100 * number_of_networks + 100 * number_of_links)); + angle += step; + station_ns3_node = station_netpoint_ns3->ns3_node_; + nodes.Add(station_ns3_node); + netDevices.Add(wifi.Install(wifiPhy, wifiMac, station_ns3_node)); + } - const char* start_time = wifizone->get_property("start_time"); - int start_time_value = start_time ? atoi(start_time) : 0; - for (uint32_t i = 0; i < netDevices.GetN(); i++) { - ns3::Ptr device = ns3::StaticCast(netDevices.Get(i)); - device->GetPhy()->SetOffMode(); - ns3::Simulator::Schedule(ns3::Seconds(start_time_value), &resumeWifiDevice, device); - } + const char* start_time = wifizone->get_property("start_time"); + int start_time_value = start_time ? atoi(start_time) : 0; + for (uint32_t i = 0; i < netDevices.GetN(); i++) { + ns3::Ptr device = ns3::StaticCast(netDevices.Get(i)); + device->GetPhy()->SetOffMode(); + ns3::Simulator::Schedule(ns3::Seconds(start_time_value), &resumeWifiDevice, device); + } - ns3::Config::Set("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", ns3::UintegerValue(40)); + ns3::Config::Set("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", ns3::UintegerValue(40)); - mobility.SetPositionAllocator(positionAllocS); - mobility.Install(nodes); + mobility.SetPositionAllocator(positionAllocS); + mobility.Install(nodes); - ns3::Ipv4AddressHelper address; - std::string addr = simgrid::xbt::string_printf("%d.%d.0.0", number_of_networks, number_of_links); - address.SetBase(addr.c_str(), "255.255.0.0"); - XBT_DEBUG("\tInterface stack '%s'", addr.c_str()); - ns3::Ipv4InterfaceContainer addresses = address.Assign(netDevices); - for (unsigned int i = 0; i < hosts_netpoints.size(); i++) { - hosts_netpoints[i]->ipv4_address_ = transformIpv4Address(addresses.GetAddress(i)); - } + ns3::Ipv4AddressHelper address; + std::string addr = simgrid::xbt::string_printf("%d.%d.0.0", number_of_networks, number_of_links); + address.SetBase(addr.c_str(), "255.255.0.0"); + XBT_DEBUG("\tInterface stack '%s'", addr.c_str()); + ns3::Ipv4InterfaceContainer addresses = address.Assign(netDevices); + for (unsigned int i = 0; i < hosts_netpoints.size(); i++) { + hosts_netpoints[i]->ipv4_address_ = transformIpv4Address(addresses.GetAddress(i)); + } - if (number_of_links == 255) { - xbt_assert(number_of_networks < 255, "Number of links and networks exceed 255*255"); - number_of_links = 1; - number_of_networks++; - } else { - number_of_links++; - } + if (number_of_links == 255) { + xbt_assert(number_of_networks < 255, "Number of links and networks exceed 255*255"); + number_of_links = 1; + number_of_networks++; + } else { + number_of_links++; + } } static void clusterCreation_cb(simgrid::kernel::routing::ClusterCreationArgs const& cluster) @@ -348,7 +347,7 @@ double NetworkNS3Model::next_occurring_event(double now) double time_to_next_flow_completion = 0.0; XBT_DEBUG("ns3_next_occurring_event"); - //get the first relevant value from the running_actions list + // get the first relevant value from the running_actions list // If there is no comms in NS-3, then we do not move it forward. // We will synchronize NS-3 with SimGrid when starting a new communication. @@ -362,7 +361,7 @@ double NetworkNS3Model::next_occurring_event(double now) // NS-3 stops as soon as a flow ends, // but it does not process the other flows that may finish at the same (simulated) time. // If another flow ends at the same time, time_to_next_flow_completion = 0 - if(double_equals(time_to_next_flow_completion, 0, sg_surf_precision)) + if (double_equals(time_to_next_flow_completion, 0, sg_surf_precision)) time_to_next_flow_completion = 0.0; XBT_DEBUG("min : %f", now); @@ -379,16 +378,16 @@ void NetworkNS3Model::update_actions_state(double now, double delta) std::string ns3_socket; for (const auto& elm : flow_from_sock) { - ns3_socket = elm.first; - SgFlow* sgFlow = elm.second; - NetworkNS3Action * action = sgFlow->action_; + ns3_socket = elm.first; + SgFlow* sgFlow = elm.second; + NetworkNS3Action* action = sgFlow->action_; XBT_DEBUG("Processing flow %p (socket %s, action %p)", sgFlow, ns3_socket.c_str(), action); // Because NS3 stops as soon as a flow is finished, the other flows that ends at the same time may remains in an // inconsistent state (i.e. remains_ == 0 but finished_ == false). // However, SimGrid considers sometimes that an action with remains_ == 0 is finished. // Thus, to avoid inconsistencies between SimGrid and NS3, set remains to 0 only when the flow is finished in NS3 int remains = action->get_cost() - sgFlow->sent_bytes_; - if(remains > 0) + if (remains > 0) action->set_remains(remains); if (TRACE_is_enabled() && action->get_state() == kernel::resource::Action::State::STARTED) { @@ -404,7 +403,8 @@ void NetworkNS3Model::update_actions_state(double now, double delta) action->last_sent_ = sgFlow->sent_bytes_; } - if ((sgFlow->finished_) && (remains <= 0)) { // finished_ should not become true before remains gets to 0, but it sometimes does. Let's play safe, here. + if ((sgFlow->finished_) && (remains <= 0)) { // finished_ should not become true before remains gets to 0, but it + // sometimes does. Let's play safe, here. socket_to_destroy.push_back(ns3_socket); XBT_DEBUG("Destroy socket %s of action %p", ns3_socket.c_str(), action); action->set_remains(0); @@ -475,9 +475,10 @@ NetworkNS3Action::NetworkNS3Action(Model* model, double totalBytes, s4u::Host* s } // If there is no other started actions, we need to move NS-3 forward to be sync with SimGrid - if (model->get_started_action_set()->size()==1){ - while(double_positive(surf_get_clock() - ns3::Simulator::Now().GetSeconds(), sg_surf_precision)){ - XBT_DEBUG("Synchronizing NS-3 (time %f) with SimGrid (time %f)", ns3::Simulator::Now().GetSeconds(), surf_get_clock()); + if (model->get_started_action_set()->size() == 1) { + while (double_positive(surf_get_clock() - ns3::Simulator::Now().GetSeconds(), sg_surf_precision)) { + XBT_DEBUG("Synchronizing NS-3 (time %f) with SimGrid (time %f)", ns3::Simulator::Now().GetSeconds(), + surf_get_clock()); ns3_simulator(surf_get_clock() - ns3::Simulator::Now().GetSeconds()); } } @@ -512,11 +513,13 @@ NetworkNS3Action::NetworkNS3Action(Model* model, double totalBytes, s4u::Host* s s4u::Link::on_communicate(*this); } -void NetworkNS3Action::suspend() { +void NetworkNS3Action::suspend() +{ THROW_UNIMPLEMENTED; } -void NetworkNS3Action::resume() { +void NetworkNS3Action::resume() +{ THROW_UNIMPLEMENTED; } @@ -540,10 +543,10 @@ void ns3_simulator(double maxSeconds) id = ns3::Simulator::Schedule(ns3::Seconds(maxSeconds), &ns3::Simulator::Stop); XBT_DEBUG("Start simulator for at most %fs (current time: %f)", maxSeconds, surf_get_clock()); - ns3::Simulator::Run (); + ns3::Simulator::Run(); XBT_DEBUG("Simulator stopped at %fs", ns3::Simulator::Now().GetSeconds()); - if(maxSeconds > 0.0) + if (maxSeconds > 0.0) id.Cancel(); } @@ -561,7 +564,7 @@ void ns3_add_direct_route(simgrid::kernel::routing::NetPoint* src, simgrid::kern xbt_assert(host_dst != nullptr, "Network element %s does not seem to be ns-3-ready", dst->get_cname()); if (policy == simgrid::s4u::Link::SharingPolicy::WIFI) { - xbt_die("The wifi sharing policy is not supported for links. You want to use a wifi zone (see documentation)."); + xbt_die("The wifi sharing policy is not supported for links. You want to use a wifi zone (see documentation)."); } else { ns3::PointToPointHelper pointToPoint; diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index c55755f824..5a82bd16e7 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -18,7 +18,7 @@ XBT_LOG_EXTERNAL_CATEGORY(xbt_cfg); /**************************************/ void surf_host_model_init_ptask_L07() { - XBT_CINFO(xbt_cfg,"Switching to the L07 model to handle parallel tasks."); + XBT_CINFO(xbt_cfg, "Switching to the L07 model to handle parallel tasks."); xbt_assert(not surf_cpu_model_pm, "Cannot switch to ptasks: CPU model already defined"); xbt_assert(not surf_network_model, "Cannot switch to ptasks: network model already defined"); @@ -29,7 +29,8 @@ void surf_host_model_init_ptask_L07() namespace simgrid { namespace surf { -HostL07Model::HostL07Model() : HostModel() { +HostL07Model::HostL07Model() : HostModel() +{ auto* maxmin_system = new simgrid::kernel::lmm::FairBottleneck(true /* selective update */); set_maxmin_system(maxmin_system); surf_network_model = new NetworkL07Model(this, maxmin_system); @@ -57,9 +58,10 @@ NetworkL07Model::NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys) : NetworkModel(Model::UpdateAlgo::FULL), hostModel_(hmodel) { set_maxmin_system(sys); - loopback_ = NetworkL07Model::create_link("__loopback__", - std::vector{simgrid::config::get_value("network/loopback-bw")}, - s4u::Link::SharingPolicy::FATPIPE)->set_latency(simgrid::config::get_value("network/loopback-lat")); + loopback_ = NetworkL07Model::create_link( + "__loopback__", std::vector{simgrid::config::get_value("network/loopback-bw")}, + s4u::Link::SharingPolicy::FATPIPE) + ->set_latency(simgrid::config::get_value("network/loopback-lat")); loopback_->seal(); } @@ -120,7 +122,7 @@ void HostL07Model::update_actions_state(double /*now*/, double delta) } /* Need to check that none of the model has failed */ - int i = 0; + int i = 0; const kernel::lmm::Constraint* cnst = action.get_variable()->get_constraint(i); while (cnst != nullptr) { i++; @@ -148,7 +150,7 @@ L07Action::L07Action(kernel::resource::Model* model, const std::vector0 flops) are counted) */ - double latency = 0.0; + double latency = 0.0; this->set_last_update(); hostList_.insert(hostList_.end(), host_list.begin(), host_list.end()); @@ -157,7 +159,7 @@ L07Action::L07Action(kernel::resource::Model* model, const std::vector 0.0; }); /* Compute the number of affected resources... */ - if(bytes_amount != nullptr) { + if (bytes_amount != nullptr) { std::unordered_set affected_links; for (size_t k = 0; k < host_list.size() * host_list.size(); k++) { @@ -250,7 +252,7 @@ kernel::resource::CpuAction* CpuL07::execution_start(double size) std::vector host_list = {get_iface()}; auto* flops_amount = new double[host_list.size()](); - flops_amount[0] = size; + flops_amount[0] = size; kernel::resource::CpuAction* res = static_cast(get_model())->hostModel_->execute_parallel(host_list, flops_amount, nullptr, -1); @@ -363,7 +365,7 @@ kernel::resource::LinkImpl* LinkL07::set_latency(double value) { latency_check(value); const kernel::lmm::Variable* var; - L07Action *action; + L07Action* action; const kernel::lmm::Element* elem = nullptr; latency_.peak = value; diff --git a/src/surf/ptask_L07.hpp b/src/surf/ptask_L07.hpp index a38cb2d02c..a7ce95401f 100644 --- a/src/surf/ptask_L07.hpp +++ b/src/surf/ptask_L07.hpp @@ -3,10 +3,10 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "src/surf/HostImpl.hpp" #include #include #include -#include "src/surf/HostImpl.hpp" #ifndef HOST_L07_HPP_ #define HOST_L07_HPP_ @@ -54,7 +54,7 @@ public: ~CpuL07Model() override; kernel::resource::Cpu* create_cpu(s4u::Host* host, const std::vector& speed_per_pstate) override; - HostL07Model *hostModel_; + HostL07Model* hostModel_; }; class NetworkL07Model : public kernel::resource::NetworkModel { @@ -68,7 +68,7 @@ public: kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override; - HostL07Model *hostModel_; + HostL07Model* hostModel_; }; /************ diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 68165ebdc5..9066f98feb 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -54,7 +54,8 @@ void sg_platf_init() } /** Module management function: frees all internal data structures */ -void sg_platf_exit() { +void sg_platf_exit() +{ simgrid::kernel::routing::on_cluster_creation.disconnect_slots(); simgrid::s4u::Engine::on_platform_created.disconnect_slots(); @@ -106,7 +107,6 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(const std::string& name, if (coords && strcmp(coords, "")) new simgrid::kernel::routing::vivaldi::Coords(netpoint, coords); - return netpoint; } @@ -148,7 +148,7 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster using simgrid::kernel::routing::FatTreeZone; using simgrid::kernel::routing::TorusZone; - int rankId=0; + int rankId = 0; // What an inventive way of initializing the AS that I have as ancestor :-( simgrid::kernel::routing::ZoneCreationArgs zone; @@ -174,12 +174,12 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster for (auto const& elm : *cluster->properties) current_as->get_iface()->set_property(elm.first, elm.second); - if(cluster->loopback_bw > 0 || cluster->loopback_lat > 0){ + if (cluster->loopback_bw > 0 || cluster->loopback_lat > 0) { current_as->num_links_per_node_++; current_as->has_loopback_ = true; } - if(cluster->limiter_link > 0){ + if (cluster->limiter_link > 0) { current_as->num_links_per_node_++; current_as->has_limiter_ = true; } @@ -200,9 +200,9 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster } host.speed_per_pstate = cluster->speeds; - host.pstate = 0; - host.core_amount = cluster->core_amount; - host.coord = ""; + host.pstate = 0; + host.core_amount = cluster->core_amount; + host.coord = ""; sg_platf_new_host(&host); XBT_DEBUG(""); @@ -214,18 +214,18 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster // the second column may store a limiter link if p_has_limiter is set // other columns are to store one or more link for the node - //add a loopback link + // add a loopback link const simgrid::s4u::Link* linkUp = nullptr; const simgrid::s4u::Link* linkDown = nullptr; - if(cluster->loopback_bw > 0 || cluster->loopback_lat > 0){ + if (cluster->loopback_bw > 0 || cluster->loopback_lat > 0) { std::string tmp_link = link_id + "_loopback"; XBT_DEBUG("", tmp_link.c_str(), cluster->loopback_bw); simgrid::kernel::routing::LinkCreationArgs link; - link.id = tmp_link; + link.id = tmp_link; link.bandwidths.push_back(cluster->loopback_bw); - link.latency = cluster->loopback_lat; - link.policy = simgrid::s4u::Link::SharingPolicy::FATPIPE; + link.latency = cluster->loopback_lat; + link.policy = simgrid::s4u::Link::SharingPolicy::FATPIPE; sg_platf_new_link(&link); linkUp = simgrid::s4u::Link::by_name_or_null(tmp_link); linkDown = simgrid::s4u::Link::by_name_or_null(tmp_link); @@ -234,18 +234,18 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster as_cluster->private_links_.insert({as_cluster->node_pos(rankId), {linkUp->get_impl(), linkDown->get_impl()}}); } - //add a limiter link (shared link to account for maximal bandwidth of the node) + // add a limiter link (shared link to account for maximal bandwidth of the node) linkUp = nullptr; linkDown = nullptr; - if(cluster->limiter_link > 0){ + if (cluster->limiter_link > 0) { std::string tmp_link = std::string(link_id) + "_limiter"; XBT_DEBUG("", tmp_link.c_str(), cluster->limiter_link); simgrid::kernel::routing::LinkCreationArgs link; - link.id = tmp_link; + link.id = tmp_link; link.bandwidths.push_back(cluster->limiter_link); link.latency = 0; - link.policy = simgrid::s4u::Link::SharingPolicy::SHARED; + link.policy = simgrid::s4u::Link::SharingPolicy::SHARED; sg_platf_new_link(&link); linkDown = simgrid::s4u::Link::by_name_or_null(tmp_link); linkUp = linkDown; @@ -253,7 +253,7 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster {current_as->node_pos_with_loopback(rankId), {linkUp->get_impl(), linkDown->get_impl()}}); } - //call the cluster function that adds the others links + // call the cluster function that adds the others links if (cluster->topology == simgrid::kernel::routing::ClusterTopology::FAT_TREE) { static_cast(current_as)->add_processing_node(i); } else { @@ -270,13 +270,13 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster cluster->router_id = std::string(cluster->prefix) + cluster->id + "_router" + cluster->suffix; current_as->router_ = sg_platf_new_router(cluster->router_id, nullptr); - //Make the backbone + // Make the backbone if ((cluster->bb_bw > 0) || (cluster->bb_lat > 0)) { simgrid::kernel::routing::LinkCreationArgs link; - link.id = std::string(cluster->id)+ "_backbone"; + link.id = std::string(cluster->id) + "_backbone"; link.bandwidths.push_back(cluster->bb_bw); - link.latency = cluster->bb_lat; - link.policy = cluster->bb_sharing_policy; + link.latency = cluster->bb_lat; + link.policy = cluster->bb_sharing_policy; XBT_DEBUG("", link.id.c_str(), cluster->bb_bw, cluster->bb_lat); sg_platf_new_link(&link); @@ -307,17 +307,17 @@ void sg_platf_new_cabinet(const simgrid::kernel::routing::CabinetCreationArgs* c for (int const& radical : *cabinet->radicals) { std::string hostname = cabinet->prefix + std::to_string(radical) + cabinet->suffix; simgrid::kernel::routing::HostCreationArgs host; - host.pstate = 0; - host.core_amount = 1; - host.id = hostname; + host.pstate = 0; + host.core_amount = 1; + host.id = hostname; host.speed_per_pstate.push_back(cabinet->speed); sg_platf_new_host(&host); simgrid::kernel::routing::LinkCreationArgs link; - link.policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX; - link.latency = cabinet->lat; + link.policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX; + link.latency = cabinet->lat; link.bandwidths.push_back(cabinet->bw); - link.id = "link_" + hostname; + link.id = "link_" + hostname; sg_platf_new_link(&link); simgrid::kernel::routing::HostLinkCreationArgs host_link; @@ -384,7 +384,7 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor) double kill_time = actor->kill_time; bool auto_restart = actor->restart_on_failure; - std::string actor_name = actor->args[0]; + std::string actor_name = actor->args[0]; simgrid::kernel::actor::ActorCode code = factory(std::move(actor->args)); std::shared_ptr> properties(actor->properties); @@ -406,7 +406,7 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor) new_actor->set_auto_restart(auto_restart); delete arg; }); - } else { // start_time <= SIMIX_get_clock() + } else { // start_time <= SIMIX_get_clock() XBT_DEBUG("Starting Process %s(%s) right now", arg->name.c_str(), host->get_cname()); try { @@ -516,25 +516,25 @@ simgrid::kernel::routing::NetZoneImpl* sg_platf_new_Zone_begin(const simgrid::ke simgrid::kernel::resource::NetworkModel* netmodel = current_routing == nullptr ? surf_network_model : current_routing->network_model_; if (strcasecmp(zone->routing.c_str(), "Cluster") == 0) { - new_zone = new simgrid::kernel::routing::ClusterZone(current_routing, zone->id, netmodel); - } else if (strcasecmp(zone->routing.c_str(),"ClusterDragonfly") == 0) { - new_zone = new simgrid::kernel::routing::DragonflyZone(current_routing, zone->id, netmodel); - } else if (strcasecmp(zone->routing.c_str(),"ClusterTorus") == 0) { - new_zone = new simgrid::kernel::routing::TorusZone(current_routing, zone->id, netmodel); - } else if (strcasecmp(zone->routing.c_str(),"ClusterFatTree") == 0) { - new_zone = new simgrid::kernel::routing::FatTreeZone(current_routing, zone->id, netmodel); - } else if (strcasecmp(zone->routing.c_str(),"Dijkstra") == 0) { - new_zone = new simgrid::kernel::routing::DijkstraZone(current_routing, zone->id, netmodel, false); - } else if (strcasecmp(zone->routing.c_str(),"DijkstraCache") == 0) { - new_zone = new simgrid::kernel::routing::DijkstraZone(current_routing, zone->id, netmodel, true); - } else if (strcasecmp(zone->routing.c_str(),"Floyd") == 0) { - new_zone = new simgrid::kernel::routing::FloydZone(current_routing, zone->id, netmodel); - } else if (strcasecmp(zone->routing.c_str(),"Full") == 0) { - new_zone = new simgrid::kernel::routing::FullZone(current_routing, zone->id, netmodel); - } else if (strcasecmp(zone->routing.c_str(),"None") == 0) { - new_zone = new simgrid::kernel::routing::EmptyZone(current_routing, zone->id, netmodel); - } else if (strcasecmp(zone->routing.c_str(),"Vivaldi") == 0) { - new_zone = new simgrid::kernel::routing::VivaldiZone(current_routing, zone->id, netmodel); + new_zone = new simgrid::kernel::routing::ClusterZone(current_routing, zone->id, netmodel); + } else if (strcasecmp(zone->routing.c_str(), "ClusterDragonfly") == 0) { + new_zone = new simgrid::kernel::routing::DragonflyZone(current_routing, zone->id, netmodel); + } else if (strcasecmp(zone->routing.c_str(), "ClusterTorus") == 0) { + new_zone = new simgrid::kernel::routing::TorusZone(current_routing, zone->id, netmodel); + } else if (strcasecmp(zone->routing.c_str(), "ClusterFatTree") == 0) { + new_zone = new simgrid::kernel::routing::FatTreeZone(current_routing, zone->id, netmodel); + } else if (strcasecmp(zone->routing.c_str(), "Dijkstra") == 0) { + new_zone = new simgrid::kernel::routing::DijkstraZone(current_routing, zone->id, netmodel, false); + } else if (strcasecmp(zone->routing.c_str(), "DijkstraCache") == 0) { + new_zone = new simgrid::kernel::routing::DijkstraZone(current_routing, zone->id, netmodel, true); + } else if (strcasecmp(zone->routing.c_str(), "Floyd") == 0) { + new_zone = new simgrid::kernel::routing::FloydZone(current_routing, zone->id, netmodel); + } else if (strcasecmp(zone->routing.c_str(), "Full") == 0) { + new_zone = new simgrid::kernel::routing::FullZone(current_routing, zone->id, netmodel); + } else if (strcasecmp(zone->routing.c_str(), "None") == 0) { + new_zone = new simgrid::kernel::routing::EmptyZone(current_routing, zone->id, netmodel); + } else if (strcasecmp(zone->routing.c_str(), "Vivaldi") == 0) { + new_zone = new simgrid::kernel::routing::VivaldiZone(current_routing, zone->id, netmodel); } else if (strcasecmp(zone->routing.c_str(), "Wifi") == 0) { new_zone = new simgrid::kernel::routing::WifiZone(current_routing, zone->id, netmodel); } else { diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 66144a77a7..c2bab8454e 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -22,7 +22,7 @@ extern double NOW; void surf_presolve() { - XBT_DEBUG ("Consume all trace events occurring before the starting time."); + XBT_DEBUG("Consume all trace events occurring before the starting time."); double next_event_date; while ((next_event_date = simgrid::kernel::profile::future_evt_set.next_date()) != -1.0) { if (next_event_date > NOW) @@ -37,15 +37,15 @@ void surf_presolve() } } - XBT_DEBUG ("Set every models in the right state by updating them to 0."); + XBT_DEBUG("Set every models in the right state by updating them to 0."); for (auto const& model : all_existing_models) model->update_actions_state(NOW, 0.0); } double surf_solve(double max_date) { - double time_delta = -1.0; /* duration */ - double value = -1.0; + double time_delta = -1.0; /* duration */ + double value = -1.0; simgrid::kernel::resource::Resource* resource = nullptr; simgrid::kernel::profile::Event* event = nullptr; @@ -69,8 +69,7 @@ double surf_solve(double max_date) } for (auto const& model : all_existing_models) { - if (model != surf_host_model && model != surf_vm_model && model != surf_network_model && - model != surf_disk_model) { + if (model != surf_host_model && model != surf_vm_model && model != surf_network_model && model != surf_disk_model) { double next_event_model = model->next_occurring_event(NOW); if ((time_delta < 0.0 || next_event_model < time_delta) && next_event_model >= 0.0) time_delta = next_event_model; @@ -115,9 +114,10 @@ double surf_solve(double max_date) XBT_DEBUG("This event invalidates the next_occurring_event() computation of models. Next event set to %f", time_delta); } - // FIXME: I'm too lame to update NOW live, so I change it and restore it so that the real update with surf_min will work + // FIXME: I'm too lame to update NOW live, so I change it and restore it so that the real update with surf_min + // will work double round_start = NOW; - NOW = next_event_date; + NOW = next_event_date; /* update state of the corresponding resource to the new value. Does not touch lmm. It will be modified if needed when updating actions */ XBT_DEBUG("Calling update_resource_state for resource %s", resource->get_cname()); @@ -126,9 +126,11 @@ double surf_solve(double max_date) } } - /* FIXME: Moved this test to here to avoid stopping simulation if there are actions running on cpus and all cpus are with availability = 0. - * This may cause an infinite loop if one cpu has a trace with periodicity = 0 and the other a trace with periodicity > 0. - * The options are: all traces with same periodicity(0 or >0) or we need to change the way how the events are managed */ + /* FIXME: Moved this test to here to avoid stopping simulation if there are actions running on cpus and all cpus are + * with availability = 0. This may cause an infinite loop if one cpu has a trace with periodicity = 0 and the other a + * trace with periodicity > 0. + * The options are: all traces with same periodicity(0 or >0) or we need to change the way how the events are managed + */ if (time_delta < 0) { XBT_DEBUG("No next event at all. Bail out now."); return -1.0; diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 2ff3eb33c1..41806829f3 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -73,16 +73,19 @@ const std::vector surf_network_model_description = { &surf_network_model_init_NS3}, }; -#if ! HAVE_SMPI -void surf_network_model_init_SMPI() { +#if !HAVE_SMPI +void surf_network_model_init_SMPI() +{ xbt_die("Please activate SMPI support in cmake to use the SMPI network model."); } -void surf_network_model_init_IB() { +void surf_network_model_init_IB() +{ xbt_die("Please activate SMPI support in cmake to use the IB network model."); } #endif #if !SIMGRID_HAVE_NS3 -void surf_network_model_init_NS3() { +void surf_network_model_init_NS3() +{ xbt_die("Please activate ns-3 support in cmake and install the dependencies to use the NS3 network model."); } #endif @@ -102,8 +105,9 @@ const std::vector surf_host_model_description = { const std::vector surf_optimization_mode_description = { {"Lazy", "Lazy action management (partial invalidation in lmm + heap in action remaining).", nullptr}, - {"TI", "Trace integration. Highly optimized mode when using availability traces (only available for the Cas01 CPU " - "model for now).", + {"TI", + "Trace integration. Highly optimized mode when using availability traces (only available for the Cas01 CPU " + "model for now).", nullptr}, {"Full", "Full update of remaining and variables. Slow but may be useful when debugging.", nullptr}, }; @@ -161,7 +165,7 @@ std::ifstream* surf_ifsopen(const std::string& name) FILE* surf_fopen(const std::string& name, const char* mode) { - FILE *file = nullptr; + FILE* file = nullptr; if (is_absolute_file_path(name)) /* don't mess with absolute file names */ return fopen(name.c_str(), mode); @@ -206,8 +210,7 @@ int find_model_description(const std::vector& table, c return -1; } - -void surf_init(int *argc, char **argv) +void surf_init(int* argc, char** argv) { if (xbt_initialized > 0) return; @@ -227,5 +230,5 @@ void surf_exit() tmgr_finalize(); sg_platf_exit(); - NOW = 0; /* Just in case the user plans to restart the simulation afterward */ + NOW = 0; /* Just in case the user plans to restart the simulation afterward */ } diff --git a/teshsuite/surf/surf_usage/surf_usage.cpp b/teshsuite/surf/surf_usage/surf_usage.cpp index 0efbc75e88..f6d4a8ecff 100644 --- a/teshsuite/surf/surf_usage/surf_usage.cpp +++ b/teshsuite/surf/surf_usage/surf_usage.cpp @@ -31,9 +31,9 @@ static const char* string_action(simgrid::kernel::resource::Action::State state) } } -int main(int argc, char **argv) +int main(int argc, char** argv) { - surf_init(&argc, argv); /* Initialize some common structures */ + surf_init(&argc, argv); /* Initialize some common structures */ simgrid::config::set_parse("cpu/model:Cas01"); simgrid::config::set_parse("network/model:CM02"); @@ -59,7 +59,6 @@ int main(int argc, char **argv) XBT_INFO("actionB state: %s", string_action(stateActionB)); XBT_INFO("actionC state: %s", string_action(stateActionC)); - /* Let's do something on it */ surf_network_model->communicate(hostA, hostB, 150.0, -1.0); diff --git a/teshsuite/surf/surf_usage2/surf_usage2.cpp b/teshsuite/surf/surf_usage2/surf_usage2.cpp index 916767f008..8f3e1a04f2 100644 --- a/teshsuite/surf/surf_usage2/surf_usage2.cpp +++ b/teshsuite/surf/surf_usage2/surf_usage2.cpp @@ -14,11 +14,11 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example"); -int main(int argc, char **argv) +int main(int argc, char** argv) { int running; - surf_init(&argc, argv); /* Initialize some common structures */ + surf_init(&argc, argv); /* Initialize some common structures */ simgrid::config::set_parse("network/model:CM02"); simgrid::config::set_parse("cpu/model:Cas01"); @@ -37,10 +37,10 @@ int main(int argc, char **argv) surf_network_model->communicate(hostA, hostB, 150.0, -1.0); - surf_solve(-1.0); /* Takes traces into account. Returns 0.0 */ + surf_solve(-1.0); /* Takes traces into account. Returns 0.0 */ do { simgrid::kernel::resource::Action* action = nullptr; - running = 0; + running = 0; double now = surf_get_clock(); XBT_INFO("Next Event : %g", now); @@ -60,7 +60,7 @@ int main(int argc, char **argv) } action = model->extract_done_action(); - while (action != nullptr){ + while (action != nullptr) { XBT_INFO(" * Done Action"); XBT_DEBUG("\t * Done Action: %p", action); action->unref();