SimGrid (3.21) NOT RELEASED (Release Target: September 23. 2018, 1:54 UTC)
+S4U new features:
+ - s4u::Io: IOs go asynchronous as activities. This comes with new methods in the
+ s4u::Storage class:
+ - io_init(sg_size_t, s4u::Io::OpType) to create a READ or WRITE asynchronous
+ IO operations that can be started, waited for, or canceled as a regular
+ activity.
+ - read_async(sg_size_t) and write_async(sg_size_t) which are wrappers on
+ io_init() + start()
+
Tracing:
- Rename 'power' and 'power_used' variables into 'speed' and 'speed_used'
- New host variable: 'core_count'
-
+
XBT:
- Remove xbt_os_thread_specific features
- Remove portability wrapper to condition variables
energy-exec energy-boot energy-link energy-vm
engine-filtering
exec-async exec-basic exec-dvfs exec-monitor exec-ptask exec-remote
- io-file-system io-file-remote io-storage-raw
+ io-async io-file-system io-file-remote io-storage-raw
mutex
platform-failures platform-properties plugin-hostload
replay-comm replay-storage
engine-filtering
exec-async exec-basic exec-dvfs exec-monitor exec-ptask exec-remote
platform-properties plugin-hostload mutex
- io-file-system io-file-remote io-storage-raw
+ io-async io-file-system io-file-remote io-storage-raw
replay-comm replay-storage
routing-get-clusters
)
--- /dev/null
+/* Copyright (c) 2007-2018. 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"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
+
+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::IoPtr activity = storage->io_init(size, simgrid::s4u::Io::OpType::READ);
+ activity->start();
+ activity->wait();
+
+ XBT_INFO("Goodbye now!");
+}
+
+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::IoPtr activity = storage->write_async(size);
+ simgrid::s4u::this_actor::sleep_for(0.5);
+ XBT_INFO("I changed my mind, cancel!");
+ activity->cancel();
+
+ XBT_INFO("Goodbye now!");
+}
+
+int main(int argc, char* argv[])
+{
+ simgrid::s4u::Engine e(&argc, argv);
+ e.load_platform(argv[1]);
+ simgrid::s4u::Actor::create("test", simgrid::s4u::Host::by_name("bob"), test, 2e7);
+ simgrid::s4u::Actor::create("test_cancel", simgrid::s4u::Host::by_name("alice"), test_cancel, 5e7);
+
+ e.run();
+
+ XBT_INFO("Simulation time %g", e.get_clock());
+
+ return 0;
+}
--- /dev/null
+#!/usr/bin/env tesh
+
+$ $SG_TEST_EXENV ${bindir:=.}/s4u-io-async$EXEEXT ${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
+> [ 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!
+> [ 0.500000] (0:maestro@) Simulation time 0.5
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);
surf::StorageImpl* get_impl() { return pimpl_; }
return res;
}
+IoPtr Storage::read_async(sg_size_t size)
+{
+
+ IoPtr res = io_init(size, Io::OpType::READ);
+ res->start();
+ return res;
+}
+
sg_size_t Storage::read(sg_size_t size)
{
IoPtr i = io_init(size, Io::OpType::READ);
return i->get_performed_ioops();
}
+IoPtr Storage::write_async(sg_size_t size)
+{
+
+ IoPtr res = io_init(size, Io::OpType::WRITE);
+ res->start();
+ return res;
+}
+
sg_size_t Storage::write(sg_size_t size)
{
IoPtr i = io_init(size, Io::OpType::WRITE);