Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[simgrid.git] / teshsuite / s4u / issue71 / issue71.cpp
1 /* Copyright (c) 2021-2022. 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 <vector>
8
9 static void runner()
10 {
11   auto e                    = simgrid::s4u::Engine::get_instance();
12   simgrid::s4u::Host* host0 = e->host_by_name("c1_0");
13   simgrid::s4u::Host* host1 = e->host_by_name("c2_0");
14
15   std::vector<double> comp = {1e6, 1e6};
16   std::vector<double> comm = {1, 2, 3, 4};
17
18   std::vector<simgrid::s4u::Host*> h1 = {host0, host1};
19   simgrid::s4u::this_actor::parallel_execute(h1, comp, comm);
20 }
21
22 int main(int argc, char* argv[])
23 {
24   simgrid::s4u::Engine e(&argc, argv);
25   simgrid::s4u::Engine::set_config("host/model:ptask_L07");
26
27   xbt_assert(argc == 2,
28              "\nUsage: %s platform_ok.xml\n"
29              "\tor: %s platform_bad.xml\n",
30              argv[0], argv[0]);
31
32   const char* platform_file = argv[1];
33   e.load_platform(platform_file);
34
35   simgrid::s4u::Actor::create("actor", e.host_by_name("c1_0"), runner);
36
37   e.run();
38   return 0;
39 }