communication_amount[2] = comm_amount21;
/* estimated time */
- SD_task_t task = taskD;
- XBT_INFO("Estimated time for '%s': %f", SD_task_get_name(task), SD_task_get_execution_time(task, 2, host_list,
- computation_amount, communication_amount));
+ XBT_INFO("Estimated time for '%s': %f", SD_task_get_name(taskD),
+ SD_task_get_execution_time(taskD, 2, host_list, computation_amount, communication_amount));
SD_task_schedule(taskA, 2, host_list, computation_amount, communication_amount, -1);
SD_task_schedule(taskB, 2, host_list, computation_amount, communication_amount, -1);
/** @brief Attribute the value bound to var->bound.
*
- * @param func_f function (f)
- * @param func_fp partial differential of f (f prime, (f'))
- * @param func_fpi inverse of the partial differential of f (f prime inverse, (f')^{-1})
+ * @param f function (f)
+ * @param fp partial differential of f (f prime, (f'))
+ * @param fpi inverse of the partial differential of f (f prime inverse, (f')^{-1})
*
* Set default functions to the ones passed as parameters.
*/
-void Lagrange::set_default_protocol_function(double (*func_f)(const Variable& var, double x),
- double (*func_fp)(const Variable& var, double x),
- double (*func_fpi)(const Variable& var, double x))
+void Lagrange::set_default_protocol_function(double (*f)(const Variable& var, double x),
+ double (*fp)(const Variable& var, double x),
+ double (*fpi)(const Variable& var, double x))
{
- Lagrange::func_f = func_f;
- Lagrange::func_fp = func_fp;
- Lagrange::func_fpi = func_fpi;
+ func_f = f;
+ func_fp = fp;
+ func_fpi = fpi;
}
double (*Lagrange::func_f)(const Variable&, double);
if (cmp == 0) {
// Find the whole range:
- size_type first = cursor;
+ first = cursor;
while (first != 0 && this->global_variables[first - 1].name == name)
first--;
size_type size = this->global_variables.size();
- size_type last = cursor;
+ last = cursor;
while (last != size - 1 && this->global_variables[last + 1].name == name)
last++;
namespace simgrid {
namespace mc {
-Checker::Checker(Session& session) : session_(&session)
+Checker::Checker(Session& s) : session_(&s)
{
xbt_assert(mc_model_checker);
xbt_assert(mc_model_checker->getChecker() == nullptr);
}
}
-CommunicationDeterminismChecker::CommunicationDeterminismChecker(Session& session) : Checker(session)
+CommunicationDeterminismChecker::CommunicationDeterminismChecker(Session& s) : Checker(s)
{
}
void CommunicationDeterminismChecker::restoreState()
{
/* Intermediate backtracking */
- simgrid::mc::State* state = stack_.back().get();
- if (state->system_state) {
- simgrid::mc::restore_snapshot(state->system_state);
- MC_restore_communications_pattern(state);
+ simgrid::mc::State* last_state = stack_.back().get();
+ if (last_state->system_state) {
+ simgrid::mc::restore_snapshot(last_state->system_state);
+ MC_restore_communications_pattern(last_state);
return;
}
while (not stack_.empty()) {
/* Get current state */
- simgrid::mc::State* state = stack_.back().get();
+ simgrid::mc::State* cur_state = stack_.back().get();
XBT_DEBUG("**************************************************");
- XBT_DEBUG("Exploration depth = %zu (state = %d, interleaved processes = %zu)", stack_.size(), state->num,
- state->interleaveSize());
+ XBT_DEBUG("Exploration depth = %zu (state = %d, interleaved processes = %zu)", stack_.size(), cur_state->num,
+ cur_state->interleaveSize());
/* Update statistics */
mc_model_checker->visited_states++;
if (stack_.size() <= (std::size_t)_sg_mc_max_depth)
- req = MC_state_get_request(state);
+ req = MC_state_get_request(cur_state);
else
req = nullptr;
if (req != nullptr && visited_state == nullptr) {
- int req_num = state->transition.argument;
+ int req_num = cur_state->transition.argument;
XBT_DEBUG("Execute: %s", simgrid::mc::request_to_string(req, req_num, simgrid::mc::RequestType::simix).c_str());
call = MC_get_call_type(req);
/* Answer the request */
- mc_model_checker->handle_simcall(state->transition);
+ mc_model_checker->handle_simcall(cur_state->transition);
/* After this call req is no longer useful */
MC_handle_comm_pattern(call, req, req_num, 0);
next_state->addInterleavingSet(actor.copy.getBuffer());
if (dot_output != nullptr)
- fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n",
- state->num, next_state->num, req_str.c_str());
+ fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", cur_state->num, next_state->num, req_str.c_str());
} else if (dot_output != nullptr)
- fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num,
+ fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", cur_state->num,
visited_state->original_num == -1 ? visited_state->num : visited_state->original_num, req_str.c_str());
stack_.push_back(std::move(next_state));
this->initial_communications_pattern_done = 1;
/* Trash the current state, no longer needed */
- XBT_DEBUG("Delete state %d at depth %zu", state->num, stack_.size());
+ XBT_DEBUG("Delete state %d at depth %zu", cur_state->num, stack_.size());
stack_.pop_back();
visited_state = nullptr;
this->real_run();
}
-Checker* createCommunicationDeterminismChecker(Session& session)
+Checker* createCommunicationDeterminismChecker(Session& s)
{
- return new CommunicationDeterminismChecker(session);
+ return new CommunicationDeterminismChecker(s);
}
}
}
}
-LivenessChecker::LivenessChecker(Session& session) : Checker(session)
+LivenessChecker::LivenessChecker(Session& s) : Checker(s)
{
}
// For each enabled transition in the property automaton, push a
// (application_state, automaton_state) pair to the exploration stack:
- for (int cursor = xbt_dynar_length(current_pair->automaton_state->out) - 1; cursor >= 0; cursor--) {
- xbt_automaton_transition_t transition_succ = (xbt_automaton_transition_t)xbt_dynar_get_as(current_pair->automaton_state->out, cursor, xbt_automaton_transition_t);
+ for (int i = xbt_dynar_length(current_pair->automaton_state->out) - 1; i >= 0; i--) {
+ xbt_automaton_transition_t transition_succ = (xbt_automaton_transition_t)xbt_dynar_get_as(
+ current_pair->automaton_state->out, i, xbt_automaton_transition_t);
if (evaluate_label(transition_succ->label, *prop_values))
explorationStack_.push_back(this->newPair(
current_pair.get(), transition_succ->dst, prop_values));
simgrid::mc::session->logState();
}
-Checker* createLivenessChecker(Session& session)
+Checker* createLivenessChecker(Session& s)
{
- return new LivenessChecker(session);
+ return new LivenessChecker(s);
}
}
void SafetyChecker::restoreState()
{
/* Intermediate backtracking */
- simgrid::mc::State* state = stack_.back().get();
- if (state->system_state) {
- simgrid::mc::restore_snapshot(state->system_state);
+ simgrid::mc::State* last_state = stack_.back().get();
+ if (last_state->system_state) {
+ simgrid::mc::restore_snapshot(last_state->system_state);
return;
}
}
}
-SafetyChecker::SafetyChecker(Session& session) : Checker(session)
+SafetyChecker::SafetyChecker(Session& s) : Checker(s)
{
reductionMode_ = simgrid::mc::reduction_mode;
if (_sg_mc_termination)
stack_.push_back(std::move(initial_state));
}
-Checker* createSafetyChecker(Session& session)
+Checker* createSafetyChecker(Session& s)
{
- return new SafetyChecker(session);
+ return new SafetyChecker(s);
}
}
simgrid::mc::Type* subtype;
simgrid::mc::Type* subsubtype;
- int res;
int elm_size;
const void* addr_pointed1;
const void* addr_pointed2;
}
for (int i = 0; i < type->element_count; i++) {
// TODO, add support for variable stride (DW_AT_byte_stride)
- res = compare_heap_area_with_type(state, process_index, (char*)real_area1 + (i * elm_size),
- (char*)real_area2 + (i * elm_size), snapshot1, snapshot2, previous,
- type->subtype, subtype->byte_size, check_ignore, pointer_level);
+ int res = compare_heap_area_with_type(state, process_index, (char*)real_area1 + (i * elm_size),
+ (char*)real_area2 + (i * elm_size), snapshot1, snapshot2, previous,
+ type->subtype, subtype->byte_size, check_ignore, pointer_level);
if (res == 1)
return res;
}
for (size_t i = 0; i < (area_size / sizeof(void*)); i++) {
addr_pointed1 = snapshot1->read(remote((void**)((char*)real_area1 + i * sizeof(void*))), process_index);
addr_pointed2 = snapshot2->read(remote((void**)((char*)real_area2 + i * sizeof(void*))), process_index);
+ int res;
if (addr_pointed1 > state.std_heap_copy.heapbase && addr_pointed1 < mc_snapshot_get_heap_end(snapshot1) &&
addr_pointed2 > state.std_heap_copy.heapbase && addr_pointed2 < mc_snapshot_get_heap_end(snapshot2))
res = compare_heap_area(state, process_index, addr_pointed1, addr_pointed2, snapshot1, snapshot2, previous,
&& process_count == r2->privatized_data().size());
// Compare the global variables separately for each simulates process:
- for (size_t process_index = 0; process_index < process_count; process_index++) {
- if (compare_global_variables(state,
- object_info, process_index,
- &r1->privatized_data()[process_index],
- &r2->privatized_data()[process_index],
- snapshot1, snapshot2))
+ for (size_t i = 0; i < process_count; i++) {
+ if (compare_global_variables(state, object_info, i, &r1->privatized_data()[i], &r2->privatized_data()[i],
+ snapshot1, snapshot2))
return 1;
}
return 0;
if (dwarf_hasattr(die, DW_AT_start_scope)) {
Dwarf_Attribute attr;
dwarf_attr(die, DW_AT_start_scope, &attr);
- int form = dwarf_whatform(&attr);
- simgrid::dwarf::FormClass form_class = simgrid::dwarf::classify_form(form);
+ form = dwarf_whatform(&attr);
+ form_class = simgrid::dwarf::classify_form(form);
if (form_class == simgrid::dwarf::FormClass::Constant) {
Dwarf_Word value;
variable->start_scope = dwarf_formudata(&attr, &value) == 0 ? (size_t)value : 0;
fd = open(debug_file.c_str(), O_RDONLY);
if (fd < 0)
xbt_die("Could not open file %s", debug_file.c_str());
- Dwarf* dwarf = dwarf_begin(fd, DWARF_C_READ);
+ dwarf = dwarf_begin(fd, DWARF_C_READ);
if (dwarf == nullptr)
xbt_die("No DWARF info in %s for %s",
debug_file.c_str(), info->file_name.c_str());
void postProcessObjectInformation(simgrid::mc::RemoteClient* process, simgrid::mc::ObjectInformation* info)
{
- for (auto& i : info->types) {
+ for (auto& t : info->types) {
- simgrid::mc::Type* type = &(i.second);
+ simgrid::mc::Type* type = &(t.second);
simgrid::mc::Type* subtype = type;
while (subtype->type == DW_TAG_typedef
|| subtype->type == DW_TAG_volatile_type
if (fd < 0)
return - UNW_EINVAL;
while (1) {
- ssize_t s = pread(fd, buf, count, off);
- if (s == 0) {
+ ssize_t nread = pread(fd, buf, count, off);
+ if (nread == 0) {
close(fd);
return - UNW_EINVAL;
}
- if (s == -1)
+ if (nread == -1)
break;
- count -= s;
- buf += s;
- off += s;
+ count -= nread;
+ buf += nread;
+ off += nread;
if (count == 0) {
close(fd);
return 0;
{
const size_t fd_dir_path_size = 20;
char fd_dir_path[fd_dir_path_size];
- int res = snprintf(fd_dir_path, fd_dir_path_size, "/proc/%lli/fd", (long long int)pid);
+ int res;
+ res = snprintf(fd_dir_path, fd_dir_path_size, "/proc/%lli/fd", (long long int)pid);
xbt_assert(res >= 0);
if ((size_t)res > fd_dir_path_size)
xbt_die("Unexpected buffer is too small for fd_dir_path");
const size_t source_size = 25;
char source[25];
- int res = snprintf(source, source_size, "/proc/%lli/fd/%s", (long long int)pid, fd_number->d_name);
+ res = snprintf(source, source_size, "/proc/%lli/fd/%s", (long long int)pid, fd_number->d_name);
xbt_assert(res >= 0);
if ((size_t)res > source_size)
xbt_die("Unexpected buffer is too small for fd %s", fd_number->d_name);
/* min_power corresponds to the power consumed when only one core is active */
/* max_power is the power consumed at 100% cpu load */
auto range = power_range_watts_list_.at(this->pstate_);
- double current_power = 0;
- double min_power = 0;
- double max_power = 0;
- double power_slope = 0;
+ double current_power;
+ double min_power;
+ double max_power;
+ double power_slope;
if (cpu_load > 0) { /* Something is going on, the machine is not idle */
min_power = range.min_;
* i.e., we need min_power + (maxCpuLoad-1/coreCount)*power_slope == max_power
* (maxCpuLoad is by definition 1)
*/
- double power_slope;
int coreCount = host_->get_core_count();
double coreReciprocal = static_cast<double>(1) / static_cast<double>(coreCount);
if (coreCount > 1)
current_power = min_power + (cpu_load - coreReciprocal) * power_slope;
} else { /* Our machine is idle, take the dedicated value! */
+ min_power = 0;
+ max_power = 0;
+ power_slope = 0;
current_power = range.idle_;
}
bool skip_stage2 = false;
size_t remaining_size = ramsize;
- size_t threshold = 0.0;
+
+ double clock_prev_send;
+ double clock_post_send;
+ double bandwidth;
+ size_t threshold;
/* check parameters */
if (ramsize == 0)
sg_vm_start_dirty_page_tracking(vm_);
double computed_during_stage1 = 0;
- double clock_prev_send = s4u::Engine::get_clock();
+ clock_prev_send = s4u::Engine::get_clock();
try {
/* At stage 1, we do not need timeout. We have to send all the memory pages even though the duration of this
return;
}
- double clock_post_send = s4u::Engine::get_clock();
+ clock_post_send = s4u::Engine::get_clock();
mig_timeout -= (clock_post_send - clock_prev_send);
if (mig_timeout < 0) {
XBT_VERB("The duration of stage 1 exceeds the timeout value, skip stage 2");
}
/* estimate bandwidth */
- double bandwidth = ramsize / (clock_post_send - clock_prev_send);
- threshold = bandwidth * max_downtime;
+ bandwidth = ramsize / (clock_post_send - clock_prev_send);
+ threshold = bandwidth * max_downtime;
XBT_DEBUG("actual bandwidth %f (MB/s), threshold %zu", bandwidth / 1024 / 1024, threshold);
/* Stage2: send update pages iteratively until the size of remaining states becomes smaller than threshold value. */
if (remaining_size < threshold)
break;
- sg_size_t sent = 0;
- double clock_prev_send = s4u::Engine::get_clock();
+ sg_size_t sent = 0;
+ clock_prev_send = s4u::Engine::get_clock();
try {
XBT_DEBUG("Stage 2, gonna send %llu", updated_size);
sent = sendMigrationData(updated_size, 2, stage2_round, mig_speed, mig_timeout);
sg_vm_stop_dirty_page_tracking(vm_);
return;
}
- double clock_post_send = s4u::Engine::get_clock();
+ clock_post_send = s4u::Engine::get_clock();
if (sent == updated_size) {
/* timeout did not happen */
- double bandwidth = updated_size / (clock_post_send - clock_prev_send);
- threshold = bandwidth * max_downtime;
+ bandwidth = updated_size / (clock_post_send - clock_prev_send);
+ threshold = bandwidth * max_downtime;
XBT_DEBUG("actual bandwidth %f, threshold %zu", bandwidth / 1024 / 1024, threshold);
remaining_size -= sent;
stage2_round += 1;
for (auto const& elm : computers) {
SD_task_t previous_task = nullptr;
- for (auto const& task : *elm.second) {
+ for (auto const& cur_task : *elm.second) {
/* add dependency between the previous and the task to avoid parallel execution */
- if(task){
- if (previous_task && not SD_task_dependency_exists(previous_task, task))
- SD_task_dependency_add(previous_task, task);
+ if (cur_task) {
+ if (previous_task && not SD_task_dependency_exists(previous_task, cur_task))
+ SD_task_dependency_add(previous_task, cur_task);
- SD_task_schedulel(task, 1, hosts[atoi(elm.first.c_str())]);
- previous_task = task;
+ SD_task_schedulel(cur_task, 1, hosts[std::stod(elm.first)]);
+ previous_task = cur_task;
}
}
delete elm.second;
MPI_Group group_root = nullptr;
MPI_Group group_out = nullptr;
MPI_Group group = this->group();
- int rank = this->rank();
+ int myrank = this->rank();
int size = this->size();
/* Gather all colors and keys on rank 0 */
int* sendbuf = xbt_new(int, 2);
sendbuf[0] = color;
sendbuf[1] = key;
- if(rank == 0) {
+ if (myrank == 0) {
recvbuf = xbt_new(int, 2 * size);
} else {
recvbuf = nullptr;
Coll_gather_default::gather(sendbuf, 2, MPI_INT, recvbuf, 2, MPI_INT, 0, this);
xbt_free(sendbuf);
/* Do the actual job */
- if(rank == 0) {
+ if (myrank == 0) {
MPI_Group* group_snd = xbt_new(MPI_Group, size);
std::vector<std::pair<int, int>> rankmap;
rankmap.reserve(size);
if (from == to) // disregard local comms (should use loopback)
return;
- ActiveComm* comm = nullptr;
if (remove) {
if (to->ActiveCommsDown[from] == 1)
to->ActiveCommsDown.erase(from);
to->nbActiveCommsDown--;
for (std::vector<ActiveComm*>::iterator it = from->ActiveCommsUp.begin(); it != from->ActiveCommsUp.end(); ++it) {
if ((*it)->action == action) {
- comm = (*it);
from->ActiveCommsUp.erase(it);
+ delete *it;
break;
}
}
std::vector<bool> updated(active_nodes.size(), false);
updateIBfactors_rec(from, updated);
XBT_DEBUG("IB - Finished updating %d", from->id);
- delete comm;
}
}
}
/** @brief Add a "router" to the network element list */
simgrid::kernel::routing::NetPoint* sg_platf_new_router(std::string name, const char* coords)
{
- simgrid::kernel::routing::NetZoneImpl* current_routing = routing_get_current();
-
if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::base;
xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(name),
std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
- for (auto const& host : list) {
- msg += host->get_name();
+ for (auto const& some_host : list) {
+ msg += some_host->get_name();
msg += "', '";
if (msg.length() > 1024) {
msg.pop_back(); // remove trailing quote
} else { // start_time <= SIMIX_get_clock()
XBT_DEBUG("Starting Process %s(%s) right now", arg->name.c_str(), host->get_cname());
- simgrid::kernel::actor::ActorImplPtr actor = nullptr;
try {
- actor = simgrid::kernel::actor::ActorImpl::create(arg->name.c_str(), std::move(code), nullptr, host,
- arg->properties.get(), nullptr);
- } catch (simgrid::HostFailureException const&) {
- XBT_WARN("Deployment includes some initially turned off Hosts ... nevermind.");
- }
- /* The actor creation will fail if the host is currently dead, but that's fine */
- if (actor != nullptr) {
+ simgrid::kernel::actor::ActorImplPtr new_actor = nullptr;
+ new_actor = simgrid::kernel::actor::ActorImpl::create(arg->name.c_str(), std::move(code), nullptr, host,
+ arg->properties.get(), nullptr);
+ /* The actor creation will fail if the host is currently dead, but that's fine */
if (arg->kill_time >= 0)
- actor->set_kill_time(arg->kill_time);
+ new_actor->set_kill_time(arg->kill_time);
if (auto_restart)
- actor->set_auto_restart(auto_restart);
+ new_actor->set_auto_restart(auto_restart);
+ } catch (simgrid::HostFailureException const&) {
+ XBT_WARN("Deployment includes some initially turned off Hosts ... nevermind.");
}
}
}