on which they occur during their execution.
|br| `examples/s4u/exec-remote/s4u-exec-remote.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-remote/s4u-exec-remote.cpp>`_
+ - **Parallel executions:**
+ These objects are convenient abstractions of parallel
+ computational kernels that span over several machines, such as a
+ PDGEM and the other ScaLAPACK routines. Note that this only works
+ with the "ptask_L07" host model (`--cfg=host/model:ptask_L07`).
+ |br| `examples/s4u/exec-ptask/s4u-exec-ptask.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-ptask/s4u-exec-ptask.cpp>`_
+
- **Using Pstates on a host:**
Shows how define a set of pstatesfor a host in the XML, and how the current
pstate can be accessed/changed with :cpp:func:`simgrid::s4u::Host::get_pstate_speed` and :cpp:func:`simgrid::s4u::Host::set_pstate`.
|br| `examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp>`_
|br| `examples/platforms/energy_platform.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/energy_platform.xml>`_
- - **Parallel executions:**
- These objects are convenient abstractions of parallel
- computational kernels that span over several machines, such as a
- PDGEM and the other ScaLAPACK routines.
- |br| `examples/s4u/exec-ptask/s4u-exec-ptask.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-ptask/s4u-exec-ptask.cpp>`_
-
I/O on Disks and Files
----------------------
* Please note that you must have the LV07 platform model enabled to use such constructs.
*/
-#include "simgrid/plugins/energy.h"
#include <simgrid/s4u.hpp>
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_energyptask, "Messages specific for this s4u example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_ptask, "Messages specific for this s4u example");
static void runner()
{
std::vector<double> communication_amounts;
/* ------[ test 1 ]----------------- */
- computation_amounts.assign(hosts.size(), 1e9 /*1Gflop*/);
- communication_amounts.assign(hosts.size() * hosts.size(), 0);
+ computation_amounts.assign(hosts_count, 1e9 /*1Gflop*/);
+ communication_amounts.assign(hosts_count * hosts_count, 0);
for (size_t i = 0; i < hosts_count; i++)
for (size_t j = i + 1; j < hosts_count; j++)
communication_amounts[i * hosts_count + j] = 1e7; // 10 MB
simgrid::s4u::this_actor::parallel_execute(hosts, computation_amounts, communication_amounts);
/* ------[ test 2 ]----------------- */
- XBT_INFO("We can do the same with a timeout of one second enabled.");
- computation_amounts.assign(hosts.size(), 1e9 /*1Gflop*/);
- communication_amounts.assign(hosts.size() * hosts.size(), 0);
+ XBT_INFO("We can do the same with a timeout of 10 seconds enabled.");
+ computation_amounts.assign(hosts_count, 1e9 /*1Gflop*/);
+ communication_amounts.assign(hosts_count * hosts_count, 0);
for (size_t i = 0; i < hosts_count; i++)
for (size_t j = i + 1; j < hosts_count; j++)
communication_amounts[i * hosts_count + j] = 1e7; // 10 MB
try {
simgrid::s4u::this_actor::parallel_execute(hosts, computation_amounts, communication_amounts,
- 1.0 /* timeout (in seconds)*/);
- XBT_WARN("Woops, this did not timeout as expected... Please report that bug.");
- } catch (xbt_ex& e) {
- /* Do nothing this exception on timeout was expected */
- XBT_DEBUG("Caught expected exception: %s", e.what());
+ 10.0 /* timeout (in seconds)*/);
+ xbt_die("Woops, this did not timeout as expected... Please report that bug.");
+ } catch (simgrid::TimeoutError& e) {
+ XBT_INFO("Caught the expected timeout exception.");
}
/* ------[ test 3 ]----------------- */
- XBT_INFO("Then, build a parallel task involving only computations and no communication (1 Gflop per node)");
- computation_amounts.assign(hosts.size(), 1e9 /*1Gflop*/);
- communication_amounts.clear(); /* no comm */
+ XBT_INFO("Then, build a parallel task involving only computations (of different amounts) and no communication");
+ computation_amounts = {3e8, 6e8, 1e9}; // 300Mflop, 6Mflop, 1Gflop
+ communication_amounts.clear(); // no comm
simgrid::s4u::this_actor::parallel_execute(hosts, computation_amounts, communication_amounts);
/* ------[ test 4 ]----------------- */
- XBT_INFO("Then, build a parallel task involving only heterogeneous computations and no communication");
- computation_amounts.resize(hosts.size());
- for (size_t i = 0; i < hosts_count; i++)
- computation_amounts[i] = 5 * (i + 1) * 1e8; // 500Mflop, 1Gflop, 1.5Gflop
- communication_amounts.clear(); /* no comm */
- simgrid::s4u::this_actor::parallel_execute(hosts, computation_amounts, communication_amounts);
-
- /* ------[ test 5 ]----------------- */
XBT_INFO("Then, build a parallel task with no computation nor communication (synchro only)");
computation_amounts.clear();
communication_amounts.clear();
simgrid::s4u::this_actor::parallel_execute(hosts, computation_amounts, communication_amounts);
- /* ------[ test 6 ]----------------- */
- XBT_INFO("Finally, trick the ptask to do a 'remote execution', on host %s", hosts[1]->get_cname());
- std::vector<simgrid::s4u::Host*> remote;
- remote.push_back(hosts[1]);
- computation_amounts.assign(1, 1e9);
- communication_amounts.clear();
-
- simgrid::s4u::this_actor::parallel_execute(remote, computation_amounts, communication_amounts);
-
XBT_INFO("Goodbye now!");
}
{
simgrid::s4u::Engine e(&argc, argv);
- xbt_assert(argc <= 3, "1Usage: %s <platform file> [--energy]", argv[0]);
- xbt_assert(argc >= 2, "2Usage: %s <platform file> [--energy]", argv[0]);
-
- if (argc == 3 && argv[2][2] == 'e')
- sg_host_energy_plugin_init();
+ xbt_assert(argc == 2, "Usage: %s <platform file>", argv[0]);
e.load_platform(argv[1]);
-
- /* Pick a process, no matter which, from the platform file */
simgrid::s4u::Actor::create("test", simgrid::s4u::Host::by_name("MyHost1"), runner);
e.run();
#!/usr/bin/env tesh
-$ ${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"
+$ ${bindir:=.}/s4u-exec-ptask$EXEEXT ${platfdir}/energy_platform.xml --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'
> [300.000000] (0:maestro@) UNCAT HOST [0.000000 - 300.000000] MyHost2 speed_used 3333333.333333
> [300.000000] (0:maestro@) UNCAT HOST [0.000000 - 300.000000] MyHost3 speed_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] (0:maestro@) UNCAT HOST [301.000000 - 311.000000] MyHost1 speed_used 100000000.000000
-> [311.000000] (0:maestro@) UNCAT HOST [301.000000 - 311.000000] MyHost2 speed_used 100000000.000000
-> [311.000000] (0:maestro@) UNCAT HOST [301.000000 - 311.000000] MyHost3 speed_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 speed_used 33333333.333333
-> [326.000000] (0:maestro@) UNCAT HOST [311.000000 - 326.000000] MyHost2 speed_used 66666666.666667
-> [326.000000] (0:maestro@) UNCAT HOST [311.000000 - 326.000000] MyHost3 speed_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 speed_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
+> [300.000000] (1:test@MyHost1) We can do the same with a timeout of 10 seconds enabled.
+> [310.000000] (1:test@MyHost1) Caught the expected timeout exception.
+> [310.000000] (1:test@MyHost1) Then, build a parallel task involving only computations (of different amounts) and no communication
+> [320.000000] (0:maestro@) UNCAT HOST [310.000000 - 320.000000] MyHost1 speed_used 30000000.000000
+> [320.000000] (0:maestro@) UNCAT HOST [310.000000 - 320.000000] MyHost2 speed_used 60000000.000000
+> [320.000000] (0:maestro@) UNCAT HOST [310.000000 - 320.000000] MyHost3 speed_used 100000000.000000
+> [320.000000] (1:test@MyHost1) Then, build a parallel task with no computation nor communication (synchro only)
+> [320.000000] (1:test@MyHost1) Goodbye now!
+> [320.000000] (0:maestro@) Simulation done.