computation_amounts[i] = 1e9; // 1 Gflop
simgrid::s4u::this_actor::parallel_execute(hosts_count, hosts.data(), computation_amounts, nullptr /* no comm */);
+ XBT_INFO("Then, build a parallel task involving only heterogeneous computations and no communication");
+ computation_amounts = new double[hosts_count]();
+ for (int i = 0; i < hosts_count; i++)
+ computation_amounts[i] = 5 * (i + 1) * 1e8; // 500Mflop, 1Gflop, 1.5Gflop
+ simgrid::s4u::this_actor::parallel_execute(hosts_count, hosts.data(), computation_amounts, nullptr /* no comm */);
+
XBT_INFO("Then, build a parallel task with no computation nor communication (synchro only)");
computation_amounts = new double[hosts_count]();
communication_amounts = new double[hosts_count * hosts_count]();
#!/usr/bin/env tesh
-$ ${bindir:=.}/s4u-exec-ptask$EXEEXT ${platfdir}/energy_platform.xml --energy --cfg=host/model:ptask_L07 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/s4u-exec-ptask$EXEEXT ${platfdir}/energy_platform.xml --energy --cfg=host/model:ptask_L07 --cfg=tracing:yes --cfg=tracing/uncategorized:yes --log=instr_resource.t:debug --log=no_loc "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (0:maestro@) Configuration change: Set 'host/model' to 'ptask_L07'
+> [ 0.000000] (0:maestro@) Configuration change: Set 'tracing' to 'yes'
+> [ 0.000000] (0:maestro@) Configuration change: Set 'tracing/uncategorized' to 'yes'
> [ 0.000000] (0:maestro@) Switching to the L07 model to handle parallel tasks.
> [ 0.000000] (1:test@MyHost1) First, build a classical parallel task, with 1 Gflop to execute on each node, and 10MB to exchange between each pair
+> [300.000000] (0:maestro@) UNCAT HOST [0.000000 - 300.000000] MyHost1 power_used 3333333.333333
+> [300.000000] (0:maestro@) UNCAT HOST [0.000000 - 300.000000] MyHost2 power_used 3333333.333333
+> [300.000000] (0:maestro@) UNCAT HOST [0.000000 - 300.000000] MyHost3 power_used 3333333.333333
+> [300.000000] (0:maestro@) UNCAT LINK [0.000000 - 300.000000] bus bandwidth_used 100000.000000
> [300.000000] (1:test@MyHost1) We can do the same with a timeout of one second enabled.
> [301.000000] (1:test@MyHost1) Then, build a parallel task involving only computations and no communication (1 Gflop per node)
-> [311.000000] (1:test@MyHost1) Then, build a parallel task with no computation nor communication (synchro only)
-> [311.000000] (1:test@MyHost1) Finally, trick the ptask to do a 'remote execution', on host MyHost2
-> [321.000000] (1:test@MyHost1) Goodbye now!
-> [321.000000] (0:maestro@) Total energy consumption: 157960.888889 Joules (used hosts: 157960.888889 Joules; unused/idle hosts: 0.000000)
-> [321.000000] (0:maestro@) Simulation done.
-> [321.000000] (0:maestro@) Energy consumption of host MyHost1: 30560.888889 Joules
-> [321.000000] (0:maestro@) Energy consumption of host MyHost2: 64200.000000 Joules
-> [321.000000] (0:maestro@) Energy consumption of host MyHost3: 63200.000000 Joules
+> [311.000000] (0:maestro@) UNCAT HOST [301.000000 - 311.000000] MyHost1 power_used 100000000.000000
+> [311.000000] (0:maestro@) UNCAT HOST [301.000000 - 311.000000] MyHost2 power_used 100000000.000000
+> [311.000000] (0:maestro@) UNCAT HOST [301.000000 - 311.000000] MyHost3 power_used 100000000.000000
+> [311.000000] (1:test@MyHost1) Then, build a parallel task involving only heterogeneous computations and no communication
+> [326.000000] (0:maestro@) UNCAT HOST [311.000000 - 326.000000] MyHost1 power_used 33333333.333333
+> [326.000000] (0:maestro@) UNCAT HOST [311.000000 - 326.000000] MyHost2 power_used 66666666.666667
+> [326.000000] (0:maestro@) UNCAT HOST [311.000000 - 326.000000] MyHost3 power_used 100000000.000000
+> [326.000000] (1:test@MyHost1) Then, build a parallel task with no computation nor communication (synchro only)
+> [326.000000] (1:test@MyHost1) Finally, trick the ptask to do a 'remote execution', on host MyHost2
+> [336.000000] (0:maestro@) UNCAT HOST [326.000000 - 336.000000] MyHost2 power_used 100000000.000000
+> [336.000000] (1:test@MyHost1) Goodbye now!
+> [336.000000] (0:maestro@) Total energy consumption: 165494.222222 Joules (used hosts: 165494.222222 Joules; unused/idle hosts: 0.000000)
+> [336.000000] (0:maestro@) Simulation done.
+> [336.000000] (0:maestro@) Energy consumption of host MyHost1: 32094.222222 Joules
+> [336.000000] (0:maestro@) Energy consumption of host MyHost2: 67200.000000 Joules
+> [336.000000] (0:maestro@) Energy consumption of host MyHost3: 66200.000000 Joules
static_cast<simgrid::kernel::resource::Resource*>(action->get_variable()->get_constraint(i)->get_id());
simgrid::surf::Cpu* cpu = dynamic_cast<simgrid::surf::Cpu*>(resource);
- if (cpu != nullptr)
- TRACE_surf_resource_set_utilization("HOST", "power_used", cpu->get_cname(), action->get_category(),
- action->get_variable()->get_value(), action->get_last_update(),
- SIMIX_get_clock() - action->get_last_update());
+ if (cpu != nullptr) {
+ double value = action->get_variable()->get_value() * action->get_variable()->get_constraint_weight(i);
+ TRACE_surf_resource_set_utilization("HOST", "power_used", cpu->get_cname(), action->get_category(), value,
+ action->get_last_update(), SIMIX_get_clock() - action->get_last_update());
+ }
simgrid::kernel::resource::LinkImpl* link = dynamic_cast<simgrid::kernel::resource::LinkImpl*>(resource);
if (link != nullptr) {
/* min_power corresponds to the idle power (link load = 0) */
/* max_power is the power consumed at 100% link load */
- char* idleMsg = bprintf("Invalid idle power value for link%s", this->link_->get_cname());
- char* busyMsg = bprintf("Invalid busy power value for %s", this->link_->get_cname());
+ try {
+ idle_ = std::stod(current_power_values.front());
+ } catch (std::invalid_argument& ia) {
+ throw std::invalid_argument(std::string("Invalid idle power value for link ") + this->link_->get_cname());
+ }
+
+ try {
+ busy_ = std::stod(current_power_values.back());
+ } catch (std::invalid_argument& ia) {
+ throw std::invalid_argument(std::string("Invalid busy power value for link ") + this->link_->get_cname());
+ }
- idle_ = xbt_str_parse_double((current_power_values.at(0)).c_str(), idleMsg);
- busy_ = xbt_str_parse_double((current_power_values.at(1)).c_str(), busyMsg);
-
- xbt_free(idleMsg);
- xbt_free(busyMsg);
update();
}
}