include examples/s4u/exec-waitany/s4u-exec-waitany.tesh
include examples/s4u/io-async/s4u-io-async.cpp
include examples/s4u/io-async/s4u-io-async.tesh
+include examples/s4u/io-disk-raw/s4u-io-disk-raw.cpp
+include examples/s4u/io-disk-raw/s4u-io-disk-raw.tesh
include examples/s4u/io-file-remote/s4u-io-file-remote.cpp
include examples/s4u/io-file-remote/s4u-io-file-remote.tesh
include examples/s4u/io-file-remote/s4u-io-file-remote_d.xml
include examples/s4u/io-file-system/s4u-io-file-system.cpp
include examples/s4u/io-file-system/s4u-io-file-system.tesh
-include examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp
-include examples/s4u/io-storage-raw/s4u-io-storage-raw.tesh
include examples/s4u/maestro-set/s4u-maestro-set.cpp
include examples/s4u/maestro-set/s4u-maestro-set.tesh
include examples/s4u/mc-failing-assert/s4u-mc-failing-assert.cpp
include examples/s4u/replay-comm/s4u-replay-comm.tesh
include examples/s4u/replay-comm/s4u-replay-comm.txt
include examples/s4u/replay-comm/s4u-replay-comm_d.xml
-include examples/s4u/replay-storage/s4u-replay-storage.cpp
-include examples/s4u/replay-storage/s4u-replay-storage.tesh
-include examples/s4u/replay-storage/s4u-replay-storage.txt
-include examples/s4u/replay-storage/s4u-replay-storage_d.xml
+include examples/s4u/replay-io/s4u-replay-io.cpp
+include examples/s4u/replay-io/s4u-replay-io.tesh
+include examples/s4u/replay-io/s4u-replay-io.txt
+include examples/s4u/replay-io/s4u-replay-io_d.xml
include examples/s4u/routing-get-clusters/s4u-routing-get-clusters.cpp
include examples/s4u/routing-get-clusters/s4u-routing-get-clusters.tesh
include examples/s4u/synchro-barrier/s4u-synchro-barrier.cpp
include examples/platforms/faulty_host.xml
include examples/platforms/g5k.xml
include examples/platforms/griffon.xml
+include examples/platforms/hosts_with_disks.xml
include examples/platforms/meta_cluster.xml
include examples/platforms/multicore_machine.xml
include examples/platforms/ns3-big-cluster.xml
include examples/platforms/small_platform_with_routers.xml
include examples/platforms/storage/content/small_content.txt
include examples/platforms/storage/content/storage_content.txt
-include examples/platforms/storage/content/win_storage_content.txt
include examples/platforms/storage/remote_io.xml
include examples/platforms/storage/storage.xml
include examples/platforms/syscoord/generate_peer_platform.pl
include include/simgrid/s4u/Barrier.hpp
include include/simgrid/s4u/Comm.hpp
include include/simgrid/s4u/ConditionVariable.hpp
+include include/simgrid/s4u/Disk.hpp
include include/simgrid/s4u/Engine.hpp
include include/simgrid/s4u/Exec.hpp
include include/simgrid/s4u/Host.hpp
include src/kernel/lmm/maxmin.hpp
include src/kernel/lmm/maxmin_test.cpp
include src/kernel/resource/Action.cpp
+include src/kernel/resource/DiskImpl.cpp
+include src/kernel/resource/DiskImpl.hpp
include src/kernel/resource/Model.cpp
include src/kernel/resource/Resource.cpp
include src/kernel/resource/profile/DatedValue.cpp
include src/s4u/s4u_Barrier.cpp
include src/s4u/s4u_Comm.cpp
include src/s4u/s4u_ConditionVariable.cpp
+include src/s4u/s4u_Disk.cpp
include src/s4u/s4u_Engine.cpp
include src/s4u/s4u_Exec.cpp
include src/s4u/s4u_Host.cpp
include src/surf/cpu_interface.hpp
include src/surf/cpu_ti.cpp
include src/surf/cpu_ti.hpp
+include src/surf/disk_s19.cpp
+include src/surf/disk_s19.hpp
include src/surf/host_clm03.cpp
include src/surf/host_clm03.hpp
include src/surf/network_cm02.cpp
Choosing the Platform Models
............................
-SimGrid comes with several network, CPU and storage models built in,
+SimGrid comes with several network, CPU and disk models built in,
and you can change the used model at runtime by changing the passed
configuration. The three main configuration items are given below.
For each of these items, passing the special ``help`` value gives you
S4U interface to express their computation, communication, disk usage
and other |Activities|_, so that they get reflected within the
simulator. These activities take place on **Resources** (|Hosts|_,
-|Links|_, |Storages|_). SimGrid predicts the time taken by each
+|Links|_, |Disks|_). SimGrid predicts the time taken by each
activity and orchestrates accordingly the actors waiting for the
completion of these activities.
.. |Links| replace:: **Links**
.. _Links: app_s4u.html#s4u-link
-.. |Storages| replace:: **Storages**
-.. _Storages: app_s4u.html#s4u-storage
+.. |Disks| replace:: **Disks**
+.. _Disks: app_s4u.html#s4u-disk
.. |VirtualMachines| replace:: **VirtualMachines**
.. _VirtualMachines: app_s4u.html#s4u-virtualmachine
A host is the computing resource on which an actor can run. See :cpp:class:`simgrid::s4u::Host`.
**Parent tags:** :ref:`pf_tag_zone` (only leaf zones, i.e., zones containing neither inner zones nor clusters) |br|
-**Children tags:** :ref:`pf_tag_mount`, :ref:`pf_tag_prop`, :ref:`pf_tag_storage` |br|
+**Children tags:** :ref:`pf_tag_mount`, :ref:`pf_tag_prop`, :ref:`pf_tag_disk` |br|
**Attributes:**
:``id``: Host name.
- Cluster: this is a zone, see below.
- Host: :cpp:func:`simgrid::s4u::Host::get_property` or :cpp:func:`MSG_host_get_property_value`
- Link: :cpp:func:`simgrid::s4u::Link::get_property`
-- Storage: :cpp:func:`simgrid::s4u::Storage::get_property` or :cpp:func:`MSG_storage_get_property_value`
+- Disk: :cpp:func:`simgrid::s4u::Disk::get_property`
+- Storage :cpp:func:`MSG_storage_get_property_value` (deprecated)
- Zone: :cpp:func:`simgrid::s4u::Zone::get_property` of :cpp:func:`MSG_zone_get_property_value`
**Parent tags:** :ref:`pf_tag_actor`, :ref:`pf_tag_config`, :ref:`pf_tag_cluster`, :ref:`pf_tag_host`,
-:ref:`pf_tag_link`, :ref:`pf_tag_storage`, :ref:`pf_tag_zone` |br|
+:ref:`pf_tag_link`, :ref:`pf_tag_disk`,:ref:`pf_tag_storage` (deprecated), :ref:`pf_tag_zone` |br|
**Children tags:** none |br|
**Attributes:**
break the routes that are longer than 1 hop.
**Parent tags:** :ref:`pf_tag_zone` (only leaf zones, i.e., zones containing neither inner zones nor clusters) |br|
-**Children tags:** :ref:`pf_tag_prop`, :ref:`pf_tag_storage` |br|
**Attributes:**
:``id``: Router name.
:ref:`communication <API_s4u_Comm>`, :ref:`disk usage <API_s4u_Io>`,
and other |API_s4u_Activities|_, so that they get reflected within the
simulator. These activities take place on resources such as |API_s4u_Hosts|_,
-|API_s4u_Links|_ and |API_s4u_Storages|_. SimGrid predicts the time taken by each
+|API_s4u_Links|_ and |API_s4u_Disks|_. SimGrid predicts the time taken by each
activity and orchestrates the actors accordingly, waiting for the
completion of these activities.
- **Platform Elements**
+ - :ref:`class s4u::Disk <API_s4u_Disk>`
+ Resource on which actors can write and read data.
- :ref:`class s4u::Host <API_s4u_Host>`:
Actor location, providing computational power.
- :ref:`class s4u::Link <API_s4u_Link>`
Interconnecting hosts.
- :ref:`class s4u::NetZone <API_s4u_NetZone>`:
Sub-region of the platform, containing resources (Hosts, Links, etc).
- - :ref:`class s4u::Storage <API_s4u_Storage>`
- Resource on which actors can write and read data.
- :ref:`class s4u::VirtualMachine <API_s4u_VirtualMachine>`:
Execution containers that can be moved between Hosts.
- :ref:`class s4u::Exec <API_s4u_Exec>`
Computation activity, started on Host and consuming CPU resources.
- :ref:`class s4u::Io <API_s4u_Io>`
- I/O activity, started on and consumming Storages.
+ I/O activity, started on and consumming disks.
- **Synchronization Mechanisms**: Classical IPC that actors can use
.. |API_s4u_Links| replace:: **Links**
.. _API_s4u_Links: #s4u-link
-.. |API_s4u_Storages| replace:: **Storages**
-.. _API_s4u_Storages: #s4u-storage
+.. |API_s4u_Disks| replace:: **Disks**
+.. _API_s4u_Disks: #s4u-disk
.. |API_s4u_VirtualMachine| replace:: **VirtualMachines**
:cpp:func:`s4u::Mailbox::put_async() <simgrid::s4u::Mailbox::put_async>` and
:cpp:func:`s4u::Mailbox::get_async() <simgrid::s4u::Mailbox::get_async>`.
- :ref:`s4u::IoPtr <API_s4u_Io>` are created with
- :cpp:func:`s4u::Storage::read_async() <simgrid::s4u::Storage::read_async>` and
- :cpp:func:`s4u::Storage::write_async() <simgrid::s4u::Storage::write_async>`.
+ :cpp:func:`s4u::Disk::read_async() <simgrid::s4u::Disk::read_async>` and
+ :cpp:func:`s4u::Disk::write_async() <simgrid::s4u::Disk::write_async>`.
- :ref:`s4u::ExecPtr <API_s4u_Exec>` are created with
:cpp:func:`s4u::Host::exec_async() <simgrid::s4u::Host::exec_async>`.
- In the future, it will become possible to have asynchronous IPC
:protected-members:
:undoc-members:
+.. _API_s4u_Disk:
+
+============
+s4u::Disk
+============
+
+.. doxygenclass:: simgrid::s4u::Disk
+ :members:
+ :protected-members:
+ :undoc-members:
+
.. _API_s4u_Engine:
===========
:protected-members:
:undoc-members:
-.. _API_s4u_Storage:
-
-============
-s4u::Storage
-============
-
-.. doxygenclass:: simgrid::s4u::Storage
- :members:
- :protected-members:
- :undoc-members:
-
.. _API_s4u_VirtualMachine:
===================
as the full :ref:`XML reference guide <platform_reference>`.
-Any simulated platform must contain **basic elements**, such as hosts, links, storages, etc. SimGrid gives you a great
+Any simulated platform must contain **basic elements**, such as hosts, links, disks, etc. SimGrid gives you a great
liberty when defining the **routing of your platform**, i.e., the network path taken between each pair of hosts.
Finally, you may also describe an **experimental scenario**, with qualitative (e.g., bandwidth variations representing
an external load) and qualitative (e.g., representing how some elements fail and restart over time) changes.
public class Node extends Process {
private static String file1 = "/doc/simgrid/examples/platforms/g5k.xml";
- private static String file2 = "\\Windows\\setupact.log";
+ private static String file2 = "/include/surf/simgrid_dtd.h";
private static String file3 = "/doc/simgrid/examples/platforms/g5k_cabinets.xml";
private static String file4 = "/doc/simgrid/examples/platforms/nancy.xml";
fileName = mount + file1;
break;
case 0:
- mount = "c:";
+ mount = "/tmp";
fileName = mount + file2;
break;
case 2:
$ ${javacmd:=java} -classpath ${classpath:=.} io/file/Main ${srcdir:=.}/../../platforms/storage/storage.xml
> [0.000000] [java/INFO] Using regular java threads.
> [0.000000] [java/INFO] Number of hosts:4
-> [alice:0:(1) 0.000000] [java/INFO] Open file c:\Windows\setupact.log
+> [alice:0:(1) 0.000000] [java/INFO] Open file /tmp/include/surf/simgrid_dtd.h
> [bob:1:(2) 0.000000] [java/INFO] Open file /home/doc/simgrid/examples/platforms/nancy.xml
> [carl:2:(3) 0.000000] [java/INFO] Open file /home/doc/simgrid/examples/platforms/g5k_cabinets.xml
> [denise:3:(4) 0.000000] [java/INFO] Open file /home/doc/simgrid/examples/platforms/g5k.xml
> [bob:1:(2) 0.000040] [java/INFO] Having read 4028 on /home/doc/simgrid/examples/platforms/nancy.xml
-> [alice:0:(1) 0.000050] [java/INFO] Having read 10000 on c:\Windows\setupact.log
+> [alice:0:(1) 0.000050] [java/INFO] Having read 10000 on /tmp/include/surf/simgrid_dtd.h
> [denise:3:(4) 0.000050] [java/INFO] Having read 10000 on /home/doc/simgrid/examples/platforms/g5k.xml
> [carl:2:(3) 0.000100] [java/INFO] Having read 10000 on /home/doc/simgrid/examples/platforms/g5k_cabinets.xml
-> [alice:0:(1) 0.001717] [java/INFO] Having write 100000 on c:\Windows\setupact.log
-> [alice:0:(1) 0.001717] [java/INFO] Seek back to the beginning of c:\Windows\setupact.log
+> [alice:0:(1) 0.001717] [java/INFO] Having write 100000 on /tmp/include/surf/simgrid_dtd.h
+> [alice:0:(1) 0.001717] [java/INFO] Seek back to the beginning of /tmp/include/surf/simgrid_dtd.h
> [denise:3:(4) 0.001717] [java/INFO] Having write 100000 on /home/doc/simgrid/examples/platforms/g5k.xml
> [denise:3:(4) 0.001717] [java/INFO] Seek back to the beginning of /home/doc/simgrid/examples/platforms/g5k.xml
-> [alice:0:(1) 0.002267] [java/INFO] Having read 110000 on c:\Windows\setupact.log
+> [alice:0:(1) 0.002267] [java/INFO] Having read 110000 on /tmp/include/surf/simgrid_dtd.h
> [denise:3:(4) 0.002267] [java/INFO] Having read 110000 on /home/doc/simgrid/examples/platforms/g5k.xml
> [bob:1:(2) 0.003374] [java/INFO] Having write 100000 on /home/doc/simgrid/examples/platforms/nancy.xml
> [bob:1:(2) 0.003374] [java/INFO] Seek back to the beginning of /home/doc/simgrid/examples/platforms/nancy.xml
> [denise:0:(1) 0.000000] [java/INFO] ------------------------------------
> [denise:0:(1) 0.000000] [java/INFO] Disk name: Disk2
> [denise:0:(1) 0.000000] [java/INFO] Size: 536870912000 bytes.
-> [denise:0:(1) 0.000000] [java/INFO] Free Size: 534479374867 bytes.
-> [denise:0:(1) 0.000000] [java/INFO] Used Size: 2391537133 bytes.
+> [denise:0:(1) 0.000000] [java/INFO] Free Size: 536857690006 bytes.
+> [denise:0:(1) 0.000000] [java/INFO] Used Size: 13221994 bytes.
> [denise:0:(1) 0.000000] [java/INFO] ------------------------------------
> [denise:0:(1) 0.000000] [java/INFO] Disk name: Disk4
> [denise:0:(1) 0.000000] [java/INFO] Size: 536870912000 bytes.
--- /dev/null
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
+<platform version="4.1">
+ <zone id="AS0" routing="Full">
+ <host id="bob" speed="1Gf">
+ <disk id="Disk1" read_bw="100MBps" write_bw="40MBps">
+ <prop id="size" value="500GiB"/>
+ <prop id="mount" value="/scratch"/>
+ <prop id="content" value="storage/content/storage_content.txt"/>
+ </disk>
+ <disk id="Disk2" read_bw="200MBps" write_bw="80MBps"/>
+ </host>
+
+ <host id="alice" speed="1Gf">
+ <disk id="Disk1" read_bw="200MBps" write_bw="80MBps">
+ <prop id="content" value="storage/content/small_content.txt"/>
+ </disk>
+ </host>
+
+ <host id="carl" speed="1Gf">
+ <prop id="remote_disk" value="/scratch:Disk1:bob"/>
+ </host>
+
+ <link id="link1" bandwidth="125MBps" latency="150us" />
+ <link id="link2" bandwidth="125MBps" latency="150us" />
+ <link id="link3" bandwidth="125MBps" latency="150us" />
+
+ <route src="bob" dst="alice">
+ <link_ctn id="link1" />
+ </route>
+ <route src="bob" dst="carl">
+ <link_ctn id="link2" />
+ </route>
+ <route src="alice" dst="carl">
+ <link_ctn id="link3" />
+ </route>
+ </zone>
+</platform>
+++ /dev/null
-\Windows\avastSS.scr 41664\r
-\Windows\bfsvc.exe 75264\r
-\Windows\bootstat.dat 67584\r
-\Windows\CoreSingleLanguage.xml 31497\r
-\Windows\csup.txt 12\r
-\Windows\dchcfg64.exe 335464\r
-\Windows\dcmdev64.exe 93288\r
-\Windows\DirectX.log 10486\r
-\Windows\DPINST.LOG 18944\r
-\Windows\DtcInstall.log 1955\r
-\Windows\explorer.exe 2380944\r
-\Windows\font1.sii 4907\r
-\Windows\font2.sii 8698\r
-\Windows\hapint.exe 382056\r
-\Windows\HelpPane.exe 883712\r
-\Windows\hh.exe 17408\r
-\Windows\MEMORY.DMP 2384027342\r
-\Windows\mib.bin 43131\r
-\Windows\notepad.exe 243712\r
-\Windows\PFRO.log 6770\r
-\Windows\Professional.xml 31881\r
-\Windows\regedit.exe 159232\r
-\Windows\setupact.log 101663\r
-\Windows\setuperr.log 0\r
-\Windows\splwow64.exe 126464\r
-\Windows\Starter.xml 31537\r
-\Windows\system.ini 219\r
-\Windows\twain_32.dll 50176\r
-\Windows\vmgcoinstall.log 1585\r
-\Windows\win.ini 92\r
-\Windows\WindowsUpdate.log 1518934\r
-\Windows\winhlp32.exe 10752\r
-\Windows\WLXPGSS.SCR 322048\r
-\Windows\WMSysPr9.prx 316640\r
-\Windows\write.exe 10752\r
-\Windows\_isusr32.dll 180320
\ No newline at end of file
<storage id="Disk1" typeId="SATA-II_HDD" attach="carl"/>
<storage id="Disk2" typeId="SATA-II_HDD" attach="dave"
- content="content/win_storage_content.txt" />
+ content="content/storage_content.txt" />
<host id="alice" speed="1Gf">
- <mount storageId="Disk2" name="c:"/>
+ <mount storageId="Disk2" name="/tmp"/>
</host>
<host id="bob" speed="1Gf">
<mount storageId="Disk1" name="/scratch"/>
<mount storageId="Disk1" name="/scratch"/>
</host>
<host id="dave" speed="1Gf">
- <mount storageId="Disk2" name="c:"/>
+ <mount storageId="Disk2" name="/tmp"/>
</host>
<link id="link1" bandwidth="125MBps" latency="50us"/>
<storage id="Disk1" typeId="single_HDD" attach="bob" />
<storage id="Disk2" typeId="single_SSD" attach="alice"
- content="content/win_storage_content.txt"/>
+ content="content/small_content.txt"/>
<storage id="Disk3" typeId="single_HDD" attach="carl" />
<storage id="Disk4" typeId="single_SSD" attach="denise"
content="content/small_content.txt" />
<mount storageId="Disk1" name="/home"/>
</host>
<host id="alice" speed="1Gf">
- <mount storageId="Disk2" name="c:"/>
+ <mount storageId="Disk2" name="/tmp"/>
</host>
<host id="carl" speed="1Gf">
<mount storageId="Disk3" name="/home"/>
</host>
<host id="denise" speed="1Gf">
- <mount storageId="Disk2" name="c:"/>
+ <mount storageId="Disk2" name="/tmp"/>
<mount storageId="Disk4" name="/home"/>
</host>
energy-exec energy-boot energy-link energy-vm
engine-filtering
exec-async exec-basic exec-dvfs exec-ptask exec-remote exec-waitany
- io-async io-file-system io-file-remote io-storage-raw
+ io-async io-file-system io-file-remote io-disk-raw
platform-failures platform-profile platform-properties
plugin-hostload
- replay-comm replay-storage
+ replay-comm replay-io
routing-get-clusters
synchro-barrier synchro-mutex synchro-semaphore)
add_executable (s4u-${example} EXCLUDE_FROM_ALL ${example}/s4u-${example}.cpp)
${CMAKE_CURRENT_SOURCE_DIR}/platform-failures/s4u-platform-failures_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/replay-storage/s4u-replay-storage_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/replay-io/s4u-replay-io_d.xml
PARENT_SCOPE)
set(bin_files ${bin_files} ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/generate.py PARENT_SCOPE)
set(txt_files ${txt_files} ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split-p0.txt
${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split-p1.txt
${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm.txt
- ${CMAKE_CURRENT_SOURCE_DIR}/replay-storage/s4u-replay-storage.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/replay-io/s4u-replay-io.txt
${CMAKE_CURRENT_SOURCE_DIR}/README.rst PARENT_SCOPE)
- **I/O replay:**
Presents a set of event handlers reproducing classical I/O
primitives (open, read, close).
- |br| `examples/s4u/replay-storage/s4u-replay-storage.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/replay-storage/s4u-replay-storage.cpp>`_
+ |br| `examples/s4u/replay-io/s4u-replay-io.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/replay-io/s4u-replay-io.cpp>`_
==========================
Activities: what Actors do
----------------------
SimGrid provides two levels of abstraction to interact with the
-simulated storages. At the simplest level, you simply create read and
-write actions on the storage resources.
+simulated disks. At the simplest level, you simply create read and
+write actions on the disk resources.
- - **Access to raw storage devices:**
+ - **Access to raw disk devices:**
This example illustrates how to simply read and write data on a
- simulated storage resource.
- |br| `examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp>`_
+ simulated disk resource.
+ |br| `examples/s4u/io-disk-raw/s4u-io-disk-raw.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/io-disk-raw/s4u-io-disk-raw.cpp>`_
The FileSystem plugin provides a more detailed view, with the
classical operations over files: open, move, unlink, and of course
static void test(sg_size_t size)
{
- simgrid::s4u::Storage* storage = simgrid::s4u::Storage::by_name("Disk1");
- XBT_INFO("Hello! read %llu bytes from Storage %s", size, storage->get_cname());
+ simgrid::s4u::Disk* disk = simgrid::s4u::Host::current()->get_disks().front();
+ XBT_INFO("Hello! read %llu bytes from %s", size, disk->get_cname());
- simgrid::s4u::IoPtr activity = storage->io_init(size, simgrid::s4u::Io::OpType::READ);
+ simgrid::s4u::IoPtr activity = disk->io_init(size, simgrid::s4u::Io::OpType::READ);
activity->start();
activity->wait();
static void test_cancel(sg_size_t size)
{
- simgrid::s4u::Storage* storage = simgrid::s4u::Storage::by_name("Disk2");
- XBT_INFO("Hello! write %llu bytes from Storage %s", size, storage->get_cname());
+ simgrid::s4u::Disk* disk = simgrid::s4u::Host::current()->get_disks().front();
+ XBT_INFO("Hello! write %llu bytes from %s", size, disk->get_cname());
- simgrid::s4u::IoPtr activity = storage->write_async(size);
+ simgrid::s4u::IoPtr activity = disk->write_async(size);
simgrid::s4u::this_actor::sleep_for(0.5);
XBT_INFO("I changed my mind, cancel!");
activity->cancel();
#!/usr/bin/env tesh
-$ ${bindir:=.}/s4u-io-async ${platfdir}/storage/storage.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [ 0.000000] (1:test@bob) Hello! read 20000000 bytes from Storage Disk1
-> [ 0.000000] (2:test_cancel@alice) Hello! write 50000000 bytes from Storage Disk2
+$ ${bindir:=.}/s4u-io-async ${platfdir}/hosts_with_disks.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [ 0.000000] (1:test@bob) Hello! read 20000000 bytes from Disk1
+> [ 0.000000] (2:test_cancel@alice) Hello! write 50000000 bytes from Disk1
> [ 0.200000] (1:test@bob) Goodbye now!
> [ 0.500000] (2:test_cancel@alice) I changed my mind, cancel!
> [ 0.500000] (2:test_cancel@alice) Goodbye now!
--- /dev/null
+/* Copyright (c) 2017-2019. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "simgrid/s4u.hpp"
+#include <string>
+#include <unordered_map>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(disk, "Messages specific for this simulation");
+
+static void host()
+{
+ /* - Display information on the disks mounted by the current host */
+ XBT_INFO("*** Storage info on %s ***", simgrid::s4u::Host::current()->get_cname());
+
+ /* - Retrieve all disks from current host */
+ std::vector<simgrid::s4u::Disk*> const& disk_list = simgrid::s4u::Host::current()->get_disks();
+
+ /* - For each disk mounted on host, display disk name and mount point */
+ for (auto disk : disk_list)
+ XBT_INFO("Disk name: %s", disk->get_cname());
+
+ /* - Write 400,000 bytes on Disk1 */
+ simgrid::s4u::Disk* disk = disk_list.front();
+ sg_size_t write = disk->write(400000);
+ XBT_INFO("Wrote %llu bytes on '%s'", write, disk->get_cname());
+
+ /* - Now read 200,000 bytes */
+ sg_size_t read = disk->read(200000);
+ XBT_INFO("Read %llu bytes on '%s'", read, disk->get_cname());
+
+ /* - Attach some user data to disk1 */
+ XBT_INFO("*** Get/set data for storage element: Disk1 ***");
+
+ std::string* data = static_cast<std::string*>(disk->get_data());
+
+ XBT_INFO("Get storage data: '%s'", data ? data->c_str() : "No user data");
+
+ disk->set_data(new std::string("Some user data"));
+ data = static_cast<std::string*>(disk->get_data());
+ XBT_INFO("Set and get data: '%s'", data->c_str());
+ delete data;
+}
+
+int main(int argc, char** argv)
+{
+ simgrid::s4u::Engine e(&argc, argv);
+ e.load_platform(argv[1]);
+
+ simgrid::s4u::Actor::create("", simgrid::s4u::Host::by_name("bob"), host);
+
+ e.run();
+ XBT_INFO("Simulated time: %g", simgrid::s4u::Engine::get_clock());
+
+ return 0;
+}
--- /dev/null
+#!/usr/bin/env tesh
+
+$ ${bindir}/s4u-io-disk-raw ${platfdir}/hosts_with_disks.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [ 0.000000] (1:@bob) *** Storage info on bob ***
+> [ 0.000000] (1:@bob) Disk name: Disk1
+> [ 0.000000] (1:@bob) Disk name: Disk2
+> [ 0.010000] (1:@bob) Wrote 400000 bytes on 'Disk1'
+> [ 0.012000] (1:@bob) Read 200000 bytes on 'Disk1'
+> [ 0.012000] (1:@bob) *** Get/set data for storage element: Disk1 ***
+> [ 0.012000] (1:@bob) Get storage data: 'No user data'
+> [ 0.012000] (1:@bob) Set and get data: 'Some user data'
+> [ 0.012000] (0:maestro@) Simulated time: 0.012
const char* filename = file.get_path();
XBT_INFO("Opened file '%s'", filename);
file.dump();
-
- XBT_INFO("Try to read %llu from '%s'", file.size(), filename);
- sg_size_t read = file.read(file.size());
- XBT_INFO("Have read %llu from '%s'. Offset is now at: %llu", read, filename, file.tell());
- XBT_INFO("Seek back to the beginning of the stream...");
- file.seek(0, SEEK_SET);
- XBT_INFO("Offset is now at: %llu", file.tell());
-
- if (argc > 5) {
- simgrid::s4u::File remoteFile(argv[2], nullptr);
- filename = remoteFile.get_path();
- XBT_INFO("Opened file '%s'", filename);
- XBT_INFO("Try to write %llu MiB to '%s'", remoteFile.size() / 1024, filename);
- sg_size_t write = remoteFile.write(remoteFile.size() * 1024);
- XBT_INFO("Have written %llu bytes to '%s'.", write, filename);
-
- if (std::stoi(argv[5]) != 0) {
- XBT_INFO("Move '%s' (of size %llu) from '%s' to '%s'", filename, remoteFile.size(),
- simgrid::s4u::Host::current()->get_cname(), argv[3]);
- remoteFile.remote_move(simgrid::s4u::Host::by_name(argv[3]), argv[4]);
+ XBT_INFO("Try to write %llu MiB to '%s'", file.size() / 1024, filename);
+ sg_size_t write = file.write(file.size() * 1024);
+ XBT_INFO("Have written %llu MiB to '%s'.", write / (1024 * 1024), filename);
+
+ if (argc > 4) {
+ if (std::stoi(argv[4]) != 0) {
+ XBT_INFO("Move '%s' (of size %llu) from '%s' to '%s'", filename, file.size(),
+ simgrid::s4u::Host::current()->get_cname(), argv[2]);
+ file.remote_move(simgrid::s4u::Host::by_name(argv[2]), argv[3]);
} else {
- XBT_INFO("Copy '%s' (of size %llu) from '%s' to '%s'", filename, remoteFile.size(),
- simgrid::s4u::Host::current()->get_cname(), argv[3]);
- remoteFile.remote_copy(simgrid::s4u::Host::by_name(argv[3]), argv[4]);
+ XBT_INFO("Copy '%s' (of size %llu) from '%s' to '%s'", filename, file.size(),
+ simgrid::s4u::Host::current()->get_cname(), argv[2]);
+ file.remote_copy(simgrid::s4u::Host::by_name(argv[2]), argv[3]);
}
}
-
return 0;
}
e.load_platform(argv[1]);
e.register_function("host", host);
e.load_deployment(argv[2]);
- std::vector<simgrid::s4u::Storage*> allStorages = e.get_all_storages();
+ std::vector<simgrid::s4u::Host*> all_hosts = e.get_all_hosts();
- for (auto const& s : allStorages) {
- XBT_INFO("Init: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s) / INMEGA,
- sg_storage_get_size_free(s) / INMEGA, s->get_cname());
+ for (auto const& h : all_hosts) {
+ for (auto const& d : h->get_disks())
+ XBT_INFO("Init: %s: %llu/%llu MiB used/free on '%s@%s'", h->get_cname(), sg_disk_get_size_used(d) / INMEGA,
+ sg_disk_get_size_free(d) / INMEGA, d->get_cname(), d->get_host()->get_cname());
}
e.run();
- for (auto const& s : allStorages) {
- XBT_INFO("End: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s) / INMEGA,
- sg_storage_get_size_free(s) / INMEGA, s->get_cname());
+ for (auto const& h : all_hosts) {
+ for (auto const& d : h->get_disks())
+ XBT_INFO("End: %llu/%llu MiB used/free on '%s@%s'", sg_disk_get_size_used(d) / INMEGA,
+ sg_disk_get_size_free(d) / INMEGA, d->get_cname(), h->get_cname());
}
XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());
#!/usr/bin/env tesh
-$ ${bindir:=.}/s4u-io-file-remote ${platfdir}/storage/remote_io.xml s4u-io-file-remote_d.xml "--log=root.fmt:[%10.6r]%e(%i@%5h)%e%m%n"
-> [ 0.000000] (0@ ) Init: 12/476824 MiB used/free on 'Disk1'
-> [ 0.000000] (0@ ) Init: 2280/474556 MiB used/free on 'Disk2'
-> [ 0.000000] (1@alice) Opened file 'c:\Windows\setupact.log'
+$ ${bindir:=.}/s4u-io-file-remote ${platfdir}/hosts_with_disks.xml s4u-io-file-remote_d.xml "--log=root.fmt:[%10.6r]%e(%i@%5h)%e%m%n"
+> [ 0.000000] (0@ ) Init: alice: 12/511987 MiB used/free on 'Disk1@alice'
+> [ 0.000000] (0@ ) Init: bob: 35/511964 MiB used/free on 'Disk1@bob'
+> [ 0.000000] (0@ ) Init: bob: 0/512000 MiB used/free on 'Disk2@bob'
+> [ 0.000000] (0@ ) Init: carl: 35/511964 MiB used/free on 'Disk1@bob'
+> [ 0.000000] (1@alice) Opened file '/include/surf/simgrid_dtd.h'
> [ 0.000000] (1@alice) File Descriptor information:
-> Full path: 'c:\Windows\setupact.log'
-> Size: 101663
-> Mount point: 'c:'
-> Storage Id: 'Disk2'
-> Storage Type: 'SATA-II_HDD'
+> Full path: '/include/surf/simgrid_dtd.h'
+> Size: 23583
+> Mount point: '/'
+> Disk Id: 'Disk1'
+> Host Id: 'alice'
> File Descriptor Id: 0
-> [ 0.000000] (1@alice) Try to read 101663 from 'c:\Windows\setupact.log'
-> [ 0.000000] (2@ bob) Opened file '/scratch/lib/libsimgrid.so.3.6.2'
+> [ 0.000000] (1@alice) Try to write 23 MiB to '/include/surf/simgrid_dtd.h'
+> [ 0.000000] (2@ bob) Opened file '/scratch/doc/simgrid/examples/platforms/g5k.xml'
> [ 0.000000] (2@ bob) File Descriptor information:
-> Full path: '/scratch/lib/libsimgrid.so.3.6.2'
-> Size: 12710497
+> Full path: '/scratch/doc/simgrid/examples/platforms/g5k.xml'
+> Size: 17028
> Mount point: '/scratch'
-> Storage Id: 'Disk1'
-> Storage Type: 'SATA-II_HDD'
+> Disk Id: 'Disk1'
+> Host Id: 'bob'
> File Descriptor Id: 0
-> [ 0.000000] (2@ bob) Try to read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'
-> [ 0.000000] (3@ carl) Opened file '/scratch/lib/libsimgrid.so.3.6.2'
+> [ 0.000000] (2@ bob) Try to write 16 MiB to '/scratch/doc/simgrid/examples/platforms/g5k.xml'
+> [ 0.000000] (3@ carl) Opened file '/scratch/include/surf/simgrid_dtd.h'
> [ 0.000000] (3@ carl) File Descriptor information:
-> Full path: '/scratch/lib/libsimgrid.so.3.6.2'
-> Size: 12710497
+> Full path: '/scratch/include/surf/simgrid_dtd.h'
+> Size: 23583
> Mount point: '/scratch'
-> Storage Id: 'Disk1'
-> Storage Type: 'SATA-II_HDD'
+> Disk Id: 'Disk1'
+> Host Id: 'bob'
> File Descriptor Id: 0
-> [ 0.000000] (3@ carl) Try to read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'
-> [ 0.000000] (4@ dave) Opened file 'c:\Windows\bootstat.dat'
-> [ 0.000000] (4@ dave) File Descriptor information:
-> Full path: 'c:\Windows\bootstat.dat'
-> Size: 67584
-> Mount point: 'c:'
-> Storage Id: 'Disk2'
-> Storage Type: 'SATA-II_HDD'
-> File Descriptor Id: 0
-> [ 0.000000] (4@ dave) Try to read 67584 from 'c:\Windows\bootstat.dat'
-> [ 0.001469] (4@ dave) Have read 67584 from 'c:\Windows\bootstat.dat'. Offset is now at: 67584
-> [ 0.001469] (4@ dave) Seek back to the beginning of the stream...
-> [ 0.001469] (4@ dave) Offset is now at: 0
-> [ 0.001469] (4@ dave) Opened file 'c:\Windows\Professional.xml'
-> [ 0.001469] (4@ dave) Try to write 31 MiB to 'c:\Windows\Professional.xml'
-> [ 0.003741] (1@alice) Have read 101663 from 'c:\Windows\setupact.log'. Offset is now at: 101663
-> [ 0.003741] (1@alice) Seek back to the beginning of the stream...
-> [ 0.003741] (1@alice) Offset is now at: 0
-> [ 0.276315] (3@ carl) Have read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'. Offset is now at: 12710497
-> [ 0.276315] (3@ carl) Seek back to the beginning of the stream...
-> [ 0.276315] (3@ carl) Offset is now at: 0
-> [ 0.387036] (2@ bob) Have read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'. Offset is now at: 12710497
-> [ 0.387036] (2@ bob) Seek back to the beginning of the stream...
-> [ 0.387036] (2@ bob) Offset is now at: 0
-> [ 0.387036] (2@ bob) Opened file '/scratch/doc/simgrid/examples/platforms/g5k.xml'
-> [ 0.387036] (2@ bob) Try to write 16 MiB to '/scratch/doc/simgrid/examples/platforms/g5k.xml'
-> [ 0.528211] (4@ dave) Have written 32646144 bytes to 'c:\Windows\Professional.xml'.
-> [ 0.528211] (4@ dave) Move 'c:\Windows\Professional.xml' (of size 32646144) from 'dave' to 'carl'
-> [ 0.819921] (2@ bob) Have written 17436672 bytes to '/scratch/doc/simgrid/examples/platforms/g5k.xml'.
-> [ 0.819921] (2@ bob) Copy '/scratch/doc/simgrid/examples/platforms/g5k.xml' (of size 17436672) from 'bob' to 'alice'
-> [ 1.843969] (0@ ) End: 60/476776 MiB used/free on 'Disk1'
-> [ 1.843969] (0@ ) End: 2297/474539 MiB used/free on 'Disk2'
-> [ 1.843969] (0@ ) Simulation time 1.84397
+> [ 0.000000] (3@ carl) Try to write 23 MiB to '/scratch/include/surf/simgrid_dtd.h'
+> [ 0.301862] (1@alice) Have written 23 MiB to '/include/surf/simgrid_dtd.h'.
+> [ 0.301862] (1@alice) Move '/include/surf/simgrid_dtd.h' (of size 24148992) from 'alice' to 'bob'
+> [ 0.660757] (2@ bob) Have written 16 MiB to '/scratch/doc/simgrid/examples/platforms/g5k.xml'.
+> [ 0.660757] (2@ bob) Copy '/scratch/doc/simgrid/examples/platforms/g5k.xml' (of size 17436672) from 'bob' to 'alice'
+> [ 1.234522] (3@ carl) Have written 23 MiB to '/scratch/include/surf/simgrid_dtd.h'.
+> [ 1.643366] (0@ ) End: 29/511970 MiB used/free on 'Disk1@alice'
+> [ 1.643366] (0@ ) End: 97/511902 MiB used/free on 'Disk1@bob'
+> [ 1.643366] (0@ ) End: 0/512000 MiB used/free on 'Disk2@bob'
+> [ 1.643366] (0@ ) Simulation time 1.64337
<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
<platform version="4.1">
<actor host="alice" function="host">
- <argument value = "c:\Windows\setupact.log"/>
+ <argument value = "/include/surf/simgrid_dtd.h"/>
+ <argument value = "bob"/>
+ <argument value = "/scratch/include/surf/simgrid_dtd.h"/>
+ <argument value = "1"/>
</actor>
<actor host="bob" function="host">
- <argument value = "/scratch/lib/libsimgrid.so.3.6.2"/>
<argument value = "/scratch/doc/simgrid/examples/platforms/g5k.xml"/>
<argument value = "alice"/>
- <argument value = "c:\Windows\Platforms\g5k.xml"/>
+ <argument value = "/tmp/platforms/g5k.xml"/>
<argument value = "0"/>
</actor>
<actor host="carl" function="host">
- <argument value = "/scratch/lib/libsimgrid.so.3.6.2"/>
- </actor>
- <actor host="dave" function="host">
- <argument value = "c:\Windows\bootstat.dat"/>
- <argument value = "c:\Windows\Professional.xml"/>
- <argument value = "carl"/>
- <argument value = "/scratch/mailbox/Professional.xml"/>
- <argument value = "1"/>
+ <argument value = "/scratch/include/surf/simgrid_dtd.h"/>
</actor>
</platform>
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <string>
-#include <unordered_map>
+#include <vector>
#include "simgrid/plugins/file_system.h"
#include "simgrid/s4u.hpp"
class MyHost {
public:
- void show_info(std::unordered_map<std::string, simgrid::s4u::Storage*> const& mounts)
+ void show_info(std::vector<simgrid::s4u::Disk*> const& disks)
{
XBT_INFO("Storage info on %s:", simgrid::s4u::Host::current()->get_cname());
- for (auto const& kv : mounts) {
- std::string mountpoint = kv.first;
- simgrid::s4u::Storage* storage = kv.second;
-
+ for (auto const& d : disks) {
// Retrieve disk's information
- XBT_INFO(" %s (%s) Used: %llu; Free: %llu; Total: %llu.", storage->get_cname(), mountpoint.c_str(),
- sg_storage_get_size_used(storage), sg_storage_get_size_free(storage), sg_storage_get_size(storage));
+ XBT_INFO(" %s (%s) Used: %llu; Free: %llu; Total: %llu.", d->get_cname(), sg_disk_get_mount_point(d),
+ sg_disk_get_size_used(d), sg_disk_get_size_free(d), sg_disk_get_size(d));
}
}
void operator()()
{
- std::unordered_map<std::string, simgrid::s4u::Storage*> const& mounts =
- simgrid::s4u::Host::current()->get_mounted_storages();
+ std::vector<simgrid::s4u::Disk*> const& disks = simgrid::s4u::Host::current()->get_disks();
- show_info(mounts);
+ show_info(disks);
// Open an non-existing file to create it
- std::string filename = "/home/tmp/data.txt";
+ std::string filename = "/scratch/tmp/data.txt";
simgrid::s4u::File* file = new simgrid::s4u::File(filename, nullptr);
sg_size_t write = file->write(200000); // Write 200,000 bytes
- XBT_INFO("Create a %llu bytes file named '%s' on /sd1", write, filename.c_str());
+ XBT_INFO("Create a %llu bytes file named '%s' on /scratch", write, filename.c_str());
// check that sizes have changed
- show_info(mounts);
+ show_info(disks);
// Now retrieve the size of created file and read it completely
const sg_size_t file_size = file->size();
write = file->write(100000); // Write 100,000 bytes
XBT_INFO("Write %llu bytes on %s", write, filename.c_str());
- simgrid::s4u::Storage* storage = simgrid::s4u::Storage::by_name("Disk4");
-
// Now rename file from ./tmp/data.txt to ./tmp/simgrid.readme
- std::string newpath = "/home/tmp/simgrid.readme";
+ std::string newpath = "/scratch/tmp/simgrid.readme";
XBT_INFO("Move '%s' to '%s'", file->get_path(), newpath.c_str());
file->move(newpath);
// Close the file
delete file;
- // Now attach some user data to disk1
- XBT_INFO("Get/set data for storage element: %s", storage->get_cname());
- XBT_INFO(" Uninitialized storage data: '%s'", static_cast<char*>(storage->get_data()));
-
- storage->set_data(new std::string("Some user data"));
- std::string* storage_data = static_cast<std::string*>(storage->get_data());
- XBT_INFO(" Set and get data: '%s'", storage_data->c_str());
-
- delete storage_data;
+ show_info(disks);
// Reopen the file and then unlink it
- file = new simgrid::s4u::File("/home/tmp/simgrid.readme", nullptr);
+ file = new simgrid::s4u::File("/scratch/tmp/simgrid.readme", nullptr);
XBT_INFO("Unlink file: '%s'", file->get_path());
file->unlink();
delete file; // Unlinking the file on "disk" does not free the object
- show_info(mounts);
+ show_info(disks);
}
};
simgrid::s4u::Engine e(&argc, argv);
sg_storage_file_system_init();
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("host", simgrid::s4u::Host::by_name("denise"), MyHost());
+ simgrid::s4u::Actor::create("host", simgrid::s4u::Host::by_name("bob"), MyHost());
e.run();
return 0;
#!/usr/bin/env tesh
-$ ${bindir:=.}/s4u-io-file-system ${platfdir}/storage/storage.xml
-> [denise:host:(1) 0.000000] [s4u_test/INFO] Storage info on denise:
-> [denise:host:(1) 0.000000] [s4u_test/INFO] Disk2 (c:) Used: 2391537133; Free: 534479374867; Total: 536870912000.
-> [denise:host:(1) 0.000000] [s4u_test/INFO] Disk4 (/home) Used: 13221994; Free: 536857690006; Total: 536870912000.
-> [denise:host:(1) 0.003333] [s4u_test/INFO] Create a 200000 bytes file named '/home/tmp/data.txt' on /sd1
-> [denise:host:(1) 0.003333] [s4u_test/INFO] Storage info on denise:
-> [denise:host:(1) 0.003333] [s4u_test/INFO] Disk2 (c:) Used: 2391537133; Free: 534479374867; Total: 536870912000.
-> [denise:host:(1) 0.003333] [s4u_test/INFO] Disk4 (/home) Used: 13421994; Free: 536857490006; Total: 536870912000.
-> [denise:host:(1) 0.004333] [s4u_test/INFO] Read 200000 bytes on /home/tmp/data.txt
-> [denise:host:(1) 0.006000] [s4u_test/INFO] Write 100000 bytes on /home/tmp/data.txt
-> [denise:host:(1) 0.006000] [s4u_test/INFO] Move '/home/tmp/data.txt' to '/home/tmp/simgrid.readme'
-> [denise:host:(1) 0.006000] [s4u_test/INFO] User data attached to the file: 777
-> [denise:host:(1) 0.006000] [s4u_test/INFO] Get/set data for storage element: Disk4
-> [denise:host:(1) 0.006000] [s4u_test/INFO] Uninitialized storage data: '(null)'
-> [denise:host:(1) 0.006000] [s4u_test/INFO] Set and get data: 'Some user data'
-> [denise:host:(1) 0.006000] [s4u_test/INFO] Unlink file: '/home/tmp/simgrid.readme'
-> [denise:host:(1) 0.006000] [s4u_test/INFO] Storage info on denise:
-> [denise:host:(1) 0.006000] [s4u_test/INFO] Disk2 (c:) Used: 2391537133; Free: 534479374867; Total: 536870912000.
-> [denise:host:(1) 0.006000] [s4u_test/INFO] Disk4 (/home) Used: 13221994; Free: 536857690006; Total: 536870912000.
+$ ${bindir:=.}/s4u-io-file-system ${platfdir}/hosts_with_disks.xml
+> [bob:host:(1) 0.000000] [s4u_test/INFO] Storage info on bob:
+> [bob:host:(1) 0.000000] [s4u_test/INFO] Disk1 (/scratch) Used: 36933331; Free: 536833978669; Total: 536870912000.
+> [bob:host:(1) 0.000000] [s4u_test/INFO] Disk2 (/) Used: 0; Free: 536870912000; Total: 536870912000.
+> [bob:host:(1) 0.005000] [s4u_test/INFO] Create a 200000 bytes file named '/scratch/tmp/data.txt' on /scratch
+> [bob:host:(1) 0.005000] [s4u_test/INFO] Storage info on bob:
+> [bob:host:(1) 0.005000] [s4u_test/INFO] Disk1 (/scratch) Used: 37133331; Free: 536833778669; Total: 536870912000.
+> [bob:host:(1) 0.005000] [s4u_test/INFO] Disk2 (/) Used: 0; Free: 536870912000; Total: 536870912000.
+> [bob:host:(1) 0.007000] [s4u_test/INFO] Read 200000 bytes on /scratch/tmp/data.txt
+> [bob:host:(1) 0.009500] [s4u_test/INFO] Write 100000 bytes on /scratch/tmp/data.txt
+> [bob:host:(1) 0.009500] [s4u_test/INFO] Move '/scratch/tmp/data.txt' to '/scratch/tmp/simgrid.readme'
+> [bob:host:(1) 0.009500] [s4u_test/INFO] User data attached to the file: 777
+> [bob:host:(1) 0.009500] [s4u_test/INFO] Storage info on bob:
+> [bob:host:(1) 0.009500] [s4u_test/INFO] Disk1 (/scratch) Used: 37233331; Free: 536833678669; Total: 536870912000.
+> [bob:host:(1) 0.009500] [s4u_test/INFO] Disk2 (/) Used: 0; Free: 536870912000; Total: 536870912000.
+> [bob:host:(1) 0.009500] [s4u_test/INFO] Unlink file: '/scratch/tmp/simgrid.readme'
+> [bob:host:(1) 0.009500] [s4u_test/INFO] Storage info on bob:
+> [bob:host:(1) 0.009500] [s4u_test/INFO] Disk1 (/scratch) Used: 36933331; Free: 536833978669; Total: 536870912000.
+> [bob:host:(1) 0.009500] [s4u_test/INFO] Disk2 (/) Used: 0; Free: 536870912000; Total: 536870912000.
+++ /dev/null
-/* Copyright (c) 2017-2019. The SimGrid Team. All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "simgrid/s4u.hpp"
-#include <string>
-#include <unordered_map>
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(storage, "Messages specific for this simulation");
-
-static void host()
-{
- /* - Display information on the disks mounted by the current host */
- XBT_INFO("*** Storage info on %s ***", simgrid::s4u::Host::current()->get_cname());
-
- /* - Retrieve all mount points of current host */
- std::unordered_map<std::string, simgrid::s4u::Storage*> const& storage_list =
- simgrid::s4u::Host::current()->get_mounted_storages();
-
- /* - For each disk mounted on host, display disk name and mount point */
- for (auto const& kv : storage_list)
- XBT_INFO("Storage name: %s, mount name: %s", kv.second->get_cname(), kv.first.c_str());
-
- /* - Write 200,000 bytes on Disk4 */
- simgrid::s4u::Storage* storage = simgrid::s4u::Storage::by_name("Disk4");
- sg_size_t write = storage->write(200000);
- XBT_INFO("Wrote %llu bytes on 'Disk4'", write);
-
- /* - Now read 200,000 bytes */
- sg_size_t read = storage->read(200000);
- XBT_INFO("Read %llu bytes on 'Disk4'", read);
-
- /* - Attach some user data to disk1 */
- XBT_INFO("*** Get/set data for storage element: Disk4 ***");
-
- std::string* data = static_cast<std::string*>(storage->get_data());
-
- XBT_INFO("Get storage data: '%s'", data ? data->c_str() : "No user data");
-
- storage->set_data(new std::string("Some user data"));
- data = static_cast<std::string*>(storage->get_data());
- XBT_INFO("Set and get data: '%s'", data->c_str());
- delete data;
-}
-
-int main(int argc, char** argv)
-{
- simgrid::s4u::Engine e(&argc, argv);
- e.load_platform(argv[1]);
-
- simgrid::s4u::Actor::create("", simgrid::s4u::Host::by_name("denise"), host);
-
- e.run();
- XBT_INFO("Simulated time: %g", simgrid::s4u::Engine::get_clock());
-
- return 0;
-}
+++ /dev/null
-#!/usr/bin/env tesh
-
-$ ${bindir}/s4u-io-storage-raw ${platfdir}/storage/storage.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [ 0.000000] (1:@denise) *** Storage info on denise ***
-> [ 0.000000] (1:@denise) Storage name: Disk2, mount name: c:
-> [ 0.000000] (1:@denise) Storage name: Disk4, mount name: /home
-> [ 0.003333] (1:@denise) Wrote 200000 bytes on 'Disk4'
-> [ 0.004333] (1:@denise) Read 200000 bytes on 'Disk4'
-> [ 0.004333] (1:@denise) *** Get/set data for storage element: Disk4 ***
-> [ 0.004333] (1:@denise) Get storage data: 'No user data'
-> [ 0.004333] (1:@denise) Set and get data: 'Some user data'
-> [ 0.004333] (0:maestro@) Simulated time: 0.00433333
#include <boost/algorithm/string/join.hpp>
-XBT_LOG_NEW_DEFAULT_CATEGORY(replay_storage, "Messages specific for this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(replay_io, "Messages specific for this example");
static std::unordered_map<std::string, simgrid::s4u::File*> opened_files;
#define ACT_DEBUG(...) \
- if (XBT_LOG_ISENABLED(replay_storage, xbt_log_priority_verbose)) { \
+ if (XBT_LOG_ISENABLED(replay_io, xbt_log_priority_verbose)) { \
std::string NAME = boost::algorithm::join(action, " "); \
XBT_DEBUG(__VA_ARGS__); \
} else \
- ((void)0)
+ ((void)0)
static void log_action(simgrid::xbt::ReplayAction& action, double date)
{
- if (XBT_LOG_ISENABLED(replay_storage, xbt_log_priority_verbose)) {
+ if (XBT_LOG_ISENABLED(replay_io, xbt_log_priority_verbose)) {
std::string s = boost::algorithm::join(action, " ");
XBT_VERB("%s %f", s.c_str(), date);
}
simgrid::s4u::Engine e(&argc, argv);
sg_storage_file_system_init();
- xbt_assert(argc > 3, "Usage: %s platform_file deployment_file [action_files]\n"
- "\texample: %s platform.xml deployment.xml actions # if all actions are in the same file\n"
- "\t# if actions are in separate files, specified in deployment\n"
- "\texample: %s platform.xml deployment.xml",
+ xbt_assert(argc > 3,
+ "Usage: %s platform_file deployment_file [action_files]\n"
+ "\texample: %s platform.xml deployment.xml actions # if all actions are in the same file\n"
+ "\t# if actions are in separate files, specified in deployment\n"
+ "\texample: %s platform.xml deployment.xml",
argv[0], argv[0], argv[0]);
e.load_platform(argv[1]);
--- /dev/null
+! output sort 19
+$ ${bindir:=.}/s4u-replay-io --log=replay_io.thres=verbose ${platfdir}/hosts_with_disks.xml s4u-replay-io_d.xml s4u-replay-io.txt "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
+> [ 0.000000] (p0@alice) p0 open /lib/libsimgrid.so.3.6.2 0.000000
+> [ 0.063552] (p0@alice) p0 read /lib/libsimgrid.so.3.6.2 12710497 0.063552
+> [ 0.063552] (p0@alice) p0 close /lib/libsimgrid.so.3.6.2 0.000000
+> [ 0.063552] (maestro@) Simulation time 0.0635525
--- /dev/null
+p0 open /lib/libsimgrid.so.3.6.2
+p0 read /lib/libsimgrid.so.3.6.2 12710497
+p0 close /lib/libsimgrid.so.3.6.2
<?xml version='1.0'?>
<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
<platform version="4.1">
- <actor host="denise" function="p0"/>
+ <actor host="alice" function="p0"/>
</platform>
+++ /dev/null
-! output sort 19
-$ ${bindir:=.}/s4u-replay-storage --log=replay_storage.thres=verbose ${platfdir}/storage/storage.xml s4u-replay-storage_d.xml s4u-replay-storage.txt "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
-> [ 0.000000] (p0@denise) p0 open /home/lib/libsimgrid.so.3.6.2 0.000000
-> [ 0.063552] (p0@denise) p0 read /home/lib/libsimgrid.so.3.6.2 12710497 0.063552
-> [ 0.063552] (p0@denise) p0 close /home/lib/libsimgrid.so.3.6.2 0.000000
-> [ 0.063552] (maestro@) Simulation time 0.0635525
+++ /dev/null
-p0 open /home/lib/libsimgrid.so.3.6.2
-p0 read /home/lib/libsimgrid.so.3.6.2 12710497
-p0 close /home/lib/libsimgrid.so.3.6.2
XBT_PUBLIC void intrusive_ptr_release(Semaphore* m);
XBT_PUBLIC void intrusive_ptr_add_ref(Semaphore* m);
+class Disk;
class Storage;
} // namespace s4u
class NetworkModel;
class LinkImpl;
class NetworkAction;
+class DiskImpl;
+class DiskModel;
class StorageImpl;
class StorageType;
class StorageModel;
typedef simgrid::s4u::ConditionVariable s4u_ConditionVariable;
typedef simgrid::s4u::Mutex s4u_Mutex;
typedef simgrid::s4u::Semaphore s4u_Semaphore;
+typedef simgrid::s4u::Disk s4u_Disk;
typedef simgrid::s4u::Storage s4u_Storage;
typedef simgrid::s4u::NetZone s4u_NetZone;
typedef simgrid::s4u::VirtualMachine s4u_VM;
typedef struct s4u_ConditionVariable s4u_ConditionVariable;
typedef struct s4u_Mutex s4u_Mutex;
typedef struct s4u_Semaphore s4u_Semaphore;
+typedef struct s4u_Disk s4u_Disk;
typedef struct s4u_Storage s4u_Storage;
typedef struct s4u_NetZone s4u_NetZone;
typedef struct s4u_VM s4u_VM;
typedef s4u_NetZone* sg_netzone_t;
typedef s4u_Host* sg_host_t;
typedef s4u_Link* sg_link_t;
+typedef s4u_Disk* sg_disk_t;
typedef s4u_Storage* sg_storage_t;
typedef s4u_File* sg_file_t;
typedef s4u_VM* sg_vm_t;
XBT_PUBLIC int sg_file_rcopy(sg_file_t file, sg_host_t host, const char* fullpath);
XBT_PUBLIC int sg_file_rmove(sg_file_t file, sg_host_t host, const char* fullpath);
+XBT_PUBLIC sg_size_t sg_disk_get_size_free(sg_disk_t d);
+XBT_PUBLIC sg_size_t sg_disk_get_size_used(sg_disk_t d);
+XBT_PUBLIC sg_size_t sg_disk_get_size(sg_disk_t d);
+XBT_PUBLIC const char* sg_disk_get_mount_point(sg_disk_t d);
+
XBT_PUBLIC sg_size_t sg_storage_get_size_free(sg_storage_t st);
XBT_PUBLIC sg_size_t sg_storage_get_size_used(sg_storage_t st);
XBT_PUBLIC sg_size_t sg_storage_get_size(sg_storage_t st);
void dump();
int desc_id = 0;
- Storage* local_storage_;
+ Disk* local_disk_ = nullptr;
+ Storage* local_storage_ = nullptr;
std::string mount_point_;
private:
void* userdata_ = nullptr;
};
+class XBT_PUBLIC FileSystemDiskExt {
+public:
+ static simgrid::xbt::Extension<Disk, FileSystemDiskExt> EXTENSION_ID;
+ explicit FileSystemDiskExt(Disk* ptr);
+ FileSystemDiskExt(const FileSystemDiskExt&) = delete;
+ FileSystemDiskExt& operator=(const FileSystemDiskExt&) = delete;
+ std::map<std::string, sg_size_t>* parse_content(const std::string& filename);
+ std::map<std::string, sg_size_t>* get_content() const { return content_.get(); }
+ const char* get_mount_point() { return mount_point_.c_str(); }
+ const char* get_mount_point(s4u::Host* remote_host) { return remote_mount_points_[remote_host].c_str(); }
+ void add_remote_mount(Host* host, std::string mount_point) { remote_mount_points_.insert({host, mount_point}); }
+ sg_size_t get_size() const { return size_; }
+ sg_size_t get_used_size() const { return used_size_; }
+ void decr_used_size(sg_size_t size) { used_size_ -= size; }
+ void incr_used_size(sg_size_t size) { used_size_ += size; }
+
+private:
+ std::unique_ptr<std::map<std::string, sg_size_t>> content_;
+ std::map<Host*, std::string> remote_mount_points_;
+ std::string mount_point_;
+ sg_size_t used_size_ = 0;
+ sg_size_t size_ = static_cast<sg_size_t>(500 * 1024) * 1024 * 1024;
+};
+
class XBT_PUBLIC FileSystemStorageExt {
public:
static simgrid::xbt::Extension<Storage, FileSystemStorageExt> EXTENSION_ID;
#include <simgrid/s4u/Barrier.hpp>
#include <simgrid/s4u/Comm.hpp>
#include <simgrid/s4u/ConditionVariable.hpp>
+#include <simgrid/s4u/Disk.hpp>
#include <simgrid/s4u/Engine.hpp>
#include <simgrid/s4u/Exec.hpp>
#include <simgrid/s4u/Host.hpp>
--- /dev/null
+/* Copyright (c) 2019. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef INCLUDE_SIMGRID_S4U_DISK_HPP_
+#define INCLUDE_SIMGRID_S4U_DISK_HPP_
+
+#include <simgrid/forward.h>
+#include <simgrid/s4u/Io.hpp>
+#include <xbt/Extendable.hpp>
+#include <xbt/base.h>
+#include <xbt/signal.hpp>
+
+#include <map>
+#include <string>
+#include <unordered_map>
+
+namespace simgrid {
+namespace s4u {
+
+/** Disk represent the disk resources associated to a host
+ *
+ * By default, SimGrid does not keep track of the actual data being written but
+ * only computes the time taken by the corresponding data movement.
+ */
+
+class XBT_PUBLIC Disk : public xbt::Extendable<Disk> {
+ friend Engine;
+ friend Io;
+ friend kernel::resource::DiskImpl;
+
+public:
+ explicit Disk(const std::string& name, kernel::resource::DiskImpl* pimpl) : pimpl_(pimpl), name_(name) {}
+
+protected:
+ virtual ~Disk() = default;
+
+public:
+ /** @brief Callback signal fired when a new Disk is created */
+ static xbt::signal<void(Disk&)> on_creation;
+ /** @brief Callback signal fired when a Disk is destroyed */
+ static xbt::signal<void(Disk const&)> on_destruction;
+ /** @brief Callback signal fired when a Disk's state changes */
+ static xbt::signal<void(Disk const&)> on_state_change;
+
+ /** @brief Retrieves the name of that disk as a C++ string */
+ std::string const& get_name() const { return name_; }
+ /** @brief Retrieves the name of that disk as a C string */
+ const char* get_cname() const { return name_.c_str(); }
+
+ const std::unordered_map<std::string, std::string>* get_properties() const;
+ const char* get_property(const std::string& key) const;
+ void set_property(const std::string&, const std::string& value);
+ Host* get_host();
+
+ IoPtr io_init(sg_size_t size, s4u::Io::OpType type);
+
+ IoPtr read_async(sg_size_t size);
+ sg_size_t read(sg_size_t size);
+
+ IoPtr write_async(sg_size_t size);
+ sg_size_t write(sg_size_t size);
+ kernel::resource::DiskImpl* get_impl() const { return pimpl_; }
+
+private:
+ kernel::resource::DiskImpl* const pimpl_;
+ std::string name_;
+};
+
+} // namespace s4u
+} // namespace simgrid
+
+#endif /* INCLUDE_SIMGRID_S4U_DISK_HPP_ */
#ifndef DOXYGEN
friend Host;
friend Link;
+ friend Disk;
friend Storage;
friend kernel::routing::NetPoint;
friend kernel::routing::NetZoneImpl;
void set_pstate(int pstate_index);
int get_pstate() const;
+ std::vector<Disk*> get_disks() const;
+ void add_disk(Disk* disk);
+ void remove_disk(std::string disk_name);
+
std::vector<const char*> get_attached_storages() const;
/** Get an associative list [mount point]->[Storage] of all local mount points.
/** I/O Activity, representing the asynchronous disk access.
*
- * They are generated from Storage::io_init() or Storage::read() and Storage::write().
+ * They are generated from Disk::io_init(), Disk::read() Disk::read_async(), Disk::write() and Disk::write_async().
*/
class XBT_PUBLIC Io : public Activity {
private:
Storage* storage_ = nullptr;
+ Disk* disk_ = nullptr;
sg_size_t size_ = 0;
OpType type_ = OpType::READ;
std::string name_ = "";
std::atomic_int_fast32_t refcount_{0};
explicit Io(sg_storage_t storage, sg_size_t size, OpType type);
+ explicit Io(sg_disk_t disk, sg_size_t size, OpType type);
public:
#ifndef DOXYGEN
friend XBT_PUBLIC void intrusive_ptr_release(simgrid::s4u::Io* i);
friend XBT_PUBLIC void intrusive_ptr_add_ref(simgrid::s4u::Io* i);
+ friend Disk; // Factory of IOs
friend Storage; // Factory of IOs
#endif
#include "simgrid/kernel/routing/NetPoint.hpp"
#include "simgrid/kernel/routing/NetZoneImpl.hpp"
#include "simgrid/s4u/Host.hpp"
+#include "src/kernel/resource/DiskImpl.hpp"
#include "src/surf/StorageImpl.hpp"
#include "src/surf/network_interface.hpp"
#include "simgrid/Exception.hpp"
#include "simgrid/kernel/resource/Action.hpp"
#include "simgrid/s4u/Host.hpp"
+#include "src/kernel/resource/DiskImpl.hpp"
#include "src/mc/mc_replay.hpp"
#include "src/simix/smx_private.hpp"
#include "src/surf/StorageImpl.hpp"
return *this;
}
+IoImpl& IoImpl::set_disk(resource::DiskImpl* disk)
+{
+ disk_ = disk;
+ return *this;
+}
+
IoImpl& IoImpl::set_storage(resource::StorageImpl* storage)
{
storage_ = storage;
IoImpl* IoImpl::start()
{
state_ = SIMIX_RUNNING;
- surf_action_ = storage_->io_start(size_, type_);
+ if (storage_)
+ surf_action_ = storage_->io_start(size_, type_);
+ else
+ surf_action_ = disk_->io_start(size_, type_);
surf_action_->set_activity(this);
XBT_DEBUG("Create IO synchro %p %s", this, get_cname());
{
performed_ioops_ = surf_action_->get_cost();
if (surf_action_->get_state() == resource::Action::State::FAILED) {
- if (storage_ && not storage_->is_on())
+ if ((storage_ && not storage_->is_on()) || (disk_ && not disk_->is_on()))
state_ = SIMIX_FAILED;
else
state_ = SIMIX_CANCELED;
class XBT_PUBLIC IoImpl : public ActivityImpl_T<IoImpl> {
resource::StorageImpl* storage_ = nullptr;
+ resource::DiskImpl* disk_ = nullptr;
sg_size_t size_ = 0;
s4u::Io::OpType type_ = s4u::Io::OpType::READ;
sg_size_t performed_ioops_ = 0;
IoImpl& set_size(sg_size_t size);
IoImpl& set_type(s4u::Io::OpType type);
IoImpl& set_storage(resource::StorageImpl* storage);
+ IoImpl& set_disk(resource::DiskImpl* disk);
sg_size_t get_performed_ioops() { return performed_ioops_; }
--- /dev/null
+/* Copyright (c) 2019. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "DiskImpl.hpp"
+
+#include "simgrid/s4u/Engine.hpp"
+#include "src/kernel/EngineImpl.hpp"
+#include "src/kernel/lmm/maxmin.hpp"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(disk_kernel, surf, "Logging specific to the disk kernel resource");
+
+simgrid::kernel::resource::DiskModel* surf_disk_model = nullptr;
+
+namespace simgrid {
+namespace kernel {
+namespace resource {
+
+/*********
+ * Model *
+ *********/
+
+DiskModel::DiskModel() : Model(Model::UpdateAlgo::FULL)
+{
+ set_maxmin_system(new simgrid::kernel::lmm::System(true /* selective update */));
+}
+
+DiskModel::~DiskModel()
+{
+ surf_disk_model = nullptr;
+}
+
+/************
+ * Resource *
+ ************/
+
+DiskImpl::DiskImpl(kernel::resource::Model* model, const std::string& name, kernel::lmm::System* maxminSystem,
+ double read_bw, double write_bw)
+ : Resource(model, name, maxminSystem->constraint_new(this, std::max(read_bw, write_bw))), piface_(name, this)
+{
+ DiskImpl::turn_on();
+ XBT_DEBUG("Create resource with read_bw '%f' write_bw '%f'", read_bw, write_bw);
+ constraint_read_ = maxminSystem->constraint_new(this, read_bw);
+ constraint_write_ = maxminSystem->constraint_new(this, write_bw);
+}
+
+DiskImpl::~DiskImpl()
+{
+ xbt_assert(currently_destroying_, "Don't delete Disks directly. Call destroy() instead.");
+}
+
+/** @brief Fire the required callbacks and destroy the object
+ *
+ * Don't delete directly a Disk, call d->destroy() instead.
+ */
+void DiskImpl::destroy()
+{
+ if (not currently_destroying_) {
+ currently_destroying_ = true;
+ s4u::Disk::on_destruction(this->piface_);
+ delete this;
+ }
+}
+
+bool DiskImpl::is_used()
+{
+ THROW_UNIMPLEMENTED;
+}
+
+void DiskImpl::apply_event(kernel::profile::Event* /*event*/, double /*value*/)
+{
+ THROW_UNIMPLEMENTED;
+}
+
+void DiskImpl::turn_on()
+{
+ if (not is_on()) {
+ Resource::turn_on();
+ s4u::Disk::on_state_change(this->piface_);
+ }
+}
+void DiskImpl::turn_off()
+{
+ if (is_on()) {
+ Resource::turn_off();
+ s4u::Disk::on_state_change(this->piface_);
+ }
+}
+
+xbt::signal<void(DiskAction const&, kernel::resource::Action::State, kernel::resource::Action::State)>
+ DiskAction::on_state_change;
+
+/**********
+ * Action *
+ **********/
+void DiskAction::set_state(Action::State state)
+{
+ Action::State old = get_state();
+ Action::set_state(state);
+ on_state_change(*this, old, state);
+}
+} // namespace resource
+} // namespace kernel
+} // namespace simgrid
--- /dev/null
+/* Copyright (c) 2019. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "simgrid/kernel/resource/Action.hpp"
+#include "simgrid/kernel/resource/Model.hpp"
+#include "simgrid/kernel/resource/Resource.hpp"
+#include "simgrid/s4u/Disk.hpp"
+#include "simgrid/s4u/Io.hpp"
+#include "src/surf/PropertyHolder.hpp"
+#include "src/surf/surf_interface.hpp"
+
+#include <map>
+
+#ifndef DISK_INTERFACE_HPP_
+#define DISK_INTERFACE_HPP_
+
+/*********
+ * Model *
+ *********/
+
+XBT_PUBLIC_DATA simgrid::kernel::resource::DiskModel* surf_disk_model;
+
+namespace simgrid {
+namespace kernel {
+namespace resource {
+/***********
+ * Classes *
+ ***********/
+
+class DiskAction;
+
+/*********
+ * Model *
+ *********/
+class DiskModel : public kernel::resource::Model {
+public:
+ DiskModel();
+ DiskModel(const DiskModel&) = delete;
+ DiskModel& operator=(const DiskModel&) = delete;
+ ~DiskModel();
+
+ virtual DiskImpl* createDisk(const std::string& id, double read_bw, double write_bw) = 0;
+};
+
+/************
+ * Resource *
+ ************/
+class DiskImpl : public Resource, public surf::PropertyHolder {
+ bool currently_destroying_ = false;
+ s4u::Host* host_ = nullptr;
+
+public:
+ DiskImpl(Model* model, const std::string& name, kernel::lmm::System* maxmin_system, double read_bw, double bwrite_bw);
+ DiskImpl(const DiskImpl&) = delete;
+ DiskImpl& operator=(const DiskImpl&) = delete;
+
+ ~DiskImpl() override;
+
+ /** @brief Public interface */
+ s4u::Disk piface_;
+ s4u::Disk* get_iface() { return &piface_; }
+ /** @brief Check if the Storage is used (if an action currently uses its resources) */
+ bool is_used() override;
+
+ void apply_event(profile::Event* event, double value) override;
+
+ void turn_on() override;
+ void turn_off() override;
+
+ s4u::Host* get_host() { return host_; }
+ void set_host(s4u::Host* host) { host_ = host; }
+
+ void destroy(); // Must be called instead of the destructor
+ virtual DiskAction* io_start(sg_size_t size, s4u::Io::OpType type) = 0;
+ virtual DiskAction* read(sg_size_t size) = 0;
+ virtual DiskAction* write(sg_size_t size) = 0;
+
+ lmm::Constraint* constraint_write_; /* Constraint for maximum write bandwidth*/
+ lmm::Constraint* constraint_read_; /* Constraint for maximum write bandwidth*/
+};
+
+/**********
+ * Action *
+ **********/
+
+class DiskAction : public Action {
+public:
+ static xbt::signal<void(DiskAction const&, Action::State, Action::State)> on_state_change;
+
+ DiskAction(Model* model, double cost, bool failed, DiskImpl* disk, s4u::Io::OpType type)
+ : Action(model, cost, failed), type_(type), disk_(disk){};
+
+ /**
+ * @brief diskAction constructor
+ *
+ * @param model The StorageModel associated to this DiskAction
+ * @param cost The cost of this DiskAction in bytes
+ * @param failed [description]
+ * @param var The lmm variable associated to this DiskAction if it is part of a LMM component
+ * @param storage The Storage associated to this DiskAction
+ * @param type [description]
+ */
+ DiskAction(kernel::resource::Model* model, double cost, bool failed, kernel::lmm::Variable* var, DiskImpl* disk,
+ s4u::Io::OpType type)
+ : Action(model, cost, failed, var), type_(type), disk_(disk){};
+
+ void set_state(simgrid::kernel::resource::Action::State state) override;
+
+ s4u::Io::OpType type_;
+ DiskImpl* disk_;
+};
+
+} // namespace resource
+} // namespace kernel
+} // namespace simgrid
+#endif /* DISK_INTERFACE_HPP_ */
#include "simgrid/plugins/file_system.h"
#include "simgrid/s4u/Actor.hpp"
+#include "simgrid/s4u/Engine.hpp"
#include "src/surf/HostImpl.hpp"
+#include "src/surf/xml/platf_private.hpp"
#include "xbt/config.hpp"
#include <algorithm>
namespace simgrid {
namespace s4u {
+simgrid::xbt::Extension<Disk, FileSystemDiskExt> FileSystemDiskExt::EXTENSION_ID;
simgrid::xbt::Extension<Storage, FileSystemStorageExt> FileSystemStorageExt::EXTENSION_ID;
simgrid::xbt::Extension<Host, FileDescriptorHostExt> FileDescriptorHostExt::EXTENSION_ID;
File::File(const std::string& fullpath, sg_host_t host, void* userdata) : fullpath_(fullpath), userdata_(userdata)
{
// this cannot fail because we get a xbt_die if the mountpoint does not exist
- Storage* st = nullptr;
- size_t longest_prefix_length = 0;
- XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath_.c_str(), host->get_cname());
-
- for (auto const& mnt : host->get_mounted_storages()) {
- XBT_DEBUG("See '%s'", mnt.first.c_str());
- mount_point_ = fullpath_.substr(0, mnt.first.length());
-
- if (mount_point_ == mnt.first && mnt.first.length() > longest_prefix_length) {
- /* The current mount name is found in the full path and is bigger than the previous*/
- longest_prefix_length = mnt.first.length();
- st = mnt.second;
+ if (not host->get_mounted_storages().empty()) {
+ Storage* st = nullptr;
+ size_t longest_prefix_length = 0;
+ XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath_.c_str(), host->get_cname());
+
+ for (auto const& mnt : host->get_mounted_storages()) {
+ XBT_DEBUG("See '%s'", mnt.first.c_str());
+ mount_point_ = fullpath_.substr(0, mnt.first.length());
+
+ if (mount_point_ == mnt.first && mnt.first.length() > longest_prefix_length) {
+ /* The current mount name is found in the full path and is bigger than the previous*/
+ longest_prefix_length = mnt.first.length();
+ st = mnt.second;
+ }
}
- }
- if (longest_prefix_length > 0) { /* Mount point found, split fullpath_ into mount_name and path+filename*/
- mount_point_ = fullpath_.substr(0, longest_prefix_length);
- path_ = fullpath_.substr(longest_prefix_length, fullpath_.length());
- } else
- xbt_die("Can't find mount point for '%s' on '%s'", fullpath_.c_str(), host->get_cname());
+ if (longest_prefix_length > 0) { /* Mount point found, split fullpath_ into mount_name and path+filename*/
+ mount_point_ = fullpath_.substr(0, longest_prefix_length);
+ path_ = fullpath_.substr(longest_prefix_length, fullpath_.length());
+ } else
+ xbt_die("Can't find mount point for '%s' on '%s'", fullpath_.c_str(), host->get_cname());
- local_storage_ = st;
+ local_storage_ = st;
+ }
+ if (not host->get_disks().empty()) {
+ Disk* d = nullptr;
+ size_t longest_prefix_length = 0;
+ for (auto const& disk : host->get_disks()) {
+ std::string current_mount;
+ if (disk->get_host() != host)
+ current_mount = disk->extension<FileSystemDiskExt>()->get_mount_point(disk->get_host());
+ else
+ current_mount = disk->extension<FileSystemDiskExt>()->get_mount_point();
+ mount_point_ = fullpath_.substr(0, current_mount.length());
+ if (mount_point_ == current_mount && current_mount.length() > longest_prefix_length) {
+ /* The current mount name is found in the full path and is bigger than the previous*/
+ longest_prefix_length = current_mount.length();
+ d = disk;
+ }
+ if (longest_prefix_length > 0) { /* Mount point found, split fullpath_ into mount_name and path+filename*/
+ mount_point_ = fullpath_.substr(0, longest_prefix_length);
+ if (mount_point_ == std::string("/"))
+ path_ = fullpath_;
+ else
+ path_ = fullpath_.substr(longest_prefix_length, fullpath_.length());
+ XBT_DEBUG("%s + %s", mount_point_.c_str(), path_.c_str());
+ } else
+ xbt_die("Can't find mount point for '%s' on '%s'", fullpath_.c_str(), host->get_cname());
+ }
+ local_disk_ = d;
+ }
// assign a file descriptor id to the newly opened File
FileDescriptorHostExt* ext = host->extension<simgrid::s4u::FileDescriptorHostExt>();
ext->file_descriptor_table->pop_back();
XBT_DEBUG("\tOpen file '%s'", path_.c_str());
- std::map<std::string, sg_size_t>* content = local_storage_->extension<FileSystemStorageExt>()->get_content();
+ std::map<std::string, sg_size_t>* content;
+ if (local_storage_)
+ content = local_storage_->extension<FileSystemStorageExt>()->get_content();
+
+ if (local_disk_)
+ content = local_disk_->extension<FileSystemDiskExt>()->get_content();
+
// if file does not exist create an empty file
auto sz = content->find(path_);
if (sz != content->end()) {
void File::dump()
{
- XBT_INFO("File Descriptor information:\n"
- "\t\tFull path: '%s'\n"
- "\t\tSize: %llu\n"
- "\t\tMount point: '%s'\n"
- "\t\tStorage Id: '%s'\n"
- "\t\tStorage Type: '%s'\n"
- "\t\tFile Descriptor Id: %d",
- get_path(), size_, mount_point_.c_str(), local_storage_->get_cname(), local_storage_->get_type(), desc_id);
+ if (local_storage_)
+ XBT_INFO("File Descriptor information:\n"
+ "\t\tFull path: '%s'\n"
+ "\t\tSize: %llu\n"
+ "\t\tMount point: '%s'\n"
+ "\t\tStorage Id: '%s'\n"
+ "\t\tStorage Type: '%s'\n"
+ "\t\tFile Descriptor Id: %d",
+ get_path(), size_, mount_point_.c_str(), local_storage_->get_cname(), local_storage_->get_type(), desc_id);
+ if (local_disk_)
+ XBT_INFO("File Descriptor information:\n"
+ "\t\tFull path: '%s'\n"
+ "\t\tSize: %llu\n"
+ "\t\tMount point: '%s'\n"
+ "\t\tDisk Id: '%s'\n"
+ "\t\tHost Id: '%s'\n"
+ "\t\tFile Descriptor Id: %d",
+ get_path(), size_, mount_point_.c_str(), local_disk_->get_cname(), local_disk_->get_host()->get_cname(),
+ desc_id);
}
sg_size_t File::read(sg_size_t size)
{
if (size_ == 0) /* Nothing to read, return */
return 0;
+ sg_size_t read_size = 0;
+ Host* host = nullptr;
+ if (local_storage_) {
+ /* Find the host where the file is physically located and read it */
+ host = local_storage_->get_host();
+ XBT_DEBUG("READ %s on disk '%s'", get_path(), local_storage_->get_cname());
+ // if the current position is close to the end of the file, we may not be able to read the requested size
+ read_size = local_storage_->read(std::min(size, size_ - current_position_));
+ current_position_ += read_size;
+ }
- /* Find the host where the file is physically located and read it */
- Host* host = local_storage_->get_host();
- XBT_DEBUG("READ %s on disk '%s'", get_path(), local_storage_->get_cname());
- // if the current position is close to the end of the file, we may not be able to read the requested size
- sg_size_t read_size = local_storage_->read(std::min(size, size_ - current_position_));
- current_position_ += read_size;
+ if (local_disk_) {
+ /* Find the host where the file is physically located and read it */
+ host = local_disk_->get_host();
+ XBT_DEBUG("READ %s on disk '%s'", get_path(), local_disk_->get_cname());
+ // if the current position is close to the end of the file, we may not be able to read the requested size
+ read_size = local_disk_->read(std::min(size, size_ - current_position_));
+ current_position_ += read_size;
+ }
if (host->get_name() != Host::current()->get_name() && read_size > 0) {
/* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */
{
if (size == 0) /* Nothing to write, return */
return 0;
+ sg_size_t write_size = 0;
+ Host* host = nullptr;
/* Find the host where the file is physically located (remote or local)*/
- Host* host = local_storage_->get_host();
+ if (local_storage_)
+ host = local_storage_->get_host();
+ if (local_disk_)
+ host = local_disk_->get_host();
if (host->get_name() != Host::current()->get_name()) {
/* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */
Host::current()->send_to(host, size);
}
- XBT_DEBUG("WRITE %s on disk '%s'. size '%llu/%llu' '%llu:%llu'", get_path(), local_storage_->get_cname(), size, size_, sg_storage_get_size_used(local_storage_), sg_storage_get_size(local_storage_));
- // If the storage is full before even starting to write
- if (sg_storage_get_size_used(local_storage_) >= sg_storage_get_size(local_storage_))
- return 0;
- sg_size_t write_size=0;
- if(write_inside==0){
- /* Substract the part of the file that might disappear from the used sized on the storage element */
- local_storage_->extension<FileSystemStorageExt>()->decr_used_size(size_ - current_position_);
- write_size = local_storage_->write(size);
- local_storage_->extension<FileSystemStorageExt>()->incr_used_size(write_size);
- current_position_ += write_size;
- size_ = current_position_;
- }else {
- write_size = local_storage_->write(size);
- current_position_ += write_size;
- if(current_position_>size_)
+ if (local_storage_) {
+ XBT_DEBUG("WRITE %s on disk '%s'. size '%llu/%llu' '%llu:%llu'", get_path(), local_storage_->get_cname(), size,
+ size_, sg_storage_get_size_used(local_storage_), sg_storage_get_size(local_storage_));
+ // If the storage is full before even starting to write
+ if (sg_storage_get_size_used(local_storage_) >= sg_storage_get_size(local_storage_))
+ return 0;
+ if (write_inside == 0) {
+ /* Substract the part of the file that might disappear from the used sized on the storage element */
+ local_storage_->extension<FileSystemStorageExt>()->decr_used_size(size_ - current_position_);
+ write_size = local_storage_->write(size);
+ local_storage_->extension<FileSystemStorageExt>()->incr_used_size(write_size);
+ current_position_ += write_size;
size_ = current_position_;
+ } else {
+ write_size = local_storage_->write(size);
+ current_position_ += write_size;
+ if (current_position_ > size_)
+ size_ = current_position_;
+ }
+ std::map<std::string, sg_size_t>* content = local_storage_->extension<FileSystemStorageExt>()->get_content();
+
+ content->erase(path_);
+ content->insert({path_, size_});
}
- std::map<std::string, sg_size_t>* content = local_storage_->extension<FileSystemStorageExt>()->get_content();
- content->erase(path_);
- content->insert({path_, size_});
+ if (local_disk_) {
+ XBT_DEBUG("WRITE %s on disk '%s'. size '%llu/%llu' '%llu:%llu'", get_path(), local_disk_->get_cname(), size, size_,
+ sg_disk_get_size_used(local_disk_), sg_disk_get_size(local_disk_));
+ // If the storage is full before even starting to write
+ if (sg_disk_get_size_used(local_disk_) >= sg_disk_get_size(local_disk_))
+ return 0;
+ if (write_inside == 0) {
+ /* Substract the part of the file that might disappear from the used sized on the storage element */
+ local_disk_->extension<FileSystemDiskExt>()->decr_used_size(size_ - current_position_);
+ write_size = local_disk_->write(size);
+ local_disk_->extension<FileSystemDiskExt>()->incr_used_size(write_size);
+ current_position_ += write_size;
+ size_ = current_position_;
+ } else {
+ write_size = local_disk_->write(size);
+ current_position_ += write_size;
+ if (current_position_ > size_)
+ size_ = current_position_;
+ }
+ std::map<std::string, sg_size_t>* content = local_disk_->extension<FileSystemDiskExt>()->get_content();
+ content->erase(path_);
+ content->insert({path_, size_});
+ }
return write_size;
}
{
/* Check if the new full path is on the same mount point */
if (fullpath.compare(0, mount_point_.length(), mount_point_) == 0) {
- std::map<std::string, sg_size_t>* content = local_storage_->extension<FileSystemStorageExt>()->get_content();
+ std::map<std::string, sg_size_t>* content;
+ if (local_storage_)
+ content = local_storage_->extension<FileSystemStorageExt>()->get_content();
+ if (local_disk_)
+ content = local_disk_->extension<FileSystemDiskExt>()->get_content();
auto sz = content->find(path_);
if (sz != content->end()) { // src file exists
sg_size_t new_size = sz->second;
int File::unlink()
{
/* Check if the file is on local storage */
- std::map<std::string, sg_size_t>* content = local_storage_->extension<FileSystemStorageExt>()->get_content();
+ std::map<std::string, sg_size_t>* content;
+ const char* name = nullptr;
+ if (local_storage_) {
+ content = local_storage_->extension<FileSystemStorageExt>()->get_content();
+ name = local_storage_->get_cname();
+ }
+ if (local_disk_) {
+ content = local_disk_->extension<FileSystemDiskExt>()->get_content();
+ name = local_disk_->get_cname();
+ }
if (content->find(path_) == content->end()) {
- XBT_WARN("File %s is not on disk %s. Impossible to unlink", path_.c_str(), local_storage_->get_cname());
+ XBT_WARN("File %s is not on disk %s. Impossible to unlink", path_.c_str(), name);
return -1;
} else {
- XBT_DEBUG("UNLINK %s on disk '%s'", path_.c_str(), local_storage_->get_cname());
- local_storage_->extension<FileSystemStorageExt>()->decr_used_size(size_);
+ XBT_DEBUG("UNLINK %s on disk '%s'", path_.c_str(), name);
+
+ if (local_storage_)
+ local_storage_->extension<FileSystemStorageExt>()->decr_used_size(size_);
+
+ if (local_disk_)
+ local_disk_->extension<FileSystemDiskExt>()->decr_used_size(size_);
// Remove the file from storage
content->erase(fullpath_);
int File::remote_copy(sg_host_t host, const char* fullpath)
{
/* Find the host where the file is physically located and read it */
- Storage* storage_src = local_storage_;
- Host* src_host = storage_src->get_host();
+ Host* src_host;
+ if (local_storage_) {
+ src_host = local_storage_->get_host();
+ XBT_DEBUG("READ %s on disk '%s'", get_path(), local_storage_->get_cname());
+ }
+
+ if (local_disk_) {
+ src_host = local_disk_->get_host();
+ XBT_DEBUG("READ %s on disk '%s'", get_path(), local_disk_->get_cname());
+ }
+
seek(0, SEEK_SET);
- XBT_DEBUG("READ %s on disk '%s'", get_path(), local_storage_->get_cname());
// if the current position is close to the end of the file, we may not be able to read the requested size
- sg_size_t read_size = local_storage_->read(size_);
+ sg_size_t read_size = 0;
+ if (local_storage_)
+ read_size = local_storage_->read(size_);
+ if (local_disk_)
+ read_size = local_disk_->read(size_);
+
current_position_ += read_size;
- /* Find the host that owns the storage where the file has to be copied */
- Storage* storage_dest = nullptr;
- Host* dst_host;
- size_t longest_prefix_length = 0;
-
- for (auto const& elm : host->get_mounted_storages()) {
- std::string mount_point = std::string(fullpath).substr(0, elm.first.size());
- if (mount_point == elm.first && elm.first.length() > longest_prefix_length) {
- /* The current mount name is found in the full path and is bigger than the previous*/
- longest_prefix_length = elm.first.length();
- storage_dest = elm.second;
+ Host* dst_host = host;
+ if (local_storage_) {
+ /* Find the host that owns the storage where the file has to be copied */
+ Storage* storage_dest = nullptr;
+ size_t longest_prefix_length = 0;
+
+ for (auto const& elm : host->get_mounted_storages()) {
+ std::string mount_point = std::string(fullpath).substr(0, elm.first.size());
+ if (mount_point == elm.first && elm.first.length() > longest_prefix_length) {
+ /* The current mount name is found in the full path and is bigger than the previous*/
+ longest_prefix_length = elm.first.length();
+ storage_dest = elm.second;
+ }
+ }
+
+ if (storage_dest != nullptr) {
+ /* Mount point found, retrieve the host the storage is attached to */
+ dst_host = storage_dest->get_host();
+ } else {
+ XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, host->get_cname());
+ return -1;
}
}
- if (storage_dest != nullptr) {
- /* Mount point found, retrieve the host the storage is attached to */
- dst_host = storage_dest->get_host();
- } else {
- XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, host->get_cname());
- return -1;
+ if (local_disk_) {
+ size_t longest_prefix_length = 0;
+ Disk* dst_disk = nullptr;
+
+ for (auto const& disk : host->get_disks()) {
+ std::string current_mount = disk->extension<FileSystemDiskExt>()->get_mount_point();
+ std::string mount_point = std::string(fullpath).substr(0, current_mount.length());
+ if (mount_point == current_mount && current_mount.length() > longest_prefix_length) {
+ /* The current mount name is found in the full path and is bigger than the previous*/
+ longest_prefix_length = current_mount.length();
+ dst_disk = disk;
+ }
+ }
+
+ if (dst_disk == nullptr) {
+ XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, host->get_cname());
+ return -1;
+ }
}
XBT_DEBUG("Initiate data transfer of %llu bytes between %s and %s.", read_size, src_host->get_cname(),
- storage_dest->get_host()->get_cname());
+ dst_host->get_cname());
src_host->send_to(dst_host, read_size);
/* Create file on remote host, write it and close it */
File* fd = new File(fullpath, dst_host, nullptr);
- sg_size_t write_size = fd->local_storage_->write(read_size);
- fd->local_storage_->extension<FileSystemStorageExt>()->incr_used_size(write_size);
- (*(fd->local_storage_->extension<FileSystemStorageExt>()->get_content()))[path_] = size_;
+ if (local_storage_) {
+ sg_size_t write_size = fd->local_storage_->write(read_size);
+ fd->local_storage_->extension<FileSystemStorageExt>()->incr_used_size(write_size);
+ (*(fd->local_storage_->extension<FileSystemStorageExt>()->get_content()))[path_] = size_;
+ }
+ if (local_disk_)
+ fd->write(read_size);
delete fd;
return 0;
}
return res;
}
+FileSystemDiskExt::FileSystemDiskExt(simgrid::s4u::Disk* ptr)
+{
+ const char* size_str = ptr->get_property("size");
+ if (size_str)
+ size_ = surf_parse_get_size(size_str, "disk size", ptr->get_name());
+
+ const char* current_mount_str = ptr->get_property("mount");
+ if (current_mount_str)
+ mount_point_ = std::string(current_mount_str);
+ else
+ mount_point_ = std::string("/");
+
+ const char* content_str = ptr->get_property("content");
+ if (content_str)
+ content_.reset(parse_content(content_str));
+}
+
FileSystemStorageExt::FileSystemStorageExt(simgrid::s4u::Storage* ptr)
{
content_.reset(parse_content(ptr->get_impl()->content_name_));
size_ = ptr->get_impl()->size_;
}
+std::map<std::string, sg_size_t>* FileSystemDiskExt::parse_content(const std::string& filename)
+{
+ if (filename.empty())
+ return nullptr;
+
+ std::map<std::string, sg_size_t>* parse_content = new std::map<std::string, sg_size_t>();
+
+ std::ifstream* fs = surf_ifsopen(filename);
+
+ std::string line;
+ std::vector<std::string> tokens;
+ do {
+ std::getline(*fs, line);
+ boost::trim(line);
+ if (line.length() > 0) {
+ boost::split(tokens, line, boost::is_any_of(" \t"), boost::token_compress_on);
+ xbt_assert(tokens.size() == 2, "Parse error in %s: %s", filename.c_str(), line.c_str());
+ sg_size_t size = std::stoull(tokens.at(1));
+
+ used_size_ += size;
+ parse_content->insert({tokens.front(), size});
+ }
+ } while (not fs->eof());
+ delete fs;
+ return parse_content;
+}
+
std::map<std::string, sg_size_t>* FileSystemStorageExt::parse_content(const std::string& filename)
{
if (filename.empty())
}
}
-using simgrid::s4u::FileSystemStorageExt;
using simgrid::s4u::FileDescriptorHostExt;
+using simgrid::s4u::FileSystemDiskExt;
+using simgrid::s4u::FileSystemStorageExt;
+static void on_disk_creation(simgrid::s4u::Disk& d)
+{
+ d.extension_set(new FileSystemDiskExt(&d));
+}
static void on_storage_creation(simgrid::s4u::Storage& st)
{
st.extension_set(new FileSystemStorageExt(&st));
host.extension_set<FileDescriptorHostExt>(new FileDescriptorHostExt());
}
+static void on_platform_created()
+{
+ for (auto const& host : simgrid::s4u::Engine::get_instance()->get_all_hosts()) {
+ const char* remote_disk_str = host->get_property("remote_disk");
+ if (remote_disk_str) {
+ std::vector<std::string> tokens;
+ boost::split(tokens, remote_disk_str, boost::is_any_of(":"));
+ std::string mount_point = tokens[0];
+ simgrid::s4u::Host* remote_host = simgrid::s4u::Host::by_name_or_null(tokens[2]);
+ xbt_assert(remote_host, "You're trying to access a host that does not exist. Please check your platform file");
+
+ simgrid::s4u::Disk* disk = nullptr;
+ for (auto const& d : remote_host->get_disks())
+ if (d->get_name() == tokens[1]) {
+ disk = d;
+ break;
+ }
+
+ xbt_assert(disk, "You're trying to mount a disk that does not exist. Please check your platform file");
+ disk->extension<FileSystemDiskExt>()->add_remote_mount(remote_host, mount_point);
+ host->add_disk(disk);
+
+ XBT_DEBUG("Host '%s' wants to mount a remote disk: %s of %s mounted on %s", host->get_cname(), disk->get_cname(),
+ remote_host->get_cname(), mount_point.c_str());
+ XBT_DEBUG("Host '%s' now has %zu disks", host->get_cname(), host->get_disks().size());
+ }
+ }
+}
+
+static void on_simulation_end()
+{
+ XBT_DEBUG("Simulation is over, time to unregister remote disks if any");
+ for (auto const& host : simgrid::s4u::Engine::get_instance()->get_all_hosts()) {
+ const char* remote_disk_str = host->get_property("remote_disk");
+ if (remote_disk_str) {
+ std::vector<std::string> tokens;
+ boost::split(tokens, remote_disk_str, boost::is_any_of(":"));
+ XBT_DEBUG("Host '%s' wants to unmount a remote disk: %s of %s mounted on %s", host->get_cname(),
+ tokens[1].c_str(), tokens[2].c_str(), tokens[0].c_str());
+ host->remove_disk(tokens[1]);
+ XBT_DEBUG("Host '%s' now has %zu disks", host->get_cname(), host->get_disks().size());
+ }
+ }
+}
+
/* **************************** Public interface *************************** */
void sg_storage_file_system_init()
{
simgrid::s4u::Storage::on_creation.connect(&on_storage_creation);
}
+ if (not FileSystemDiskExt::EXTENSION_ID.valid()) {
+ FileSystemDiskExt::EXTENSION_ID = simgrid::s4u::Disk::extension_create<FileSystemDiskExt>();
+ simgrid::s4u::Disk::on_creation.connect(&on_disk_creation);
+ }
+
if (not FileDescriptorHostExt::EXTENSION_ID.valid()) {
FileDescriptorHostExt::EXTENSION_ID = simgrid::s4u::Host::extension_create<FileDescriptorHostExt>();
simgrid::s4u::Host::on_creation.connect(&on_host_creation);
}
+ simgrid::s4u::Engine::on_platform_created.connect(&on_platform_created);
+ simgrid::s4u::Engine::on_simulation_end.connect(&on_simulation_end);
}
sg_file_t sg_file_open(const char* fullpath, void* data)
return file->remote_move(host, fullpath);
}
+sg_size_t sg_disk_get_size_free(sg_disk_t d)
+{
+ return d->extension<FileSystemDiskExt>()->get_size() - d->extension<FileSystemDiskExt>()->get_used_size();
+}
+
+sg_size_t sg_disk_get_size_used(sg_disk_t d)
+{
+ return d->extension<FileSystemDiskExt>()->get_used_size();
+}
+
+sg_size_t sg_disk_get_size(sg_disk_t d)
+{
+ return d->extension<FileSystemDiskExt>()->get_size();
+}
+
+const char* sg_disk_get_mount_point(sg_disk_t d)
+{
+ return d->extension<FileSystemDiskExt>()->get_mount_point();
+}
+
sg_size_t sg_storage_get_size_free(sg_storage_t st)
{
return st->extension<FileSystemStorageExt>()->get_size() - st->extension<FileSystemStorageExt>()->get_used_size();
--- /dev/null
+/* Copyright (c) 2019. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "simgrid/s4u/Disk.hpp"
+#include "simgrid/s4u/Engine.hpp"
+#include "simgrid/s4u/Host.hpp"
+#include "simgrid/s4u/Io.hpp"
+#include "src/kernel/resource/DiskImpl.hpp"
+
+namespace simgrid {
+namespace xbt {
+template class Extendable<s4u::Disk>;
+} // namespace xbt
+
+namespace s4u {
+
+xbt::signal<void(Disk&)> Disk::on_creation;
+xbt::signal<void(Disk const&)> Disk::on_destruction;
+xbt::signal<void(Disk const&)> Disk::on_state_change;
+
+Host* Disk::get_host()
+{
+ return pimpl_->get_host();
+}
+
+const std::unordered_map<std::string, std::string>* Disk::get_properties() const
+{
+ return pimpl_->get_properties();
+}
+
+const char* Disk::get_property(const std::string& key) const
+{
+ return this->pimpl_->get_property(key);
+}
+
+void Disk::set_property(const std::string& key, const std::string& value)
+{
+ kernel::actor::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); });
+}
+
+IoPtr Disk::io_init(sg_size_t size, Io::OpType type)
+{
+ return IoPtr(new Io(this, size, type));
+}
+
+IoPtr Disk::read_async(sg_size_t size)
+{
+ return IoPtr(io_init(size, Io::OpType::READ))->start();
+}
+
+sg_size_t Disk::read(sg_size_t size)
+{
+ return IoPtr(io_init(size, Io::OpType::READ))->start()->wait()->get_performed_ioops();
+}
+
+IoPtr Disk::write_async(sg_size_t size)
+{
+
+ return IoPtr(io_init(size, Io::OpType::WRITE)->start());
+}
+
+sg_size_t Disk::write(sg_size_t size)
+{
+ return IoPtr(io_init(size, Io::OpType::WRITE))->start()->wait()->get_performed_ioops();
+}
+
+} // namespace s4u
+} // namespace simgrid
#include "mc/mc.h"
#include "simgrid/kernel/routing/NetPoint.hpp"
#include "simgrid/kernel/routing/NetZoneImpl.hpp"
+#include "simgrid/s4u/Disk.hpp"
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/Mailbox.hpp"
return this->pimpl_cpu->get_pstate();
}
+std::vector<Disk*> Host::get_disks() const
+{
+ return kernel::actor::simcall([this] { return this->pimpl_->get_disks(); });
+}
+
+void Host::add_disk(Disk* disk)
+{
+ kernel::actor::simcall([this, disk] { this->pimpl_->add_disk(disk); });
+}
+void Host::remove_disk(std::string disk_name)
+{
+ kernel::actor::simcall([this, disk_name] { this->pimpl_->remove_disk(disk_name); });
+}
/**
* @ingroup simix_storage_management
* @brief Returns the list of storages attached to a host.
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include "simgrid/s4u/Disk.hpp"
#include "simgrid/s4u/Io.hpp"
#include "simgrid/s4u/Storage.hpp"
#include "src/kernel/activity/IoImpl.hpp"
namespace simgrid {
namespace s4u {
+Io::Io(sg_disk_t disk, sg_size_t size, OpType type) : disk_(disk), size_(size), type_(type)
+{
+ Activity::set_remaining(size_);
+ pimpl_ = kernel::activity::IoImplPtr(new kernel::activity::IoImpl());
+}
+
Io::Io(sg_storage_t storage, sg_size_t size, OpType type) : storage_(storage), size_(size), type_(type)
{
Activity::set_remaining(size_);
Io* Io::start()
{
kernel::actor::simcall([this] {
- (*boost::static_pointer_cast<kernel::activity::IoImpl>(pimpl_))
- .set_name(name_)
- .set_storage(storage_->get_impl())
- .set_size(size_)
- .set_type(type_)
- .start();
+ if (storage_) {
+ (*boost::static_pointer_cast<kernel::activity::IoImpl>(pimpl_))
+ .set_name(name_)
+ .set_storage(storage_->get_impl())
+ .set_size(size_)
+ .set_type(type_)
+ .start();
+ } else {
+ (*boost::static_pointer_cast<kernel::activity::IoImpl>(pimpl_))
+ .set_name(name_)
+ .set_disk(disk_->get_impl())
+ .set_size(size_)
+ .set_type(type_)
+ .start();
+ }
});
state_ = State::STARTED;
return this;
find_model_description(surf_optimization_mode_description, value);
}
+static void _sg_cfg_cb__disk_model(const std::string& value)
+{
+ xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
+
+ if (value == "help") {
+ model_help("disk", surf_disk_model_description);
+ exit(0);
+ }
+
+ find_model_description(surf_disk_model_description, value);
+}
+
/* callback of the cpu/model variable */
-static void _sg_cfg_cb__storage_mode(const std::string& value)
+static void _sg_cfg_cb__storage_model(const std::string& value)
{
xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
declare_model_flag("cpu/model", "Cas01", &_sg_cfg_cb__cpu_model, surf_cpu_model_description, "model",
"The model to use for the CPU");
- declare_model_flag("storage/model", "default", &_sg_cfg_cb__storage_mode, surf_storage_model_description, "model",
+ declare_model_flag("disk/model", "default", &_sg_cfg_cb__disk_model, surf_disk_model_description, "model",
+ "The model to use for the disk");
+
+ declare_model_flag("storage/model", "default", &_sg_cfg_cb__storage_model, surf_storage_model_description, "model",
"The model to use for the storage");
declare_model_flag("network/model", "LV08", &_sg_cfg_cb__network_model, surf_network_model_description, "model",
for (auto const& arg : actors_at_boot_)
delete arg;
actors_at_boot_.clear();
+
+ for (auto const& d : disks_)
+ d->destroy();
}
/** Re-starts all the actors that are marked as restartable.
{
return process_list_.size();
}
+
+std::vector<s4u::Disk*> HostImpl::get_disks()
+{
+ std::vector<s4u::Disk*> disks;
+ for (auto const& d : disks_)
+ disks.push_back(&d->piface_);
+ return disks;
+}
+
+void HostImpl::add_disk(s4u::Disk* disk)
+{
+ disks_.push_back(disk->get_impl());
+}
+
+void HostImpl::remove_disk(std::string disk_name)
+{
+ auto position = disks_.begin();
+ for (auto const& d : disks_) {
+ if (d->get_name() == disk_name) {
+ disks_.erase(position);
+ break;
+ }
+ position++;
+ }
+}
+
std::vector<const char*> HostImpl::get_attached_storages()
{
std::vector<const char*> storages;
#define SURF_HOST_INTERFACE_HPP_
#include "src/kernel/actor/ActorImpl.hpp"
+#include "src/kernel/resource/DiskImpl.hpp"
#include "src/surf/PropertyHolder.hpp"
#include "src/surf/StorageImpl.hpp"
#include "src/surf/cpu_interface.hpp"
explicit HostImpl(s4u::Host* host);
virtual ~HostImpl();
+ std::vector<s4u::Disk*> get_disks();
+ void add_disk(s4u::Disk* disk);
+ void remove_disk(std::string disk_name);
+
/** @brief Get the vector of storages (by names) attached to the Host */
virtual std::vector<const char*> get_attached_storages();
std::map<std::string, kernel::resource::StorageImpl*> storage_;
+ std::vector<kernel::resource::DiskImpl*> disks_;
+
s4u::Host* piface_ = nullptr;
void turn_on();
--- /dev/null
+/* Copyright (c) 2013-2019. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "disk_s19.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
+#include "simgrid/s4u/Engine.hpp"
+#include "simgrid/s4u/Host.hpp"
+#include "src/kernel/lmm/maxmin.hpp"
+#include "src/surf/xml/platf.hpp"
+#include "surf/surf.hpp"
+
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(disk_kernel);
+
+/*********
+ * Model *
+ *********/
+
+void surf_disk_model_init_default()
+{
+ surf_disk_model = new simgrid::kernel::resource::DiskS19Model();
+}
+
+namespace simgrid {
+namespace kernel {
+namespace resource {
+
+DiskS19Model::DiskS19Model()
+{
+ all_existing_models.push_back(this);
+}
+
+DiskImpl* DiskS19Model::createDisk(const std::string& id, double read_bw, double write_bw)
+{
+ XBT_DEBUG("SURF disk create resource\n\t\tid '%s'\n\t\tread_bw '%f'\n", id.c_str(), read_bw);
+
+ return new DiskS19(this, id, get_maxmin_system(), read_bw, write_bw);
+}
+
+double DiskS19Model::next_occuring_event(double now)
+{
+ return DiskModel::next_occuring_event_full(now);
+}
+
+void DiskS19Model::update_actions_state(double /*now*/, double delta)
+{
+ for (auto it = std::begin(*get_started_action_set()); it != std::end(*get_started_action_set());) {
+ auto& action = *it;
+ ++it; // increment iterator here since the following calls to action.finish() may invalidate it
+ action.update_remains(lrint(action.get_variable()->get_value() * delta));
+ action.update_max_duration(delta);
+
+ if (((action.get_remains_no_update() <= 0) && (action.get_variable()->get_penalty() > 0)) ||
+ ((action.get_max_duration() != NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
+ action.finish(Action::State::FINISHED);
+ }
+ }
+}
+
+/************
+ * Resource *
+ ************/
+
+DiskS19::DiskS19(DiskModel* model, const std::string& name, lmm::System* maxminSystem, double read_bw, double write_bw)
+ : DiskImpl(model, name, maxminSystem, read_bw, write_bw)
+{
+ XBT_DEBUG("Create resource with read_bw '%f' write_bw '%f'", read_bw, write_bw);
+}
+
+DiskAction* DiskS19::io_start(sg_size_t size, s4u::Io::OpType type)
+{
+ return new DiskS19Action(get_model(), size, not is_on(), this, type);
+}
+
+DiskAction* DiskS19::read(sg_size_t size)
+{
+ return new DiskS19Action(get_model(), size, not is_on(), this, s4u::Io::OpType::READ);
+}
+
+DiskAction* DiskS19::write(sg_size_t size)
+{
+ return new DiskS19Action(get_model(), size, not is_on(), this, s4u::Io::OpType::WRITE);
+}
+
+/**********
+ * Action *
+ **********/
+
+DiskS19Action::DiskS19Action(Model* model, double cost, bool failed, DiskImpl* disk, s4u::Io::OpType type)
+ : DiskAction(model, cost, failed, model->get_maxmin_system()->variable_new(this, 1.0, -1.0, 3), disk, type)
+{
+ XBT_IN("(%s,%g", disk->get_cname(), cost);
+
+ // Must be less than the max bandwidth for all actions
+ model->get_maxmin_system()->expand(disk->get_constraint(), get_variable(), 1.0);
+ switch (type) {
+ case s4u::Io::OpType::READ:
+ model->get_maxmin_system()->expand(disk->constraint_read_, get_variable(), 1.0);
+ break;
+ case s4u::Io::OpType::WRITE:
+ model->get_maxmin_system()->expand(disk->constraint_write_, get_variable(), 1.0);
+ break;
+ default:
+ THROW_UNIMPLEMENTED;
+ }
+ XBT_OUT();
+}
+
+void DiskS19Action::cancel()
+{
+ set_state(Action::State::FAILED);
+}
+
+void DiskS19Action::suspend()
+{
+ XBT_IN("(%p)", this);
+ if (is_running()) {
+ get_model()->get_maxmin_system()->update_variable_penalty(get_variable(), 0.0);
+ set_suspend_state(Action::SuspendStates::SUSPENDED);
+ }
+ XBT_OUT();
+}
+
+void DiskS19Action::resume()
+{
+ THROW_UNIMPLEMENTED;
+}
+
+void DiskS19Action::set_max_duration(double /*duration*/)
+{
+ THROW_UNIMPLEMENTED;
+}
+
+void DiskS19Action::set_sharing_penalty(double)
+{
+ THROW_UNIMPLEMENTED;
+}
+void DiskS19Action::update_remains_lazy(double /*now*/)
+{
+ THROW_IMPOSSIBLE;
+}
+} // namespace resource
+} // namespace kernel
+} // namespace simgrid
--- /dev/null
+/* Copyright (c) 2013-2019. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <xbt/base.h>
+
+#include "src/kernel/resource/DiskImpl.hpp"
+
+#ifndef DISK_S19_HPP_
+#define DISK_S19_HPP_
+
+namespace simgrid {
+namespace kernel {
+namespace resource {
+
+/***********
+ * Classes *
+ ***********/
+
+class XBT_PRIVATE DiskS19Model;
+class XBT_PRIVATE DiskS19;
+class XBT_PRIVATE DiskS19Action;
+
+/*********
+ * Model *
+ *********/
+
+class DiskS19Model : public DiskModel {
+public:
+ DiskS19Model();
+ DiskImpl* createDisk(const std::string& id, double read_bw, double write_bw) override;
+ double next_occuring_event(double now) override;
+ void update_actions_state(double now, double delta) override;
+};
+
+/************
+ * Resource *
+ ************/
+
+class DiskS19 : public DiskImpl {
+public:
+ DiskS19(DiskModel* model, const std::string& name, kernel::lmm::System* maxminSystem, double read_bw,
+ double write_bw);
+ virtual ~DiskS19() = default;
+ DiskAction* io_start(sg_size_t size, s4u::Io::OpType type) override;
+ DiskAction* read(sg_size_t size) override;
+ DiskAction* write(sg_size_t size) override;
+};
+
+/**********
+ * Action *
+ **********/
+
+class DiskS19Action : public DiskAction {
+public:
+ DiskS19Action(Model* model, double cost, bool failed, DiskImpl* disk, s4u::Io::OpType type);
+ void suspend() override;
+ void cancel() override;
+ void resume() override;
+ void set_max_duration(double duration) override;
+ void set_sharing_penalty(double sharing_penalty) override;
+ void update_remains_lazy(double now) override;
+};
+
+} // namespace resource
+} // namespace kernel
+} // namespace simgrid
+#endif /* DISK_S19_HPP_ */
double min_by_net =
surf_network_model->next_occuring_event_is_idempotent() ? surf_network_model->next_occuring_event(now) : -1;
double min_by_sto = surf_storage_model->next_occuring_event(now);
+ double min_by_dsk = surf_disk_model->next_occuring_event(now);
- XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_sto %f",
- this, typeid(surf_cpu_model_pm).name(), min_by_cpu,
- typeid(surf_network_model).name(), min_by_net,
- typeid(surf_storage_model).name(), min_by_sto);
+ XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_sto %f, %s min_by_dsk %f", this,
+ typeid(surf_cpu_model_pm).name(), min_by_cpu, typeid(surf_network_model).name(), min_by_net,
+ typeid(surf_storage_model).name(), min_by_sto, typeid(surf_disk_model).name(), min_by_dsk);
double res = min_by_cpu;
if (res < 0 || (min_by_net >= 0.0 && min_by_net < res))
res = min_by_net;
if (res < 0 || (min_by_sto >= 0.0 && min_by_sto < res))
res = min_by_sto;
+ if (res < 0 || (min_by_dsk >= 0.0 && min_by_dsk < res))
+ res = min_by_dsk;
return res;
}
#include "src/include/simgrid/sg_config.hpp"
#include "src/include/surf/surf.hpp"
#include "src/kernel/EngineImpl.hpp"
+#include "src/kernel/resource/DiskImpl.hpp"
#include "src/kernel/resource/profile/Profile.hpp"
#include "src/simix/smx_private.hpp"
#include "src/surf/HostImpl.hpp"
host->pimpl_->storage_ = mount_list;
mount_list.clear();
+ host->pimpl_->disks_ = std::move(args->disks);
+ for (auto d : host->pimpl_->disks_)
+ d->set_host(host);
+
/* Change from the defaults */
if (args->state_trace)
host->pimpl_cpu->set_state_profile(args->state_trace);
delete cabinet->radicals;
}
+simgrid::kernel::resource::DiskImpl* sg_platf_new_disk(simgrid::kernel::routing::DiskCreationArgs* disk)
+{
+ simgrid::kernel::resource::DiskImpl* d = surf_disk_model->createDisk(disk->id, disk->read_bw, disk->write_bw);
+ if (disk->properties) {
+ d->set_properties(*disk->properties);
+ delete disk->properties;
+ }
+ simgrid::s4u::Disk::on_creation(*d->get_iface());
+ return d;
+}
+
void sg_platf_new_storage(simgrid::kernel::routing::StorageCreationArgs* storage)
{
xbt_assert(std::find(known_storages.begin(), known_storages.end(), storage->id) == known_storages.end(),
std::string host_model_name = simgrid::config::get_value<std::string>("host/model");
std::string network_model_name = simgrid::config::get_value<std::string>("network/model");
std::string cpu_model_name = simgrid::config::get_value<std::string>("cpu/model");
+ std::string disk_model_name = simgrid::config::get_value<std::string>("disk/model");
std::string storage_model_name = simgrid::config::get_value<std::string>("storage/model");
/* The compound host model is needed when using non-default net/cpu models */
XBT_DEBUG("Call vm_model_init");
surf_vm_model_init_HL13();
+ XBT_DEBUG("Call disk_model_init");
+ int disk_id = find_model_description(surf_disk_model_description, disk_model_name);
+ surf_disk_model_description[disk_id].model_init_preparse();
+
XBT_DEBUG("Call storage_model_init");
int storage_id = find_model_description(surf_storage_model_description, storage_model_name);
surf_storage_model_description[storage_id].model_init_preparse();
#include "simgrid/s4u/Engine.hpp"
#include "src/include/surf/surf.hpp"
#include "src/instr/instr_private.hpp"
+#include "src/kernel/resource/DiskImpl.hpp"
#include "src/kernel/resource/profile/FutureEvtSet.hpp"
#include "src/plugins/vm/VirtualMachineImpl.hpp"
for (auto const& model : all_existing_models) {
if (model != surf_host_model && model != surf_vm_model && model != surf_network_model &&
- model != surf_storage_model) {
+ model != surf_storage_model && model != surf_disk_model) {
double next_event_model = model->next_occuring_event(NOW);
if ((time_delta < 0.0 || next_event_model < time_delta) && next_event_model >= 0.0)
time_delta = next_event_model;
{"Full", "Full update of remaining and variables. Slow but may be useful when debugging.", nullptr},
};
+const std::vector<surf_model_description_t> surf_disk_model_description = {
+ {"default", "Simplistic disk model.", &surf_disk_model_init_default},
+};
+
const std::vector<surf_model_description_t> surf_storage_model_description = {
{"default", "Simplistic storage model.", &surf_storage_model_init_default},
};
*/
XBT_PUBLIC void surf_storage_model_init_default();
+XBT_PUBLIC void surf_disk_model_init_default();
+
/* --------------------
* Model Descriptions
* -------------------- */
XBT_PUBLIC_DATA const std::vector<surf_model_description_t> surf_cpu_model_description;
/** @brief The list of all network models (pick one with --cfg=network/model) */
XBT_PUBLIC_DATA const std::vector<surf_model_description_t> surf_network_model_description;
+/** @brief The list of all disk models (pick one with --cfg=disk/model) */
+XBT_PUBLIC_DATA const std::vector<surf_model_description_t> surf_disk_model_description;
/** @brief The list of all storage models (pick one with --cfg=storage/model) */
XBT_PUBLIC_DATA const std::vector<surf_model_description_t> surf_storage_model_description;
/** @brief The list of all host models (pick one with --cfg=host/model:) */
profile::Profile* state_trace = nullptr;
std::string coord = "";
std::unordered_map<std::string, std::string>* properties = nullptr;
+ std::vector<simgrid::kernel::resource::DiskImpl*> disks;
};
class HostLinkCreationArgs {
sg_size_t size;
};
+class DiskCreationArgs {
+public:
+ std::string id;
+ std::unordered_map<std::string, std::string>* properties;
+ double read_bw;
+ double write_bw;
+};
+
class MountCreationArgs {
public:
std::string storageId;
XBT_PUBLIC void sg_platf_new_trace(simgrid::kernel::routing::ProfileCreationArgs* trace);
+XBT_PUBLIC simgrid::kernel::resource::DiskImpl*
+sg_platf_new_disk(simgrid::kernel::routing::DiskCreationArgs* disk); // Add a disk to the current host
+
XBT_PUBLIC void sg_platf_new_storage(simgrid::kernel::routing::StorageCreationArgs* storage); // Add a storage to the current Zone
XBT_PUBLIC void sg_platf_new_storage_type(simgrid::kernel::routing::StorageTypeCreationArgs* storage_type);
XBT_PUBLIC void sg_platf_new_mount(simgrid::kernel::routing::MountCreationArgs* mount);
static std::string surf_parsed_filename; // Currently parsed file (for the error messages)
std::vector<simgrid::kernel::resource::LinkImpl*>
- parsed_link_list; /* temporary store of current list link of a route */
-
+ parsed_link_list; /* temporary store of current link list of a route */
+std::vector<simgrid::kernel::resource::DiskImpl*> parsed_disk_list; /* temporary store of current disk list of a host */
/*
* Helping functions
*/
: nullptr;
host.pstate = surf_parse_get_int(A_surfxml_host_pstate);
host.coord = A_surfxml_host_coordinates;
+ host.disks.swap(parsed_disk_list);
sg_platf_new_host(&host);
}
void STag_surfxml_disk() {
- THROW_UNIMPLEMENTED;
+ ZONE_TAG = 0;
+ xbt_assert(current_property_set == nullptr,
+ "Someone forgot to reset the property set to nullptr in its closing tag (or XML malformed)");
}
+
void ETag_surfxml_disk() {
+ simgrid::kernel::routing::DiskCreationArgs disk;
+ disk.properties = current_property_set;
+ current_property_set = nullptr;
+
+ disk.id = A_surfxml_disk_id;
+ disk.read_bw = surf_parse_get_bandwidth(A_surfxml_disk_read___bw, "read_bw of disk ", disk.id);
+ disk.write_bw = surf_parse_get_bandwidth(A_surfxml_disk_write___bw, "write_bw of disk ", disk.id);
+
+ parsed_disk_list.push_back(sg_platf_new_disk(&disk));
}
void STag_surfxml_host___link(){
$ ${bindir:=.}/io-file-remote ${platfdir:=.}/storage/remote_io.xml ${srcdir:=.}/io-file-remote_d.xml "--log=root.fmt:[%10.6r]%e(%i@%5h)%e%m%n"
> [ 0.000000] (0@ ) Init: 12/476824 MiB used/free on 'Disk1'
-> [ 0.000000] (0@ ) Init: 2280/474556 MiB used/free on 'Disk2'
-> [ 0.000000] (1@alice) Opened file 'c:\Windows\setupact.log'
+> [ 0.000000] (0@ ) Init: 35/476801 MiB used/free on 'Disk2'
+> [ 0.000000] (1@alice) Opened file '/tmp/doc/simgrid/examples/msg/chord/chord10k.xml'
> [ 0.000000] (1@alice) File Descriptor information:
-> Full path: 'c:\Windows\setupact.log'
-> Size: 101663
-> Mount point: 'c:'
+> Full path: '/tmp/doc/simgrid/examples/msg/chord/chord10k.xml'
+> Size: 1624671
+> Mount point: '/tmp'
> Storage Id: 'Disk2'
> Storage Type: 'SATA-II_HDD'
> File Descriptor Id: 0
-> [ 0.000000] (1@alice) Try to read 101663 from 'c:\Windows\setupact.log'
+> [ 0.000000] (1@alice) Try to read 1624671 from '/tmp/doc/simgrid/examples/msg/chord/chord10k.xml'
> [ 0.000000] (2@ bob) Opened file '/scratch/lib/libsimgrid.so.3.6.2'
> [ 0.000000] (2@ bob) File Descriptor information:
> Full path: '/scratch/lib/libsimgrid.so.3.6.2'
> Storage Type: 'SATA-II_HDD'
> File Descriptor Id: 0
> [ 0.000000] (3@ carl) Try to read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'
-> [ 0.000000] (4@ dave) Opened file 'c:\Windows\bootstat.dat'
+> [ 0.000000] (4@ dave) Opened file '/tmp/doc/simgrid/examples/simdag/dax/Montage_50.xml'
> [ 0.000000] (4@ dave) File Descriptor information:
-> Full path: 'c:\Windows\bootstat.dat'
-> Size: 67584
-> Mount point: 'c:'
+> Full path: '/tmp/doc/simgrid/examples/simdag/dax/Montage_50.xml'
+> Size: 48868
+> Mount point: '/tmp'
> Storage Id: 'Disk2'
> Storage Type: 'SATA-II_HDD'
> File Descriptor Id: 0
-> [ 0.000000] (4@ dave) Try to read 67584 from 'c:\Windows\bootstat.dat'
-> [ 0.001469] (4@ dave) Have read 67584 from 'c:\Windows\bootstat.dat'. Offset is now at: 67584
-> [ 0.001469] (4@ dave) Seek back to the begining of the stream...
-> [ 0.001469] (4@ dave) Offset is now at: 0
-> [ 0.001469] (4@ dave) Opened file 'c:\Windows\Professional.xml'
-> [ 0.001469] (4@ dave) Try to write 31 MiB to 'c:\Windows\Professional.xml'
-> [ 0.003741] (1@alice) Have read 101663 from 'c:\Windows\setupact.log'. Offset is now at: 101663
-> [ 0.003741] (1@alice) Seek back to the begining of the stream...
-> [ 0.003741] (1@alice) Offset is now at: 0
+> [ 0.000000] (4@ dave) Try to read 48868 from '/tmp/doc/simgrid/examples/simdag/dax/Montage_50.xml'
+> [ 0.001062] (4@ dave) Have read 48868 from '/tmp/doc/simgrid/examples/simdag/dax/Montage_50.xml'. Offset is now at: 48868
+> [ 0.001062] (4@ dave) Seek back to the begining of the stream...
+> [ 0.001062] (4@ dave) Offset is now at: 0
+> [ 0.001062] (4@ dave) Opened file '/tmp/doc/simgrid/examples/simdag/scheduling/Montage_25.xml'
+> [ 0.001062] (4@ dave) Try to write 22 MiB to '/tmp/doc/simgrid/examples/simdag/scheduling/Montage_25.xml'
+> [ 0.050039] (1@alice) Have read 1624671 from '/tmp/doc/simgrid/examples/msg/chord/chord10k.xml'. Offset is now at: 1624671
+> [ 0.050039] (1@alice) Seek back to the begining of the stream...
+> [ 0.050039] (1@alice) Offset is now at: 0
> [ 0.276315] (3@ carl) Have read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'. Offset is now at: 12710497
> [ 0.276315] (3@ carl) Seek back to the begining of the stream...
> [ 0.276315] (3@ carl) Offset is now at: 0
> [ 0.387036] (2@ bob) Offset is now at: 0
> [ 0.387036] (2@ bob) Opened file '/scratch/doc/simgrid/examples/platforms/g5k.xml'
> [ 0.387036] (2@ bob) Try to write 16 MiB to '/scratch/doc/simgrid/examples/platforms/g5k.xml'
-> [ 0.528211] (4@ dave) Have written 32646144 bytes to 'c:\Windows\Professional.xml'.
-> [ 0.528211] (4@ dave) Move 'c:\Windows\Professional.xml' (of size 32646144) from 'dave' to 'carl'
+> [ 0.391211] (4@ dave) Have written 23641088 bytes to '/tmp/doc/simgrid/examples/simdag/scheduling/Montage_25.xml'.
+> [ 0.391211] (4@ dave) Move '/tmp/doc/simgrid/examples/simdag/scheduling/Montage_25.xml' (of size 23641088) from 'dave' to 'carl'
> [ 0.819921] (2@ bob) Have written 17436672 bytes to '/scratch/doc/simgrid/examples/platforms/g5k.xml'.
> [ 0.819921] (2@ bob) Copy '/scratch/doc/simgrid/examples/platforms/g5k.xml' (of size 17436672) from 'bob' to 'alice'
-> [ 1.843969] (0@ ) End: 60/476776 MiB used/free on 'Disk1'
-> [ 1.843969] (0@ ) End: 2297/474539 MiB used/free on 'Disk2'
-> [ 1.843969] (0@ ) Simulation time 1.84397
+> [ 1.598229] (0@ ) End: 51/476785 MiB used/free on 'Disk1'
+> [ 1.598229] (0@ ) End: 51/476785 MiB used/free on 'Disk2'
+> [ 1.598229] (0@ ) Simulation time 1.59823
<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
<platform version="4.1">
<actor host="alice" function="host">
- <argument value = "c:\Windows\setupact.log"/>
+ <argument value = "/tmp/doc/simgrid/examples/msg/chord/chord10k.xml"/>
</actor>
<actor host="bob" function="host">
<argument value = "/scratch/lib/libsimgrid.so.3.6.2"/>
<argument value = "/scratch/doc/simgrid/examples/platforms/g5k.xml"/>
<argument value = "alice"/>
- <argument value = "c:\Windows\Platforms\g5k.xml"/>
+ <argument value = "/tmp/doc/simgrid/examples/g5k_2.xml"/>
<argument value = "0"/>
</actor>
<actor host="carl" function="host">
<argument value = "/scratch/lib/libsimgrid.so.3.6.2"/>
</actor>
<actor host="dave" function="host">
- <argument value = "c:\Windows\bootstat.dat"/>
- <argument value = "c:\Windows\Professional.xml"/>
+ <argument value = "/tmp/doc/simgrid/examples/simdag/dax/Montage_50.xml"/>
+ <argument value = "/tmp/doc/simgrid/examples/simdag/scheduling/Montage_25.xml"/>
<argument value = "carl"/>
- <argument value = "/scratch/mailbox/Professional.xml"/>
+ <argument value = "/scratch/doc/simgrid/examples/simdag/dax/Montage_25.xml"/>
<argument value = "1"/>
</actor>
</platform>
switch (MSG_process_self_PID()) {
case 1:
- file = MSG_file_open("c:\\Windows\\setupact.log", NULL);
+ file = MSG_file_open("/tmp/include/surf/simgrid_dtd.h", NULL);
st_name = "Disk2";
break;
case 2:
$ ${bindir:=.}/io-file ${platfdir}/storage/storage.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (0:maestro@) Number of host '4'
-> [ 0.000000] (1:host@alice) Open file 'c:\Windows\setupact.log'
-> [ 0.000000] (1:host@alice) Capacity of the storage element 'c:\Windows\setupact.log' is stored on: 2391537133 / 536870912000
+> [ 0.000000] (1:host@alice) Open file '/tmp/include/surf/simgrid_dtd.h'
+> [ 0.000000] (1:host@alice) Capacity of the storage element '/tmp/include/surf/simgrid_dtd.h' is stored on: 13221994 / 536870912000
> [ 0.000000] (2:host@bob) Open file '/home/doc/simgrid/examples/platforms/nancy.xml'
> [ 0.000000] (2:host@bob) Capacity of the storage element '/home/doc/simgrid/examples/platforms/nancy.xml' is stored on: 36933331 / 536870912000
> [ 0.000000] (3:host@carl) Open file '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml'
> [ 0.000000] (4:host@denise) Capacity of the storage element '/home/doc/simgrid/examples/platforms/g5k.xml' is stored on: 13221994 / 536870912000
> [ 0.000040] (2:host@bob) Have read 4028 from '/home/doc/simgrid/examples/platforms/nancy.xml'
> [ 0.000085] (4:host@denise) Have read 17028 from '/home/doc/simgrid/examples/platforms/g5k.xml'
+> [ 0.000118] (1:host@alice) Have read 23583 from '/tmp/include/surf/simgrid_dtd.h'
> [ 0.000226] (3:host@carl) Have read 22645 from '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml'
-> [ 0.000508] (1:host@alice) Have read 101663 from 'c:\Windows\setupact.log'
> [ 0.001752] (4:host@denise) Have written 100000 in '/home/doc/simgrid/examples/platforms/g5k.xml'. Size now is: 117028
> [ 0.001752] (4:host@denise) Capacity of the storage element '/home/doc/simgrid/examples/platforms/g5k.xml' is stored on: 13321994 / 536870912000
> [ 0.001752] (4:host@denise) Coming back to the beginning of the stream for file '/home/doc/simgrid/examples/platforms/g5k.xml'
-> [ 0.002175] (1:host@alice) Have written 100000 in 'c:\Windows\setupact.log'. Size now is: 201663
-> [ 0.002175] (1:host@alice) Capacity of the storage element 'c:\Windows\setupact.log' is stored on: 2391637133 / 536870912000
-> [ 0.002175] (1:host@alice) Coming back to the beginning of the stream for file 'c:\Windows\setupact.log'
+> [ 0.001785] (1:host@alice) Have written 100000 in '/tmp/include/surf/simgrid_dtd.h'. Size now is: 123583
+> [ 0.001785] (1:host@alice) Capacity of the storage element '/tmp/include/surf/simgrid_dtd.h' is stored on: 13321994 / 536870912000
+> [ 0.001785] (1:host@alice) Coming back to the beginning of the stream for file '/tmp/include/surf/simgrid_dtd.h'
> [ 0.002302] (4:host@denise) Have read 110000 from '/home/doc/simgrid/examples/platforms/g5k.xml' (of size 117028)
> [ 0.002302] (4:host@denise) Coming back to the beginning of the stream for file '/home/doc/simgrid/examples/platforms/g5k.xml'
-> [ 0.002725] (1:host@alice) Have read 110000 from 'c:\Windows\setupact.log' (of size 201663)
-> [ 0.002725] (1:host@alice) Coming back to the beginning of the stream for file 'c:\Windows\setupact.log'
+> [ 0.002335] (1:host@alice) Have read 110000 from '/tmp/include/surf/simgrid_dtd.h' (of size 123583)
+> [ 0.002335] (1:host@alice) Coming back to the beginning of the stream for file '/tmp/include/surf/simgrid_dtd.h'
> [ 0.003374] (2:host@bob) Have written 100000 in '/home/doc/simgrid/examples/platforms/nancy.xml'. Size now is: 104028
> [ 0.003374] (2:host@bob) Capacity of the storage element '/home/doc/simgrid/examples/platforms/nancy.xml' is stored on: 37033331 / 536870912000
> [ 0.003374] (2:host@bob) Coming back to the beginning of the stream for file '/home/doc/simgrid/examples/platforms/nancy.xml'
> [ 0.004135] (4:host@denise) Have written 110000 in '/home/doc/simgrid/examples/platforms/g5k.xml'. Size now is: 110000
> [ 0.004135] (4:host@denise) Capacity of the storage element '/home/doc/simgrid/examples/platforms/g5k.xml' is stored on: 13314966 / 536870912000
> [ 0.004135] (4:host@denise) Close file '/home/doc/simgrid/examples/platforms/g5k.xml'
+> [ 0.004168] (1:host@alice) Have written 110000 in '/tmp/include/surf/simgrid_dtd.h'. Size now is: 110000
+> [ 0.004168] (1:host@alice) Capacity of the storage element '/tmp/include/surf/simgrid_dtd.h' is stored on: 13308411 / 536870912000
+> [ 0.004168] (1:host@alice) Unlink file '/tmp/include/surf/simgrid_dtd.h'
> [ 0.004414] (2:host@bob) Have read 104028 from '/home/doc/simgrid/examples/platforms/nancy.xml' (of size 104028)
> [ 0.004414] (2:host@bob) Coming back to the beginning of the stream for file '/home/doc/simgrid/examples/platforms/nancy.xml'
-> [ 0.004558] (1:host@alice) Have written 110000 in 'c:\Windows\setupact.log'. Size now is: 110000
-> [ 0.004558] (1:host@alice) Capacity of the storage element 'c:\Windows\setupact.log' is stored on: 2391545470 / 536870912000
-> [ 0.004558] (1:host@alice) Unlink file 'c:\Windows\setupact.log'
> [ 0.004660] (3:host@carl) Have read 110000 from '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml' (of size 122645)
> [ 0.004660] (3:host@carl) Coming back to the beginning of the stream for file '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml'
> [ 0.008081] (2:host@bob) Have written 110000 in '/home/doc/simgrid/examples/platforms/nancy.xml'. Size now is: 110000
$ ${bindir}/io-raw-storage ${platfdir}/storage/storage.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:@denise) *** Storage info on denise ***
-> [ 0.000000] (1:@denise) Storage name: Disk2, mount name: c:
+> [ 0.000000] (1:@denise) Storage name: Disk2, mount name: /tmp
> [ 0.000000] (1:@denise) Storage name: Disk4, mount name: /home
> [ 0.003333] (1:@denise) Wrote 200000 bytes on 'Disk4'
> [ 0.004333] (1:@denise) Read 200000 bytes on 'Disk4'
static void host()
{
- simgrid::s4u::Storage* storage = simgrid::s4u::Storage::by_name("Disk1");
- int id = simgrid::s4u::this_actor::get_pid();
+ simgrid::s4u::Disk* disk = simgrid::s4u::this_actor::get_host()->get_disks().front(); // Disk1
+ int id = simgrid::s4u::this_actor::get_pid();
XBT_INFO("process %d is writing!", id);
- storage->write(3000000);
+ disk->write(4000000);
XBT_INFO("process %d goes to sleep for %d seconds", id, id);
simgrid::s4u::this_actor::sleep_for(id);
XBT_INFO("process %d is writing again!", id);
- storage->write(3000000);
+ disk->write(4000000);
XBT_INFO("process %d goes to sleep for %d seconds", id, 6 - id);
simgrid::s4u::this_actor::sleep_for(6 - id);
XBT_INFO("process %d is reading!", id);
- storage->read(3000000);
+ disk->read(4000000);
XBT_INFO("process %d goes to sleep for %d seconds", id, id);
simgrid::s4u::this_actor::sleep_for(id);
XBT_INFO("process %d is reading again!", id);
- storage->read(3000000);
+ disk->read(4000000);
}
int main(int argc, char** argv)
-$ ./concurrent_rw ${platfdir}/storage/storage.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
+$ ./concurrent_rw ${platfdir}/hosts_with_disks.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
> [ 0.000000] (host@bob) process 1 is writing!
> [ 0.000000] (host@bob) process 2 is writing!
> [ 0.000000] (host@bob) process 3 is writing!
> [ 6.600000] (host@bob) process 3 is reading!
> [ 6.600000] (host@bob) process 4 is reading!
> [ 6.600000] (host@bob) process 5 is reading!
-> [ 6.750000] (host@bob) process 1 goes to sleep for 1 seconds
-> [ 6.750000] (host@bob) process 2 goes to sleep for 2 seconds
-> [ 6.750000] (host@bob) process 3 goes to sleep for 3 seconds
-> [ 6.750000] (host@bob) process 4 goes to sleep for 4 seconds
-> [ 6.750000] (host@bob) process 5 goes to sleep for 5 seconds
-> [ 7.750000] (host@bob) process 1 is reading again!
-> [ 8.750000] (host@bob) process 2 is reading again!
-> [ 9.750000] (host@bob) process 3 is reading again!
-> [ 10.750000] (host@bob) process 4 is reading again!
-> [ 11.750000] (host@bob) process 5 is reading again!
-> [ 11.780000] (maestro@) Simulation time 11.78
+> [ 6.800000] (host@bob) process 1 goes to sleep for 1 seconds
+> [ 6.800000] (host@bob) process 2 goes to sleep for 2 seconds
+> [ 6.800000] (host@bob) process 3 goes to sleep for 3 seconds
+> [ 6.800000] (host@bob) process 4 goes to sleep for 4 seconds
+> [ 6.800000] (host@bob) process 5 goes to sleep for 5 seconds
+> [ 7.800000] (host@bob) process 1 is reading again!
+> [ 8.800000] (host@bob) process 2 is reading again!
+> [ 9.800000] (host@bob) process 3 is reading again!
+> [ 10.800000] (host@bob) process 4 is reading again!
+> [ 11.800000] (host@bob) process 5 is reading again!
+> [ 11.840000] (maestro@) Simulation time 11.84
XBT_LOG_NEW_DEFAULT_CATEGORY(storage, "Messages specific for this simulation");
-static void display_storage_properties(simgrid::s4u::Storage* storage)
+static void display_disk_properties(simgrid::s4u::Disk* disk)
{
- const std::unordered_map<std::string, std::string>* props = storage->get_properties();
+ const std::unordered_map<std::string, std::string>* props = disk->get_properties();
if (not props->empty()) {
- XBT_INFO("\tProperties of mounted storage: %s", storage->get_cname());
+ XBT_INFO(" Properties of disk: %s", disk->get_cname());
for (auto const& elm : *props) {
XBT_INFO(" %s->%s", elm.first.c_str(), elm.second.c_str());
}
} else {
- XBT_INFO("\tNo property attached.");
+ XBT_INFO(" No property attached.");
}
}
simgrid::s4u::this_actor::sleep_for(.4);
}
-static void display_storage_content(simgrid::s4u::Storage* storage)
+static void display_disk_content(simgrid::s4u::Disk* disk)
{
- XBT_INFO("Print the content of the storage element: %s", storage->get_cname());
- std::map<std::string, sg_size_t>* content = storage->extension<simgrid::s4u::FileSystemStorageExt>()->get_content();
+ XBT_INFO("*** Dump a disk ***");
+ XBT_INFO("Print the content of the disk: %s", disk->get_cname());
+ std::map<std::string, sg_size_t>* content = disk->extension<simgrid::s4u::FileSystemDiskExt>()->get_content();
if (not content->empty()) {
for (auto const& entry : *content)
- XBT_INFO("\t%s size: %llu bytes", entry.first.c_str(), entry.second);
+ XBT_INFO(" %s size: %llu bytes", entry.first.c_str(), entry.second);
} else {
- XBT_INFO("\tNo content.");
+ XBT_INFO(" No content.");
}
}
-static void dump_storage_by_name(const std::string& name)
+static void get_set_disk_data(simgrid::s4u::Disk* disk)
{
- XBT_INFO("*** Dump a storage element ***");
- simgrid::s4u::Storage* storage = simgrid::s4u::Storage::by_name(name);
- display_storage_content(storage);
-}
-
-static void get_set_storage_data(const std::string& storage_name)
-{
- XBT_INFO("*** GET/SET DATA for storage element: %s ***", storage_name.c_str());
- simgrid::s4u::Storage* storage = simgrid::s4u::Storage::by_name(storage_name);
+ XBT_INFO("*** GET/SET DATA for disk: %s ***", disk->get_cname());
- std::string* data = static_cast<std::string*>(storage->get_data());
+ std::string* data = static_cast<std::string*>(disk->get_data());
XBT_INFO("Get data: '%s'", data ? data->c_str() : "No User Data");
- storage->set_data(new std::string("Some data"));
- data = static_cast<std::string*>(storage->get_data());
- XBT_INFO("\tSet and get data: '%s'", data->c_str());
+ disk->set_data(new std::string("Some data"));
+ data = static_cast<std::string*>(disk->get_data());
+ XBT_INFO(" Set and get data: '%s'", data->c_str());
delete data;
}
-static void dump_platform_storages()
+static void dump_platform_disks()
{
- std::vector<simgrid::s4u::Storage*> storages = simgrid::s4u::Engine::get_instance()->get_all_storages();
- for (auto const& s : storages) {
- XBT_INFO("Storage %s is attached to %s", s->get_cname(), s->get_host()->get_cname());
- s->set_property("other usage", "gpfs");
- }
+ for (auto const& h : simgrid::s4u::Engine::get_instance()->get_all_hosts())
+ for (auto const& d : h->get_disks()) {
+ if (h == d->get_host())
+ XBT_INFO("%s is attached to %s", d->get_cname(), d->get_host()->get_cname());
+ d->set_property("other usage", "gpfs");
+ }
}
-static void storage_info(simgrid::s4u::Host* host)
+static void disk_info(simgrid::s4u::Host* host)
{
- XBT_INFO("*** Storage info on %s ***", host->get_cname());
+ XBT_INFO("*** Disk info on %s ***", host->get_cname());
- for (auto const& elm : host->get_mounted_storages()) {
- const std::string& mount_name = elm.first;
- simgrid::s4u::Storage* storage = elm.second;
- XBT_INFO("\tStorage name: %s, mount name: %s", storage->get_cname(), mount_name.c_str());
+ for (auto const& disk : host->get_disks()) {
+ const char* mount_name = sg_disk_get_mount_point(disk);
+ XBT_INFO(" Disk name: %s, mount name: %s", disk->get_cname(), mount_name);
- XBT_INFO("\t\tFree size: %llu bytes", sg_storage_get_size_free(storage));
- XBT_INFO("\t\tUsed size: %llu bytes", sg_storage_get_size_used(storage));
+ XBT_INFO(" Free size: %llu bytes", sg_disk_get_size_free(disk));
+ XBT_INFO(" Used size: %llu bytes", sg_disk_get_size_used(disk));
- display_storage_properties(storage);
- dump_storage_by_name(storage->get_cname());
+ display_disk_properties(disk);
+ display_disk_content(disk);
}
}
static void client()
{
- hsm_put("alice", "/home/doc/simgrid/examples/msg/icomms/small_platform.xml", "c:\\Windows\\toto.cxx");
- hsm_put("alice", "/home/doc/simgrid/examples/msg/parallel_task/test_ptask_deployment.xml", "c:\\Windows\\titi.xml");
- hsm_put("alice", "/home/doc/simgrid/examples/msg/alias/masterslave_forwarder_with_alias.c", "c:\\Windows\\tata.c");
+ hsm_put("alice", "/scratch/doc/simgrid/examples/msg/icomms/small_platform.xml", "/tmp/toto.xml");
+ hsm_put("alice", "/scratch/doc/simgrid/examples/msg/parallel_task/test_ptask_deployment.xml", "/tmp/titi.xml");
+ hsm_put("alice", "/scratch/doc/simgrid/examples/msg/alias/masterslave_forwarder_with_alias.c", "/tmp/tata.c");
simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name("alice");
mailbox->put(new std::string("finalize"), 0);
- get_set_storage_data("Disk1");
+ get_set_disk_data(simgrid::s4u::Host::current()->get_disks().front()); // Disk1
}
static void server()
{
- storage_info(simgrid::s4u::this_actor::get_host());
+ disk_info(simgrid::s4u::this_actor::get_host());
simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_cname());
XBT_INFO("Server waiting for transfers ...");
}
}
- storage_info(simgrid::s4u::this_actor::get_host());
- dump_platform_storages();
+ disk_info(simgrid::s4u::this_actor::get_host());
+ dump_platform_disks();
}
int main(int argc, char* argv[])
-$ ./storage_client_server ${platfdir}/storage/storage.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
-> [ 0.000000] (server@alice) *** Storage info on alice ***
-> [ 0.000000] (server@alice) Storage name: Disk2, mount name: c:
-> [ 0.000000] (server@alice) Free size: 534479374867 bytes
-> [ 0.000000] (server@alice) Used size: 2391537133 bytes
-> [ 0.000000] (server@alice) No property attached.
-> [ 0.000000] (server@alice) *** Dump a storage element ***
-> [ 0.000000] (server@alice) Print the content of the storage element: Disk2
-> [ 0.000000] (server@alice) \Windows\CoreSingleLanguage.xml size: 31497 bytes
-> [ 0.000000] (server@alice) \Windows\DPINST.LOG size: 18944 bytes
-> [ 0.000000] (server@alice) \Windows\DirectX.log size: 10486 bytes
-> [ 0.000000] (server@alice) \Windows\DtcInstall.log size: 1955 bytes
-> [ 0.000000] (server@alice) \Windows\HelpPane.exe size: 883712 bytes
-> [ 0.000000] (server@alice) \Windows\MEMORY.DMP size: 2384027342 bytes
-> [ 0.000000] (server@alice) \Windows\PFRO.log size: 6770 bytes
-> [ 0.000000] (server@alice) \Windows\Professional.xml size: 31881 bytes
-> [ 0.000000] (server@alice) \Windows\Starter.xml size: 31537 bytes
-> [ 0.000000] (server@alice) \Windows\WLXPGSS.SCR size: 322048 bytes
-> [ 0.000000] (server@alice) \Windows\WMSysPr9.prx size: 316640 bytes
-> [ 0.000000] (server@alice) \Windows\WindowsUpdate.log size: 1518934 bytes
-> [ 0.000000] (server@alice) \Windows\_isusr32.dll size: 180320 bytes
-> [ 0.000000] (server@alice) \Windows\avastSS.scr size: 41664 bytes
-> [ 0.000000] (server@alice) \Windows\bfsvc.exe size: 75264 bytes
-> [ 0.000000] (server@alice) \Windows\bootstat.dat size: 67584 bytes
-> [ 0.000000] (server@alice) \Windows\csup.txt size: 12 bytes
-> [ 0.000000] (server@alice) \Windows\dchcfg64.exe size: 335464 bytes
-> [ 0.000000] (server@alice) \Windows\dcmdev64.exe size: 93288 bytes
-> [ 0.000000] (server@alice) \Windows\explorer.exe size: 2380944 bytes
-> [ 0.000000] (server@alice) \Windows\font1.sii size: 4907 bytes
-> [ 0.000000] (server@alice) \Windows\font2.sii size: 8698 bytes
-> [ 0.000000] (server@alice) \Windows\hapint.exe size: 382056 bytes
-> [ 0.000000] (server@alice) \Windows\hh.exe size: 17408 bytes
-> [ 0.000000] (server@alice) \Windows\mib.bin size: 43131 bytes
-> [ 0.000000] (server@alice) \Windows\notepad.exe size: 243712 bytes
-> [ 0.000000] (server@alice) \Windows\regedit.exe size: 159232 bytes
-> [ 0.000000] (server@alice) \Windows\setupact.log size: 101663 bytes
-> [ 0.000000] (server@alice) \Windows\setuperr.log size: 0 bytes
-> [ 0.000000] (server@alice) \Windows\splwow64.exe size: 126464 bytes
-> [ 0.000000] (server@alice) \Windows\system.ini size: 219 bytes
-> [ 0.000000] (server@alice) \Windows\twain_32.dll size: 50176 bytes
-> [ 0.000000] (server@alice) \Windows\vmgcoinstall.log size: 1585 bytes
-> [ 0.000000] (server@alice) \Windows\win.ini size: 92 bytes
-> [ 0.000000] (server@alice) \Windows\winhlp32.exe size: 10752 bytes
-> [ 0.000000] (server@alice) \Windows\write.exe size: 10752 bytes
+$ ./storage_client_server ${platfdir}/hosts_with_disks.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
+> [ 0.000000] (server@alice) *** Disk info on alice ***
+> [ 0.000000] (server@alice) Disk name: Disk1, mount name: /
+> [ 0.000000] (server@alice) Free size: 536857690006 bytes
+> [ 0.000000] (server@alice) Used size: 13221994 bytes
+> [ 0.000000] (server@alice) Properties of disk: Disk1
+> [ 0.000000] (server@alice) content->storage/content/small_content.txt
+> [ 0.000000] (server@alice) *** Dump a disk ***
+> [ 0.000000] (server@alice) Print the content of the disk: Disk1
+> [ 0.000000] (server@alice) /bin/smpicc size: 918 bytes
+> [ 0.000000] (server@alice) /bin/tesh size: 356434 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/msg/README size: 4805 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/msg/alias/masterslave_forwarder_with_alias.c size: 6217 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/msg/icomms/small_platform.xml size: 972 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/msg/parallel_task/test_ptask_deployment.xml size: 654 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/msg/trace/test9.xml size: 598 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/platforms/g5k.xml size: 17028 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/smpi/NAS/DT/README size: 999 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/smpi/NAS/EP/README size: 347 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/smpi/NAS/EP/randlc.c size: 3300 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/smpi/NAS/FT/README size: 276 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/smpi/NAS/MG/README size: 5465 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/smpi/NAS/MPI_dummy/README size: 2406 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/smpi/NAS/README size: 1857 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/smpi/NAS/SP/README size: 926 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/smpi/NAS/common/randdp.c size: 1441 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/smpi/NAS/sys/README size: 1461 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/smpi/mc_bugged2.c size: 1387 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/examples/xbt/sem_basic.c size: 1970 bytes
+> [ 0.000000] (server@alice) /doc/simgrid/html/group__XBT__str.html size: 36192 bytes
+> [ 0.000000] (server@alice) /include/instr/instr.h size: 5750 bytes
+> [ 0.000000] (server@alice) /include/mc/modelchecker.h size: 96 bytes
+> [ 0.000000] (server@alice) /include/msg/datatypes.h size: 4635 bytes
+> [ 0.000000] (server@alice) /include/simdag/simdag.h size: 10325 bytes
+> [ 0.000000] (server@alice) /include/simix/simix.h size: 13003 bytes
+> [ 0.000000] (server@alice) /include/smpi/mpif.h size: 4826 bytes
+> [ 0.000000] (server@alice) /include/surf/simgrid_dtd.h size: 23583 bytes
+> [ 0.000000] (server@alice) /include/xbt/fifo.h size: 3626 bytes
+> [ 0.000000] (server@alice) /lib/libsimgrid.so.3.6.2 size: 12710497 bytes
> [ 0.000000] (server@alice) Server waiting for transfers ...
-> [ 0.000010] (client@bob) client has read 972 on /home/doc/simgrid/examples/msg/icomms/small_platform.xml
+> [ 0.000010] (client@bob) client has read 972 on /scratch/doc/simgrid/examples/msg/icomms/small_platform.xml
> [ 0.000010] (client@bob) client sends 972 to alice
-> [ 0.001986] (server@alice) 972 bytes on 972 bytes have been written by server on /sd1
-> [ 0.401976] (client@bob) client has read 654 on /home/doc/simgrid/examples/msg/parallel_task/test_ptask_deployment.xml
+> [ 0.001982] (server@alice) 972 bytes on 972 bytes have been written by server on /sd1
+> [ 0.401976] (client@bob) client has read 654 on /scratch/doc/simgrid/examples/msg/parallel_task/test_ptask_deployment.xml
> [ 0.401976] (client@bob) client sends 654 to alice
-> [ 0.403944] (server@alice) 654 bytes on 654 bytes have been written by server on /sd1
-> [ 0.803996] (client@bob) client has read 6217 on /home/doc/simgrid/examples/msg/alias/masterslave_forwarder_with_alias.c
+> [ 0.403942] (server@alice) 654 bytes on 654 bytes have been written by server on /sd1
+> [ 0.803996] (client@bob) client has read 6217 on /scratch/doc/simgrid/examples/msg/alias/masterslave_forwarder_with_alias.c
> [ 0.803996] (client@bob) client sends 6217 to alice
-> [ 0.806104] (server@alice) 6217 bytes on 6217 bytes have been written by server on /sd1
-> [ 1.207952] (server@alice) *** Storage info on alice ***
-> [ 1.207952] (server@alice) Storage name: Disk2, mount name: c:
-> [ 1.207952] (server@alice) Free size: 534479367024 bytes
-> [ 1.207952] (server@alice) Used size: 2391544976 bytes
-> [ 1.207952] (server@alice) No property attached.
-> [ 1.207952] (server@alice) *** Dump a storage element ***
-> [ 1.207952] (server@alice) Print the content of the storage element: Disk2
-> [ 1.207952] (server@alice) \Windows\CoreSingleLanguage.xml size: 31497 bytes
-> [ 1.207952] (server@alice) \Windows\DPINST.LOG size: 18944 bytes
-> [ 1.207952] (server@alice) \Windows\DirectX.log size: 10486 bytes
-> [ 1.207952] (server@alice) \Windows\DtcInstall.log size: 1955 bytes
-> [ 1.207952] (server@alice) \Windows\HelpPane.exe size: 883712 bytes
-> [ 1.207952] (server@alice) \Windows\MEMORY.DMP size: 2384027342 bytes
-> [ 1.207952] (server@alice) \Windows\PFRO.log size: 6770 bytes
-> [ 1.207952] (server@alice) \Windows\Professional.xml size: 31881 bytes
-> [ 1.207952] (server@alice) \Windows\Starter.xml size: 31537 bytes
-> [ 1.207952] (server@alice) \Windows\WLXPGSS.SCR size: 322048 bytes
-> [ 1.207952] (server@alice) \Windows\WMSysPr9.prx size: 316640 bytes
-> [ 1.207952] (server@alice) \Windows\WindowsUpdate.log size: 1518934 bytes
-> [ 1.207952] (server@alice) \Windows\_isusr32.dll size: 180320 bytes
-> [ 1.207952] (server@alice) \Windows\avastSS.scr size: 41664 bytes
-> [ 1.207952] (server@alice) \Windows\bfsvc.exe size: 75264 bytes
-> [ 1.207952] (server@alice) \Windows\bootstat.dat size: 67584 bytes
-> [ 1.207952] (server@alice) \Windows\csup.txt size: 12 bytes
-> [ 1.207952] (server@alice) \Windows\dchcfg64.exe size: 335464 bytes
-> [ 1.207952] (server@alice) \Windows\dcmdev64.exe size: 93288 bytes
-> [ 1.207952] (server@alice) \Windows\explorer.exe size: 2380944 bytes
-> [ 1.207952] (server@alice) \Windows\font1.sii size: 4907 bytes
-> [ 1.207952] (server@alice) \Windows\font2.sii size: 8698 bytes
-> [ 1.207952] (server@alice) \Windows\hapint.exe size: 382056 bytes
-> [ 1.207952] (server@alice) \Windows\hh.exe size: 17408 bytes
-> [ 1.207952] (server@alice) \Windows\mib.bin size: 43131 bytes
-> [ 1.207952] (server@alice) \Windows\notepad.exe size: 243712 bytes
-> [ 1.207952] (server@alice) \Windows\regedit.exe size: 159232 bytes
-> [ 1.207952] (server@alice) \Windows\setupact.log size: 101663 bytes
-> [ 1.207952] (server@alice) \Windows\setuperr.log size: 0 bytes
-> [ 1.207952] (server@alice) \Windows\splwow64.exe size: 126464 bytes
-> [ 1.207952] (server@alice) \Windows\system.ini size: 219 bytes
-> [ 1.207952] (server@alice) \Windows\tata.c size: 6217 bytes
-> [ 1.207952] (server@alice) \Windows\titi.xml size: 654 bytes
-> [ 1.207952] (server@alice) \Windows\toto.cxx size: 972 bytes
-> [ 1.207952] (server@alice) \Windows\twain_32.dll size: 50176 bytes
-> [ 1.207952] (server@alice) \Windows\vmgcoinstall.log size: 1585 bytes
-> [ 1.207952] (server@alice) \Windows\win.ini size: 92 bytes
-> [ 1.207952] (server@alice) \Windows\winhlp32.exe size: 10752 bytes
-> [ 1.207952] (server@alice) \Windows\write.exe size: 10752 bytes
-> [ 1.207952] (server@alice) Storage Disk1 is attached to bob
-> [ 1.207952] (client@bob) *** GET/SET DATA for storage element: Disk1 ***
+> [ 0.806079] (server@alice) 6217 bytes on 6217 bytes have been written by server on /sd1
+> [ 1.207952] (server@alice) *** Disk info on alice ***
+> [ 1.207952] (server@alice) Disk name: Disk1, mount name: /
+> [ 1.207952] (server@alice) Free size: 536857682163 bytes
+> [ 1.207952] (server@alice) Used size: 13229837 bytes
+> [ 1.207952] (server@alice) Properties of disk: Disk1
+> [ 1.207952] (server@alice) content->storage/content/small_content.txt
+> [ 1.207952] (server@alice) *** Dump a disk ***
+> [ 1.207952] (server@alice) Print the content of the disk: Disk1
+> [ 1.207952] (server@alice) /bin/smpicc size: 918 bytes
+> [ 1.207952] (server@alice) /bin/tesh size: 356434 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/msg/README size: 4805 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/msg/alias/masterslave_forwarder_with_alias.c size: 6217 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/msg/icomms/small_platform.xml size: 972 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/msg/parallel_task/test_ptask_deployment.xml size: 654 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/msg/trace/test9.xml size: 598 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/platforms/g5k.xml size: 17028 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/smpi/NAS/DT/README size: 999 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/smpi/NAS/EP/README size: 347 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/smpi/NAS/EP/randlc.c size: 3300 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/smpi/NAS/FT/README size: 276 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/smpi/NAS/MG/README size: 5465 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/smpi/NAS/MPI_dummy/README size: 2406 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/smpi/NAS/README size: 1857 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/smpi/NAS/SP/README size: 926 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/smpi/NAS/common/randdp.c size: 1441 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/smpi/NAS/sys/README size: 1461 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/smpi/mc_bugged2.c size: 1387 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/examples/xbt/sem_basic.c size: 1970 bytes
+> [ 1.207952] (server@alice) /doc/simgrid/html/group__XBT__str.html size: 36192 bytes
+> [ 1.207952] (server@alice) /include/instr/instr.h size: 5750 bytes
+> [ 1.207952] (server@alice) /include/mc/modelchecker.h size: 96 bytes
+> [ 1.207952] (server@alice) /include/msg/datatypes.h size: 4635 bytes
+> [ 1.207952] (server@alice) /include/simdag/simdag.h size: 10325 bytes
+> [ 1.207952] (server@alice) /include/simix/simix.h size: 13003 bytes
+> [ 1.207952] (server@alice) /include/smpi/mpif.h size: 4826 bytes
+> [ 1.207952] (server@alice) /include/surf/simgrid_dtd.h size: 23583 bytes
+> [ 1.207952] (server@alice) /include/xbt/fifo.h size: 3626 bytes
+> [ 1.207952] (server@alice) /lib/libsimgrid.so.3.6.2 size: 12710497 bytes
+> [ 1.207952] (server@alice) /tmp/tata.c size: 6217 bytes
+> [ 1.207952] (server@alice) /tmp/titi.xml size: 654 bytes
+> [ 1.207952] (server@alice) /tmp/toto.xml size: 972 bytes
+> [ 1.207952] (client@bob) *** GET/SET DATA for disk: Disk1 ***
> [ 1.207952] (client@bob) Get data: 'No User Data'
-> [ 1.207952] (client@bob) Set and get data: 'Some data'
-> [ 1.207952] (server@alice) Storage Disk2 is attached to alice
-> [ 1.207952] (server@alice) Storage Disk3 is attached to carl
-> [ 1.207952] (server@alice) Storage Disk4 is attached to denise
+> [ 1.207952] (client@bob) Set and get data: 'Some data'
+> [ 1.207952] (server@alice) Disk1 is attached to alice
+> [ 1.207952] (server@alice) Disk1 is attached to bob
+> [ 1.207952] (server@alice) Disk2 is attached to bob
> [ 1.207952] (maestro@) Simulated time: 1.20795
# Test for MPI_File_read and MPI_File_write
! output sort
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/storage/remote_io.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-all-at
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/hosts_with_disks.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-all-at
> You requested to use 4 ranks, but there is only 2 processes in your hostfile...
> [rank 0] -> bob
> [rank 1] -> carl
# Test for MPI_File_read and MPI_File_write
! output sort
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/storage/remote_io.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-all
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/hosts_with_disks.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-all
> You requested to use 4 ranks, but there is only 2 processes in your hostfile...
> [rank 0] -> bob
> [rank 1] -> carl
# Test for MPI_File_read and MPI_File_write
! output sort
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/storage/remote_io.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-ordered
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/hosts_with_disks.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-ordered
> You requested to use 4 ranks, but there is only 2 processes in your hostfile...
> [rank 0] -> bob
> [rank 1] -> carl
# Test for MPI_File_read and MPI_File_write
! output sort
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/storage/remote_io.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-shared
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/hosts_with_disks.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-shared
> You requested to use 4 ranks, but there is only 2 processes in your hostfile...
> [rank 0] -> bob
> [rank 1] -> carl
> (0@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
> (0@bob) Write in MPI_File /scratch/testfile, 4 bytes written, readsize 4 bytes, movesize 4
> (0@bob) Position after write in MPI_File /scratch/testfile : 4
-> (2@bob) Seeking in MPI_File /scratch/testfile, setting offset 4
+> (0@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (2@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
> (2@bob) Write in MPI_File /scratch/testfile, 4 bytes written, readsize 4 bytes, movesize 4
-> (2@bob) Position after write in MPI_File /scratch/testfile : 8
-> (3@carl) Seeking in MPI_File /scratch/testfile, setting offset 8
+> (2@bob) Position after write in MPI_File /scratch/testfile : 4
+> (2@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (3@carl) Seeking in MPI_File /scratch/testfile, setting offset 0
> (3@carl) Write in MPI_File /scratch/testfile, 4 bytes written, readsize 4 bytes, movesize 4
-> (3@carl) Position after write in MPI_File /scratch/testfile : 12
-> (1@carl) Seeking in MPI_File /scratch/testfile, setting offset 12
+> (3@carl) Position after write in MPI_File /scratch/testfile : 4
+> (1@carl) Seeking in MPI_File /scratch/testfile, setting offset 4
> (1@carl) Write in MPI_File /scratch/testfile, 4 bytes written, readsize 4 bytes, movesize 4
-> (1@carl) Position after write in MPI_File /scratch/testfile : 16
-> (0@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
-> (2@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
+> (1@carl) Position after write in MPI_File /scratch/testfile : 8
> (3@carl) Seeking in MPI_File /scratch/testfile, setting offset 0
> (1@carl) Seeking in MPI_File /scratch/testfile, setting offset 0
> (0@bob) Seeking in MPI_File /scratch/testfile, setting offset 0
> (0@bob) Read in MPI_File /scratch/testfile, 4 bytes read, readsize 4 bytes, movesize 4
> (0@bob) Position after read in MPI_File /scratch/testfile : 4
> (2@bob) Seeking in MPI_File /scratch/testfile, setting offset 4
-> (2@bob) Read in MPI_File /scratch/testfile, 4 bytes read, readsize 4 bytes, movesize 4
-> (2@bob) Position after read in MPI_File /scratch/testfile : 8
-> (3@carl) Seeking in MPI_File /scratch/testfile, setting offset 8
-> (3@carl) Read in MPI_File /scratch/testfile, 4 bytes read, readsize 4 bytes, movesize 4
-> (3@carl) Position after read in MPI_File /scratch/testfile : 12
-> (1@carl) Seeking in MPI_File /scratch/testfile, setting offset 12
+> (2@bob) Read in MPI_File /scratch/testfile, 0 bytes read, readsize 4 bytes, movesize 4
+> (2@bob) Position after read in MPI_File /scratch/testfile : 4
+> (3@carl) Seeking in MPI_File /scratch/testfile, setting offset 4
+> (3@carl) Read in MPI_File /scratch/testfile, 0 bytes read, readsize 4 bytes, movesize 4
+> (3@carl) Position after read in MPI_File /scratch/testfile : 4
+> (1@carl) Seeking in MPI_File /scratch/testfile, setting offset 4
> (1@carl) Read in MPI_File /scratch/testfile, 4 bytes read, readsize 4 bytes, movesize 4
-> (1@carl) Position after read in MPI_File /scratch/testfile : 16
-
+> (1@carl) Position after read in MPI_File /scratch/testfile : 8
# Test for MPI_File_read and MPI_File_write
! output sort
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/storage/remote_io.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-simple-at
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/hosts_with_disks.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-simple-at
> You requested to use 4 ranks, but there is only 2 processes in your hostfile...
> [rank 0] -> bob
> [rank 1] -> carl
# Test for MPI_File_read and MPI_File_write
! output sort
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/storage/remote_io.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-simple
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_io -platform ../../../examples/platforms/hosts_with_disks.xml -np 4 --log=xbt_cfg.thres:critical --log=smpi_kernel.thres:warning --log=smpi_mpi.thres:error --log=smpi_io.thres:verbose "--log=root.fmt:(%P@%h)%e%m%n" --cfg=smpi/simulate-computation:0 ${bindir:=.}/io-simple
> You requested to use 4 ranks, but there is only 2 processes in your hostfile...
> [rank 0] -> bob
> [rank 1] -> carl
src/surf/xml/simgrid_dtd.c
src/surf/xml/surfxml_sax_cb.cpp
+ src/surf/disk_s19.hpp
src/surf/StorageImpl.hpp
src/surf/storage_n11.hpp
src/surf/surf_interface.hpp
src/kernel/resource/Action.cpp
src/kernel/resource/Model.cpp
src/kernel/resource/Resource.cpp
+ src/kernel/resource/DiskImpl.cpp
+ src/kernel/resource/DiskImpl.hpp
src/kernel/resource/profile/DatedValue.cpp
src/kernel/resource/profile/DatedValue.hpp
src/surf/cpu_cas01.cpp
src/surf/cpu_interface.cpp
src/surf/cpu_ti.cpp
+ src/surf/disk_s19.cpp
src/surf/network_cm02.cpp
src/surf/network_constant.cpp
src/surf/network_interface.cpp
src/s4u/s4u_Barrier.cpp
src/s4u/s4u_ConditionVariable.cpp
src/s4u/s4u_Comm.cpp
+ src/s4u/s4u_Disk.cpp
src/s4u/s4u_Engine.cpp
src/s4u/s4u_Exec.cpp
src/s4u/s4u_Host.cpp
include/simgrid/s4u/Barrier.hpp
include/simgrid/s4u/Comm.hpp
include/simgrid/s4u/ConditionVariable.hpp
+ include/simgrid/s4u/Disk.hpp
include/simgrid/s4u/Engine.hpp
include/simgrid/s4u/Exec.hpp
include/simgrid/s4u/Host.hpp
examples/platforms/faulty_host.xml
examples/platforms/g5k.xml
examples/platforms/griffon.xml
+ examples/platforms/hosts_with_disks.xml
examples/platforms/meta_cluster.xml
examples/platforms/multicore_machine.xml
examples/platforms/ns3-big-cluster.xml
examples/platforms/simulacrum_7_hosts.xml
examples/platforms/storage/content/small_content.txt
examples/platforms/storage/content/storage_content.txt
- examples/platforms/storage/content/win_storage_content.txt
examples/platforms/storage/remote_io.xml
examples/platforms/storage/storage.xml
examples/platforms/small_platform.xml