Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
New test for the remote exec
[simgrid.git] / examples / s4u / exec-remote / s4u-exec-remote.cpp
1 /* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "simgrid/s4u.hpp"
7 #include "simgrid/forward.h"
8 #include "simgrid/s4u/forward.hpp"
9
10 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
11
12 static void wizard()
13 {
14   simgrid::s4u::Host* ginette = simgrid::s4u::Host::by_name("Ginette");
15
16   XBT_INFO("I'm a wizard! I can run a task on the Fafard host from the Ginette one! Look!");
17   simgrid::s4u::ExecPtr activity = simgrid::s4u::Actor::self()->exec_init(48.492e6);
18   activity->setHost(ginette);
19   activity->start();
20   // TODO: display the load of each hosts once it gets possible
21   XBT_INFO("It started. Running 48.492Mf takes exactly one second on Ginette (but not on Fafard).");
22
23   activity->wait();
24
25   XBT_INFO("Done!");
26 }
27
28 int main(int argc, char* argv[])
29 {
30   simgrid::s4u::Engine e(&argc, argv);
31   e.loadPlatform(argv[1]);
32   simgrid::s4u::Actor::createActor("test", simgrid::s4u::Host::by_name("Fafard"), wizard);
33
34   e.run();
35
36   return 0;
37 }