// Update the list of current choked and unchoked peers, using the choke algorithm
private void updateChokedPeers() {
round = (round + 1) % 3;
- if (peers.size() == 0) {
+ if (peers.isEmpty()) {
return;
}
//remove a peer from the list
std::vector<std::string> splittedval((std::istream_iterator<std::string>(iss)),
std::istream_iterator<std::string>());
- xbt_assert(splittedval.size() > 0, "Invalid profile line");
+ xbt_assert(not splittedval.empty(), "Invalid profile line");
if (splittedval[0] == "DET") {
stochevent.date_law = Distribution::DET;
ExecPtr exec_init(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
const std::vector<double>& bytes_amounts)
{
- xbt_assert(hosts.size() > 0, "Your parallel executions must span over at least one host.");
+ xbt_assert(not hosts.empty(), "Your parallel executions must span over at least one host.");
xbt_assert(hosts.size() == flops_amounts.size() || flops_amounts.empty(),
"Host count (%zu) does not match flops_amount count (%zu).", hosts.size(), flops_amounts.size());
xbt_assert(hosts.size() * hosts.size() == bytes_amounts.size() || bytes_amounts.empty(),
xbt_assert(in, "smpirun: Cannot open the host file: %s", hostfile.c_str());
std::string str;
while (std::getline(in, str)) {
- if (str.size() > 0)
+ if (not str.empty())
hosts.emplace_back(e->host_by_name(str));
}
- xbt_assert(hosts.size(), "smpirun: the hostfile '%s' is empty", hostfile.c_str());
+ xbt_assert(not hosts.empty(), "smpirun: the hostfile '%s' is empty", hostfile.c_str());
return hosts;
}
xbt_assert(in, "smpirun: Cannot open the replay file: %s", replayfile.c_str());
std::string str;
while (std::getline(in, str)) {
- if (str.size() > 0)
+ if (not str.empty())
replay.emplace_back(str);
}
{
std::vector<std::string> args{std::to_string(rank_id)};
// pass arguments to process only if not a replay execution
- if (replay.size() == 0) {
+ if (replay.empty()) {
for (int i = 0; i < argc; i++) {
args.push_back(argv[i]);
}
}
actor->set_property("instance_id", "smpirun");
actor->set_property("rank", rank_id);
- if (replay.size() > 0)
+ if (not replay.empty())
actor->set_property("smpi_replay", "true");
/* shared trace file, set it to rank 0 */
if (i == 0 && replay.size() == 1)
CpuImpl* CpuImpl::set_pstate_speed(const std::vector<double>& speed_per_state)
{
- xbt_assert(speed_per_state.size() > 0, "CPU %s: processor speed vector cannot be empty", get_cname());
+ xbt_assert(not speed_per_state.empty(), "CPU %s: processor speed vector cannot be empty", get_cname());
xbt_assert(not is_sealed(), "CPU %s: processor speed cannot be changed once CPU has been sealed", get_cname());
speed_per_pstate_ = speed_per_state;
speed_.peak = speed_per_pstate_.front();
XBT_INFO("Next Event : %g", now);
for (auto const& model : simgrid::kernel::EngineImpl::get_instance()->get_all_models()) {
- if (model->get_started_action_set()->size() != 0) {
+ if (not model->get_started_action_set()->empty()) {
XBT_DEBUG("\t Running that model");
running = 1;
}