@brief Find the MSG example fitting your needs from the extensive set provided in the archive.
- @ref msg_ex_basics
- - @ref msg_ex_async
- @ref msg_ex_process
- @ref msg_ex_tracing
- @ref msg_ex_tracing_user_variables
task to dispatch to a set of several Worker processes. It is fully
commented in @ref msg_ex_master_worker.
-@section msg_ex_async Asynchronous communications
-
-In addition to the fully documented example of @ref
-MSG_ex_asynchronous_communications, there are several other examples
-shipped in the archive:
-
- - <b>Basic asynchronous communications</b>.
- @ref examples/msg/async-wait/async-wait.c \n
- Illustrates how to have non-blocking communications, that are
- communications running in the background leaving the process free
- to do something else during their completion. The main functions
- involved are @ref MSG_task_isend, @ref MSG_task_irecv, and @ref
- MSG_comm_wait.
-
- - <b>Waiting for all communications in a set</b>.
- @ref examples/msg/async-waitall/async-waitall.c\n
- The @ref MSG_comm_waitall function is useful when you want to block
- until all activities in a given set have completed.
-
- - <b>Waiting for the first completed communication in a set</b>.
- @ref examples/msg/async-waitany/async-waitany.c\n
- The @ref MSG_comm_waitany function is useful when you want to block
- until one activity of the set completes, no matter which terminates
- first.
-
@section msg_ex_process Acting on Processes
- <b>Creating processes</b>.
Most processes are started from the deployment XML file, but they
can also be used with the @ref MSG_process_create() function.
- - <b>Suspend and Resume processes</b>.
- @ref examples/msg/process-suspend/process-suspend.c \n
- Processes can be suspended and resumed during their executions
- thanks to the @ref MSG_process_suspend and @ref MSG_process_resume functions.
-
- - <b>Kill processes</b>.
- @ref examples/msg/process-kill/process-kill.c \n
- Processes can forcefully stop other processes with the @ref MSG_process_kill function.
-
- - <b>Migrating processes</b>.
- @ref examples/msg/process-migration/process-migration.c \n
- Processes can move or be moved from a host to another with the @ref MSG_process_migrate function.
-
- <b>Controling the process life cycle from the XML</b>.
@ref examples/msg/process-startkilltime/process-startkilltime.c \n
You can specify a start time and a kill time in the deployment
file. See all *_d.xml files in this directory.
+ - <b>Using Pstates on a host</b>
+ @ref examples/msg/energy-pstate/energy-pstate.c\n
+ Show how define a set of pstates for a host and how the current
+ pstate can be accessed/changed with @ref MSG_get_host_current_power_peak and @ref MSG_set_host_pstate.
+ See also the platform XML file for have a details on how to declare the CPU capacity for each pstate.
+
@section msg_ex_tracing Tracing and visualization features
Tracing can be activated by various configuration options which
displayed as arrows in a Gantt-chart visualization. Recommanded
options to that extend:
@verbatim -cfg=tracing:yes --cfg=tracing/msg/process:yes
- @endverbatim
-
+ @endverbatim
+
TODO: These tracing examples should be integrated in the examples to
not duplicate the C files. A full command line to see the result in
the right tool (vite/FrameSoc) should be given along with some
The examples of this section demonstrate how to interact with the
simulated storages.
- - <b>Basic example</b>.
- @ref examples/msg/io-storage/io-storage.c \n
- All main storage and file functions are demoed.
-
- <b>File Management</b>. @ref examples/msg/io-file/io-file.c \n
This example illustrates the use of operations on file
(@ref MSG_file_open, @ref MSG_file_read, @ref MSG_file_write,
@example examples/msg/app-token-ring/app-token-ring.c
@example examples/msg/app-masterworker/app-masterworker.c
-@example examples/msg/async-wait/async-wait.c
-@example examples/msg/async-waitall/async-waitall.c
-@example examples/msg/async-waitany/async-waitany.c
-
@example examples/msg/process-create/process-create.c
-@example examples/msg/process-suspend/process-suspend.c
-@example examples/msg/process-kill/process-kill.c
-@example examples/msg/process-migration/process-migration.c
@example examples/msg/process-startkilltime/process-startkilltime.c
@example examples/msg/trace-platform/trace-platform.c
foreach (example actions-comm actions-storage
actor-create actor-daemon actor-execute actor-kill actor-lifetime actor-migration actor-suspend actor-priority actor-yield
- app-masterworker app-pingpong app-token-ring energy-pstate
- async-wait async-waitany async-waitall
- energy-link
- plugin-hostload io mutex)
+ app-masterworker app-pingpong app-token-ring
+ async-wait async-waitany async-waitall
- energy-link energy-ptask
++ energy-link energy-pstate energy-ptask
+ io io-file-remote io-storage-raw
+ platform-properties plugin-hostload mutex)
add_executable (s4u-${example} ${example}/s4u-${example}.cpp)
target_link_libraries(s4u-${example} simgrid)
set_target_properties(s4u-${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
set(examples_src ${examples_src} PARENT_SCOPE)
set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/s4u-app-bittorrent.tesh
${CMAKE_CURRENT_SOURCE_DIR}/dht-chord/s4u-dht-chord.tesh
+ ${CMAKE_CURRENT_SOURCE_DIR}/energy-pstate/s4u-energy-pstate.tesh
+ ${CMAKE_CURRENT_SOURCE_DIR}/actor-priority/s4u-actor-priority.tesh
${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/s4u-actor-lifetime.tesh
${CMAKE_CURRENT_SOURCE_DIR}/actor-priority/s4u-actor-priority.tesh
${CMAKE_CURRENT_SOURCE_DIR}/actor-yield/s4u-actor-yield.tesh
${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/s4u-actions-comm_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/actions-storage/s4u-actions-storage_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/actor-create/s4u-actor-create_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/s4u-actor-lifetime_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/actor-priority/s4u-actor-priority_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/actor-yield/s4u-actor-yield_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/s4u-app-bittorrent_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/async-waitall/s4u-async-waitall_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/async-wait/s4u-async-wait_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/dht-chord/s4u-dht-chord_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/s4u-actor-lifetime_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/io-file-remote/s4u-io-file-remote_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/platform-properties/s4u-platform-properties_d.xml
PARENT_SCOPE)
set(txt_files ${txt_files} ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/s4u-actions-comm-split-p0.txt
${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/s4u-actions-comm-split-p1.txt
foreach(example actions-comm actions-storage
actor-create actor-daemon actor-execute actor-kill actor-lifetime actor-migration actor-suspend actor-priority actor-yield
- app-bittorrent app-masterworker app-pingpong app-token-ring energy-pstate
- async-wait async-waitall async-waitany
- dht-chord
- energy-link
- plugin-hostload io mutex)
- ADD_TESH_FACTORIES(s4u-${example} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_HOME_DIRECTORY}/examples/s4u/${example} s4u-${example}.tesh)
+ app-bittorrent app-masterworker app-pingpong app-token-ring
+ async-wait async-waitall async-waitany
+ dht-chord
- energy-link energy-ptask
++ energy-link energy-pstate energy-ptask
+ platform-properties plugin-hostload mutex
+ io io-file-remote io-storage-raw)
+ ADD_TESH_FACTORIES(s4u-${example} "thread;ucontext;raw;boost"
+ --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
+ --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
+ --cd ${CMAKE_CURRENT_BINARY_DIR}/${example}
+ ${CMAKE_HOME_DIRECTORY}/examples/s4u/${example}/s4u-${example}.tesh)
endforeach()
@ref examples/s4u/actor-migration/s4u-actor-migration.cpp \n
Actors can move or be moved from a host to another with the @ref migrate method.
+ - <b>Using Pstates on a host</b>
+ @ref examples/s4u/energy-pstate/s4u-energy-pstate.c\n
+ Show how define a set of pstates for a host and how the current
+ pstate can be accessed/changed with @ref getPstateSpeed and @ref sg_host_set_pstate.
+ See also the platform XML file for have a details on how to declare the CPU capacity for each pstate.
+
- <b>Yielding to other actor</b>.
@ref examples/s4u/actor-yield/s4u-actor-yield.c\n
The simgrid::s4u::this_actor::yield() function interrupts the
Presents a set of event handlers reproducing classical I/O
primitives (open, read, close).
+@subsection s4u_ex_io Simulating disks and files
+
+The examples of this section demonstrate how to interact with the
+simulated storages.
+
+ - <b>Access to raw storage devices </b>.
+ @ref examples/s4u/io-raw-storage/s4u-io-raw-storage.cpp \n
+ This example illustrates how to simply read and write data on a
+ simulated storage resource.
+
+ - <b>Remote I/O</b>.
+ @ref examples/s4u/io-file-remote/s4u-io-file-remote.cpp \n
+ I/O operations on files can also be done in a remote fashion,
+ i.e. when the accessed disk is not mounted on the caller's host.
+
*/
/**
@example examples/s4u/app-token-ring/s4u-app-token-ring.cpp
@example examples/s4u/app-masterworker/s4u-app-masterworker.cpp
@example examples/s4u/app-pingpong/s4u-app-pingpong.cpp
-
+@example examples/s4u/io-file-remote/s4u-io-file-remote.cpp
+@example examples/s4u/io-raw-storage/s4u-io-raw-storage.cpp
@example examples/s4u/mutex/s4u-mutex.cpp
*/
--- /dev/null
-$ ${bindir:=.}/s4u-energy-pstate$EXEEXT ${srcdir:=.}/../platforms/energy_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+ #! ./tesh
+
+ p Testing the DVFS-related functions
+
-$ ${bindir:=.}/s4u-energy-pstate$EXEEXT ${srcdir:=.}/../platforms/energy_cluster.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
++$ ${bindir:=.}/s4u-energy-pstate$EXEEXT ${platfdir}/energy_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+ > [ 0.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+ > [ 0.000000] (1:dvfs_test@MyHost1) Current power peak=100000000.000000
+ > [ 0.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
+ > [ 0.000000] (2:dvfs_test@MyHost2) Current power peak=100000000.000000
+ > [ 1.000000] (1:dvfs_test@MyHost1) Task1 simulation time: 1.000000e+00
+ > [ 1.000000] (2:dvfs_test@MyHost2) Task1 simulation time: 1.000000e+00
+ > [ 1.000000] (1:dvfs_test@MyHost1) Changing power peak value to 20000000.000000 (at index 2)
+ > [ 1.000000] (2:dvfs_test@MyHost2) Changing power peak value to 20000000.000000 (at index 2)
+ > [ 1.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
+ > [ 1.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
+ > [ 6.000000] (1:dvfs_test@MyHost1) Task2 simulation time: 5.000000e+00
+ > [ 6.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+ > [ 6.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
+ > [ 6.000000] (2:dvfs_test@MyHost2) Task2 simulation time: 5.000000e+00
+ > [ 6.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
+ > [ 6.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
+ > [ 6.000000] (0:maestro@) Total simulation time: 6.000000e+00
+
++$ ${bindir:=.}/s4u-energy-pstate$EXEEXT ${platfdir}/energy_cluster.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+ > [ 0.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+ > [ 0.000000] (1:dvfs_test@MyHost1) Current power peak=100000000.000000
+ > [ 0.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
+ > [ 0.000000] (2:dvfs_test@MyHost2) Current power peak=100000000.000000
+ > [ 1.000000] (1:dvfs_test@MyHost1) Task1 simulation time: 1.000000e+00
+ > [ 1.000000] (2:dvfs_test@MyHost2) Task1 simulation time: 1.000000e+00
+ > [ 1.000000] (1:dvfs_test@MyHost1) Changing power peak value to 20000000.000000 (at index 2)
+ > [ 1.000000] (2:dvfs_test@MyHost2) Changing power peak value to 20000000.000000 (at index 2)
+ > [ 1.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
+ > [ 1.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
+ > [ 6.000000] (1:dvfs_test@MyHost1) Task2 simulation time: 5.000000e+00
+ > [ 6.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+ > [ 6.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
+ > [ 6.000000] (2:dvfs_test@MyHost2) Task2 simulation time: 5.000000e+00
+ > [ 6.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
+ > [ 6.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
+ > [ 6.000000] (0:maestro@) Total simulation time: 6.000000e+00
! output sort 19
--$ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${srcdir:=.}/small_platform_fatpipe.xml actions-comm_split_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
++$ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${platfdir}/small_platform_fatpipe.xml actions-comm_split_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 20.703314] (1:p0@Tremblay) p0 recv p1 20.703314
> [ 20.703314] (2:p1@Ruby) p1 send p0 1e10 20.703314
> [ 30.897513] (0:maestro@) Simulation time 30.8975
> [ 30.897513] (2:p1@Ruby) p1 compute 1e9 10.194200
! output sort 19
--$ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${srcdir:=.}/small_platform_fatpipe.xml actions-comm_d.xml actions-comm.txt "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
++$ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${platfdir}/small_platform_fatpipe.xml actions-comm_d.xml actions-comm.txt "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:p0@Tremblay) p0 comm_size 3 0.000000
> [ 1.037020] (1:p0@Tremblay) p0 bcast 5e8 1.037020
> [ 1.037020] (2:p1@Ruby) p1 bcast 5e8 1.037020
! output sort 19
--$ ${bindir:=.}/actions-storage --log=storage_actions.thres=verbose ${srcdir:=.}/storage/storage.xml actions-storage_d.xml actions-storage.txt "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
++$ ${bindir:=.}/actions-storage --log=storage_actions.thres=verbose ${platfdir}/storage/storage.xml actions-storage_d.xml actions-storage.txt "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:p0@denise) p0 open /home/lib/libsimgrid.so.3.6.2 0.000000
> [ 0.063552] (1:p0@denise) p0 read /home/lib/libsimgrid.so.3.6.2 12710497 0.063552
> [ 0.063552] (1:p0@denise) p0 close /home/lib/libsimgrid.so.3.6.2 0.000000
! timeout 10
! output sort 19
--$ ${bindir:=.}/bittorrent ${srcdir:=.}/cluster.xml app-bittorrent_d.xml "--log=root.fmt:[%12.6r]%e(%i:%P@%h)%e%m%n"
++$ ${bindir:=.}/bittorrent ${platfdir}/cluster.xml app-bittorrent_d.xml "--log=root.fmt:[%12.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:tracker@node-0.acme.org) Tracker launched.
> [ 0.000000] (2:peer@node-1.acme.org) Hi, I'm joining the network with id 2
> [ 0.000000] (3:peer@node-2.acme.org) Hi, I'm joining the network with id 3