include examples/c/exec-dvfs/exec-dvfs.tesh
include examples/c/io-disk-raw/io-disk-raw.c
include examples/c/io-disk-raw/io-disk-raw.tesh
+include examples/c/io-file-remote/io-file-remote.c
+include examples/c/io-file-remote/io-file-remote.tesh
+include examples/c/io-file-remote/io-file-remote_d.xml
include examples/c/plugin-hostload/plugin-hostload.c
include examples/c/plugin-hostload/plugin-hostload.tesh
include examples/deprecated/java/app/bittorrent/Common.java
include teshsuite/msg/host_on_off_processes/host_on_off_processes.tesh
include teshsuite/msg/host_on_off_recv/host_on_off_recv.c
include teshsuite/msg/host_on_off_recv/host_on_off_recv.tesh
-include teshsuite/msg/io-file-remote/io-file-remote.c
-include teshsuite/msg/io-file-remote/io-file-remote.tesh
-include teshsuite/msg/io-file-remote/io-file-remote_d.xml
include teshsuite/msg/io-file/io-file.c
include teshsuite/msg/io-file/io-file.tesh
include teshsuite/msg/platform-properties/platform-properties.c
cloud-capping cloud-simple
exec-dvfs
energy-exec
- io-disk-raw
+ io-disk-raw io-file-remote
plugin-hostload)
add_executable (${x}-c EXCLUDE_FROM_ALL ${x}/${x}.c)
target_link_libraries(${x}-c simgrid)
${CMAKE_CURRENT_SOURCE_DIR}/app-pingpong/app-pingpong_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/async-waitall/async-waitall_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/async-waitany/async-waitany_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/io-file-remote/io-file-remote_d.xml
PARENT_SCOPE)
foreach(x
cloud-capping cloud-simple
exec-dvfs
energy-exec
- io-disk-raw
+ io-disk-raw io-file-remote
plugin-hostload)
ADD_TESH(c-${x} --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
--setenv bindir=${CMAKE_BINARY_DIR}/examples/c/${x}
--- /dev/null
+/* Copyright (c) 2014-2020. 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/actor.h"
+#include "simgrid/disk.h"
+#include "simgrid/engine.h"
+#include "simgrid/host.h"
+#include <simgrid/plugins/file_system.h>
+
+#include "xbt/asserts.h"
+#include "xbt/log.h"
+
+#define INMEGA (1024 * 1024)
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(remote_io, "Messages specific for this io example");
+
+static void host(int argc, char* argv[])
+{
+ sg_file_t file = sg_file_open(argv[1], NULL);
+ const char* filename = sg_file_get_name(file);
+ XBT_INFO("Opened file '%s'", filename);
+ sg_file_dump(file);
+
+ XBT_INFO("Try to write %llu MiB to '%s'", sg_file_get_size(file) / 1024, filename);
+ sg_size_t write = sg_file_write(file, sg_file_get_size(file) * 1024);
+ XBT_INFO("Have written %llu MiB to '%s'.", write / (1024 * 1024), filename);
+
+ if (argc > 4) {
+ if (atoi(argv[4]) != 0) {
+ XBT_INFO("Move '%s' (of size %llu) from '%s' to '%s'", filename, sg_file_get_size(file), sg_host_self_get_name(),
+ argv[2]);
+ sg_file_rmove(file, sg_host_by_name(argv[2]), argv[3]);
+ } else {
+ XBT_INFO("Copy '%s' (of size %llu) from '%s' to '%s'", filename, sg_file_get_size(file), sg_host_self_get_name(),
+ argv[2]);
+ sg_file_rcopy(file, sg_host_by_name(argv[2]), argv[3]);
+ }
+ }
+ sg_file_close(file);
+}
+
+int main(int argc, char** argv)
+{
+
+ simgrid_init(&argc, argv);
+ sg_storage_file_system_init();
+ simgrid_load_platform(argv[1]);
+
+ simgrid_register_function("host", host);
+ simgrid_load_deployment(argv[2]);
+
+ size_t host_count = sg_host_count();
+ sg_host_t* hosts = sg_host_list();
+
+ for (long i = 0; i < host_count; i++) {
+ unsigned int disk_count;
+ sg_disk_t* disks;
+ sg_host_disks(hosts[i], &disk_count, &disks);
+ for (unsigned int j = 0; j < disk_count; j++)
+ XBT_INFO("Init: %s: %llu/%llu MiB used/free on '%s@%s'", sg_host_get_name(hosts[i]),
+ sg_disk_get_size_used(disks[j]) / INMEGA, sg_disk_get_size_free(disks[j]) / INMEGA,
+ sg_disk_name(disks[j]), sg_host_get_name(sg_disk_get_host(disks[j])));
+ free(disks);
+ }
+
+ simgrid_run();
+
+ for (long i = 0; i < host_count; i++) {
+ unsigned int disk_count;
+ sg_disk_t* disks;
+ sg_host_disks(hosts[i], &disk_count, &disks);
+ for (unsigned int j = 0; j < disk_count; j++)
+ XBT_INFO("End: %llu/%llu MiB used/free on '%s@%s'", sg_disk_get_size_used(disks[j]) / INMEGA,
+ sg_disk_get_size_free(disks[j]) / INMEGA, sg_disk_name(disks[j]), sg_host_get_name(hosts[i]));
+ free(disks);
+ }
+
+ free(hosts);
+
+ XBT_INFO("Simulation time %g", simgrid_get_clock());
+ return 0;
+}
--- /dev/null
+#!/usr/bin/env tesh
+
+$ ${bindir:=.}/io-file-remote-c ${platfdir}/hosts_with_disks.xml 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: '/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 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/doc/simgrid/examples/platforms/g5k.xml'
+> Size: 17028
+> Mount point: '/scratch'
+> Disk Id: 'Disk1'
+> Host Id: 'bob'
+> File Descriptor Id: 0
+> [ 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/include/surf/simgrid_dtd.h'
+> Size: 23583
+> Mount point: '/scratch'
+> Disk Id: 'Disk1'
+> Host Id: 'bob'
+> File Descriptor Id: 0
+> [ 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
--- /dev/null
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
+<platform version="4.1">
+ <actor host="alice" function="host">
+ <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/doc/simgrid/examples/platforms/g5k.xml"/>
+ <argument value = "alice"/>
+ <argument value = "/tmp/platforms/g5k.xml"/>
+ <argument value = "0"/>
+ </actor>
+ <actor host="carl" function="host">
+ <argument value = "/scratch/include/surf/simgrid_dtd.h"/>
+ </actor>
+</platform>
get_sender host_on_off host_on_off_recv
process-lifetime
energy-ptask platform-properties
- io-file io-file-remote
+ io-file
task-priority
trace_integration)
if(enable_msg)
${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait2_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait3_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait4_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/io-file-remote/io-file-remote_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/platform-properties/platform-properties_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/process-lifetime/baseline_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/process-lifetime/kill_d.xml
task_destroy_cancel task_listen_from task_progress
process-lifetime
energy-ptask
- io-file io-file-remote
+ io-file
platform-properties
task-priority
trace_integration)
+++ /dev/null
-/* Copyright (c) 2014-2020. 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/msg.h"
-#include <simgrid/plugins/file_system.h>
-
-#include <stdio.h> /* sscanf */
-
-#define INMEGA (1024 * 1024)
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(remote_io, "Messages specific for this io example");
-
-static int host(int argc, char* argv[])
-{
- msg_file_t file = MSG_file_open(argv[1], NULL);
- const char* filename = MSG_file_get_name(file);
- XBT_INFO("Opened file '%s'", filename);
- MSG_file_dump(file);
-
- XBT_INFO("Try to read %llu from '%s'", MSG_file_get_size(file), filename);
- sg_size_t read = MSG_file_read(file, MSG_file_get_size(file));
- XBT_INFO("Have read %llu from '%s'. Offset is now at: %llu", read, filename, MSG_file_tell(file));
- XBT_INFO("Seek back to the beginning of the stream...");
- MSG_file_seek(file, 0, SEEK_SET);
- XBT_INFO("Offset is now at: %llu", MSG_file_tell(file));
-
- MSG_file_close(file);
-
- if (argc > 5) {
- file = MSG_file_open(argv[2], NULL);
- filename = MSG_file_get_name(file);
- XBT_INFO("Opened file '%s'", filename);
- XBT_INFO("Try to write %llu MiB to '%s'", MSG_file_get_size(file) / 1024, filename);
- sg_size_t write = MSG_file_write(file, MSG_file_get_size(file) * 1024);
- XBT_INFO("Have written %llu bytes to '%s'.", write, filename);
-
- const_sg_host_t src = MSG_host_self();
- msg_host_t dest = MSG_host_by_name(argv[3]);
- if (xbt_str_parse_int(argv[5], "Argument 5 (move or copy) must be an int, not '%s'")) {
- XBT_INFO("Move '%s' (of size %llu) from '%s' to '%s'", filename, MSG_file_get_size(file), MSG_host_get_name(src),
- argv[3]);
- MSG_file_rmove(file, dest, argv[4]);
- } else {
- XBT_INFO("Copy '%s' (of size %llu) from '%s' to '%s'", filename, MSG_file_get_size(file), MSG_host_get_name(src),
- argv[3]);
- MSG_file_rcopy(file, dest, argv[4]);
- }
- MSG_file_close(file);
- }
-
- return 0;
-}
-
-int main(int argc, char** argv)
-{
- unsigned int cur;
- const_sg_storage_t st;
-
- MSG_init(&argc, argv);
- MSG_storage_file_system_init();
-
- MSG_create_environment(argv[1]);
- MSG_function_register("host", host);
- MSG_launch_application(argv[2]);
-
- xbt_dynar_t storages = MSG_storages_as_dynar();
- xbt_dynar_foreach (storages, cur, st) {
- XBT_INFO("Init: %llu/%llu MiB used/free on '%s'", MSG_storage_get_used_size(st) / INMEGA,
- MSG_storage_get_free_size(st) / INMEGA, MSG_storage_get_name(st));
- }
-
- int res = MSG_main();
-
- xbt_dynar_foreach (storages, cur, st) {
- XBT_INFO("End: %llu/%llu MiB used/free on '%s'", MSG_storage_get_used_size(st) / INMEGA,
- MSG_storage_get_free_size(st) / INMEGA, MSG_storage_get_name(st));
- }
- xbt_dynar_free(&storages);
-
- XBT_INFO("Simulation time %g", MSG_get_clock());
- return res != MSG_OK;
-}
+++ /dev/null
-#!/usr/bin/env tesh
-
-$ ${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: 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: '/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 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'
-> Size: 12710497
-> Mount point: '/scratch'
-> Storage Id: 'Disk1'
-> Storage Type: 'SATA-II_HDD'
-> 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] (3@ carl) File Descriptor information:
-> Full path: '/scratch/lib/libsimgrid.so.3.6.2'
-> Size: 12710497
-> Mount point: '/scratch'
-> Storage Id: 'Disk1'
-> 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 '/tmp/doc/simgrid/examples/simdag/dax/Montage_50.xml'
-> [ 0.000000] (4@ dave) File Descriptor information:
-> 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 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 beginning 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 beginning 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 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.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.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
+++ /dev/null
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-<platform version="4.1">
- <actor host="alice" function="host">
- <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 = "/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 = "/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/doc/simgrid/examples/simdag/dax/Montage_25.xml"/>
- <argument value = "1"/>
- </actor>
-</platform>