Logo AND Algorithmique Numérique Distribuée

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