examples/c/energy-exec/energy-exec-c
examples/c/energy-exec-ptask/energy-exec-ptask-c
examples/c/energy-vm/energy-vm-c
+examples/c/exec-basic/exec-basic-c
examples/c/exec-dvfs/exec-dvfs-c
+examples/c/exec-remote/exec-remote-c
examples/c/io-disk-raw/io-disk-raw-c
examples/c/io-file-remote/io-file-remote-c
examples/c/plugin-hostload/plugin-hostload-c
include examples/c/exec-basic/exec-basic.tesh
include examples/c/exec-dvfs/exec-dvfs.c
include examples/c/exec-dvfs/exec-dvfs.tesh
+include examples/c/exec-remote/exec-remote.c
+include examples/c/exec-remote/exec-remote.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
See also :py:func:`simgrid.Exec.set_host()`.
+ .. example-tab:: examples/c/exec-remote/exec-remote.c
+
+ See also :cpp:func:`sg_exec_set_host()`.
+
- **Parallel executions:**
These objects are convenient abstractions of parallel
computational kernels that span over several machines, such as a
app-pingpong app-token-ring
async-wait async-waitall async-waitany
cloud-capping cloud-migration cloud-simple
- exec-basic exec-dvfs
+ exec-basic exec-dvfs exec-remote
energy-exec energy-exec-ptask energy-vm
io-disk-raw io-file-remote
plugin-hostload)
app-chainsend app-pingpong app-token-ring
async-wait async-waitall async-waitany
cloud-capping cloud-migration cloud-simple
- exec-basic exec-dvfs
+ exec-basic exec-dvfs exec-remote
energy-exec energy-exec-ptask energy-vm
io-disk-raw io-file-remote
plugin-hostload)
--- /dev/null
+/* Copyright (c) 2007-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/engine.h"
+#include "simgrid/exec.h"
+#include "simgrid/host.h"
+
+#include "xbt/log.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(exec_remote, "Messages specific for this example");
+
+static void wizard(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
+{
+ const_sg_host_t fafard = sg_host_by_name("Fafard");
+ sg_host_t ginette = sg_host_by_name("Ginette");
+ sg_host_t boivin = sg_host_by_name("Boivin");
+
+ XBT_INFO("I'm a wizard! I can run a task on the Ginette host from the Fafard one! Look!");
+ sg_exec_t exec = sg_actor_exec_init(48.492e6);
+ sg_exec_set_host(exec, ginette);
+ sg_exec_start(exec);
+ XBT_INFO("It started. Running 48.492Mf takes exactly one second on Ginette (but not on Fafard).");
+
+ sg_actor_sleep_for(0.1);
+ XBT_INFO("Loads in flops/s: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f", sg_host_load(boivin), sg_host_load(fafard),
+ sg_host_load(ginette));
+
+ sg_exec_wait(exec);
+
+ XBT_INFO("Done!");
+ XBT_INFO("And now, harder. Start a remote task on Ginette and move it to Boivin after 0.5 sec");
+ exec = sg_actor_exec_init(73293500);
+ sg_exec_set_host(exec, ginette);
+ sg_exec_start(exec);
+
+ sg_actor_sleep_for(0.5);
+ XBT_INFO("Loads before the move: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f", sg_host_load(boivin), sg_host_load(fafard),
+ sg_host_load(ginette));
+
+ sg_exec_set_host(exec, boivin);
+
+ sg_actor_sleep_for(0.1);
+ XBT_INFO("Loads after the move: Boivin=%.0f; Fafard=%.0f; Ginette=%.0f", sg_host_load(boivin), sg_host_load(fafard),
+ sg_host_load(ginette));
+
+ sg_exec_wait(exec);
+ XBT_INFO("Done!");
+}
+
+int main(int argc, char* argv[])
+{
+ simgrid_init(&argc, argv);
+ simgrid_load_platform(argv[1]);
+ sg_actor_create("test", sg_host_by_name("Fafard"), wizard, 0, NULL);
+
+ simgrid_run();
+
+ return 0;
+}
--- /dev/null
+#!/usr/bin/env tesh
+
+! output sort 19
+$ ${bindir:=.}/exec-remote-c ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [ 0.000000] (1:test@Fafard) I'm a wizard! I can run a task on the Ginette host from the Fafard one! Look!
+> [ 0.000000] (1:test@Fafard) It started. Running 48.492Mf takes exactly one second on Ginette (but not on Fafard).
+> [ 0.100000] (1:test@Fafard) Loads in flops/s: Boivin=0; Fafard=0; Ginette=48492000
+> [ 1.000000] (1:test@Fafard) Done!
+> [ 1.000000] (1:test@Fafard) And now, harder. Start a remote task on Ginette and move it to Boivin after 0.5 sec
+> [ 1.500000] (1:test@Fafard) Loads before the move: Boivin=0; Fafard=0; Ginette=48492000
+> [ 1.600000] (1:test@Fafard) Loads after the move: Boivin=98095000; Fafard=0; Ginette=0
+> [ 2.000000] (1:test@Fafard) Done!