Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
(#27) added a (commented out) test that highlights a wait_any bug.
[simgrid.git] / teshsuite / s4u / activity-lifecycle / activity-lifecycle.cpp
1 /* Copyright (c) 2010-2019. 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
8 #include <cmath>
9
10 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
11
12 std::vector<simgrid::s4u::Host*> all_hosts;
13
14 /* Helper function easing the testing of actor's ending condition */
15 static void assert_exit(bool exp_failed, double duration)
16 {
17   double expected_time = simgrid::s4u::Engine::get_clock() + duration;
18   simgrid::s4u::this_actor::on_exit([exp_failed, expected_time](bool got_failed) {
19     xbt_assert(exp_failed == got_failed, "Exit failure status mismatch. Expected %d, got %d", exp_failed, got_failed);
20     xbt_assert(std::fabs(expected_time - simgrid::s4u::Engine::get_clock()) < 0.001, "Exit time mismatch. Expected %f",
21                expected_time);
22     XBT_VERB("Checks on exit successful");
23   });
24 }
25 /* Helper function in charge of running a test and doing some sanity checks afterward */
26 static void run_test(const char* test_name, const std::function<void()>& test)
27 {
28   simgrid::s4u::Actor::create(test_name, all_hosts[0], test);
29   simgrid::s4u::this_actor::sleep_for(10);
30
31   /* Check that no actor remain (but on host[0], where main_dispatcher lives */
32   for (unsigned int i = 0; i < all_hosts.size(); i++) {
33     std::vector<simgrid::s4u::ActorPtr> all_actors = all_hosts[i]->get_all_actors();
34     unsigned int expected_count = (i == 0) ? 1 : 0; // host[0] contains main_dispatcher, all other are empty
35     if (all_actors.size() != expected_count) {
36       XBT_CRITICAL("Host %s contains %zu actors but %u are expected (i=%u). Existing actors: ",
37                    all_hosts[i]->get_cname(), all_actors.size(), expected_count, i);
38       for (auto act : all_actors)
39         XBT_CRITICAL(" - %s", act->get_cname());
40       xbt_die("This is wrong");
41     }
42   }
43   xbt_assert("TODO: Check that all LMM are empty");
44   XBT_INFO("SUCCESS: %s", test_name);
45   XBT_INFO("#########################################################################################################");
46 }
47
48 /**
49  ** Each tests
50  **/
51
52 static void test_sleep()
53 {
54   XBT_INFO("%s: Launch a sleep(5), and let it proceed", __func__);
55   bool global = false;
56
57   simgrid::s4u::ActorPtr sleeper5 = simgrid::s4u::Actor::create("sleep5", all_hosts[1], [&global]() {
58     assert_exit(false, 5.);
59     simgrid::s4u::this_actor::sleep_for(5);
60     global = true;
61   });
62   simgrid::s4u::this_actor::sleep_for(10);
63   xbt_assert(global, "The forked actor did not modify the global after sleeping. Was it killed before?");
64 }
65
66 static void test_sleep_kill_middle()
67 {
68   XBT_INFO("%s: Launch a sleep(5), and kill it after 2 secs", __func__);
69
70   simgrid::s4u::ActorPtr sleeper5 = simgrid::s4u::Actor::create("sleep5_killed", all_hosts[1], []() {
71     assert_exit(true, 2);
72     simgrid::s4u::this_actor::sleep_for(5);
73     xbt_die("I should be dead now");
74   });
75
76   simgrid::s4u::this_actor::sleep_for(2);
77   sleeper5->kill();
78 }
79
80 static void test_sleep_kill_begin()
81 {
82   XBT_INFO("%s: Launch a sleep(5), and kill it right after start", __func__);
83
84   simgrid::s4u::ActorPtr sleeper5 = simgrid::s4u::Actor::create("sleep5_killed", all_hosts[1], []() {
85     assert_exit(true, 0);
86     simgrid::s4u::this_actor::sleep_for(5);
87     xbt_die("I should be dead now");
88   });
89
90   simgrid::s4u::this_actor::yield();
91   sleeper5->kill();
92 }
93
94 static void test_sleep_restart_begin()
95 {
96   XBT_INFO("%s: Launch a sleep(5), and restart its host right after start", __func__);
97
98   simgrid::s4u::ActorPtr sleeper5 = simgrid::s4u::Actor::create("sleep5_restarted", all_hosts[1], []() {
99     assert_exit(true, 0);
100     simgrid::s4u::this_actor::sleep_for(5);
101     xbt_die("I should be dead now");
102   });
103
104   simgrid::s4u::this_actor::yield();
105   sleeper5->get_host()->turn_off();
106   sleeper5->get_host()->turn_on();
107   XBT_INFO("Test %s is ending", __func__);
108 }
109
110 static void test_sleep_restart_middle()
111 {
112   XBT_INFO("%s: Launch a sleep(5), and restart its host after 2 secs", __func__);
113
114   simgrid::s4u::ActorPtr sleeper5 = simgrid::s4u::Actor::create("sleep5_restarted", all_hosts[1], []() {
115     assert_exit(true, 2);
116     simgrid::s4u::this_actor::sleep_for(5);
117     xbt_die("I should be dead now");
118   });
119
120   simgrid::s4u::this_actor::sleep_for(2);
121   sleeper5->get_host()->turn_off();
122   sleeper5->get_host()->turn_on();
123   XBT_INFO("Test %s is ending", __func__);
124 }
125 static void test_sleep_restart_end()
126 {
127   XBT_INFO("%s: Launch a sleep(5), and restart its host right when it stops", __func__);
128   bool sleeper_done = false;
129
130   simgrid::s4u::Actor::create("sleep5_restarted", all_hosts[1], [&sleeper_done]() {
131     assert_exit(true, 5);
132     simgrid::s4u::this_actor::sleep_for(5);
133     all_hosts[1]->turn_off(); // kill the host right at the end of this sleep and of this actor
134     sleeper_done = true;
135   });
136   simgrid::s4u::this_actor::sleep_for(10);
137   xbt_assert(sleeper_done, "Not sure of how the actor survived the shutdown of its host.");
138   all_hosts[1]->turn_on();
139 }
140 static void test_exec()
141 {
142   XBT_INFO("%s: Launch a execute(5s), and let it proceed", __func__);
143   bool global = false;
144
145   simgrid::s4u::ActorPtr exec5 = simgrid::s4u::Actor::create("exec5", all_hosts[1], [&global]() {
146     assert_exit(false, 5.);
147     simgrid::s4u::this_actor::execute(500000000);
148     global = true;
149   });
150   simgrid::s4u::this_actor::sleep_for(10);
151   xbt_assert(global, "The forked actor did not modify the global after executing. Was it killed before?");
152 }
153
154 static void test_exec_kill_middle()
155 {
156   XBT_INFO("%s: Launch a execute(5s), and kill it after 2 secs", __func__);
157
158   simgrid::s4u::ActorPtr exec5 = simgrid::s4u::Actor::create("exec5_killed", all_hosts[1], []() {
159     assert_exit(true, 2);
160     simgrid::s4u::this_actor::execute(500000000);
161     xbt_die("I should be dead now");
162   });
163
164   simgrid::s4u::this_actor::sleep_for(2);
165   exec5->kill();
166 }
167
168 static void test_exec_kill_begin()
169 {
170   XBT_INFO("%s: Launch a execute(5s), and kill it right after start", __func__);
171
172   simgrid::s4u::ActorPtr exec5 = simgrid::s4u::Actor::create("exec5_killed", all_hosts[1], []() {
173     assert_exit(true, 0);
174     simgrid::s4u::this_actor::execute(500000000);
175     xbt_die("I should be dead now");
176   });
177
178   simgrid::s4u::this_actor::yield();
179   exec5->kill();
180 }
181
182 static void test_exec_restart_begin()
183 {
184   XBT_INFO("%s: Launch a execute(5s), and restart its host right after start", __func__);
185
186   simgrid::s4u::ActorPtr exec5 = simgrid::s4u::Actor::create("exec5_restarted", all_hosts[1], []() {
187     assert_exit(1, 0);
188     simgrid::s4u::this_actor::execute(500000000);
189     xbt_die("I should be dead now");
190   });
191
192   simgrid::s4u::this_actor::yield();
193   exec5->get_host()->turn_off();
194   exec5->get_host()->turn_on();
195   XBT_INFO("Test %s is ending", __func__);
196 }
197
198 static void test_exec_restart_middle()
199 {
200   XBT_INFO("%s: Launch a execute(5s), and restart its host after 2 secs", __func__);
201
202   simgrid::s4u::ActorPtr exec5 = simgrid::s4u::Actor::create("exec5_restarted", all_hosts[1], []() {
203     assert_exit(true, 2);
204     simgrid::s4u::this_actor::execute(500000000);
205     xbt_die("I should be dead now");
206   });
207
208   simgrid::s4u::this_actor::sleep_for(2);
209   exec5->get_host()->turn_off();
210   exec5->get_host()->turn_on();
211   XBT_INFO("Test %s is ending", __func__);
212 }
213 static void test_exec_restart_end()
214 {
215   XBT_INFO("%s: Launch a execute(5s), and restart its host right when it stops", __func__);
216   bool execution_done = false;
217
218   simgrid::s4u::Actor::create("exec5_restarted", all_hosts[1], [&execution_done]() {
219     assert_exit(false, 5);
220     simgrid::s4u::this_actor::execute(500000000);
221     execution_done = true;
222   });
223   simgrid::s4u::Actor::create("killer", all_hosts[0], []() {
224     simgrid::s4u::this_actor::sleep_for(5);
225     XBT_INFO("Killer!");
226     all_hosts[1]->turn_off();
227     all_hosts[1]->turn_on();
228   });
229   simgrid::s4u::this_actor::sleep_for(10);
230   xbt_assert(execution_done,
231              "Restarted actor was already dead in the scheduling round during which the host_off simcall was issued");
232 }
233
234 static void test_comm()
235 {
236   XBT_INFO("%s: Launch a communication", __func__);
237   bool send_done = false;
238   bool recv_done = false;
239
240   simgrid::s4u::Actor::create("sender", all_hosts[1], [&send_done]() {
241     assert_exit(false, 5);
242     char* payload = xbt_strdup("toto");
243     simgrid::s4u::Mailbox::by_name("mb")->put(payload, 5000);
244     send_done = true;
245   });
246   simgrid::s4u::Actor::create("receiver", all_hosts[2], [&recv_done]() {
247     assert_exit(false, 5);
248     void* payload = simgrid::s4u::Mailbox::by_name("mb")->get();
249     xbt_free(payload);
250     recv_done = true;
251   });
252
253   simgrid::s4u::this_actor::sleep_for(10);
254   xbt_assert(send_done, "Sender killed somehow. It shouldn't");
255   xbt_assert(recv_done, "Receiver killed somehow. It shouldn't");
256 }
257
258 static void test_comm_dsend_and_quit_put_before_get()
259 {
260   XBT_INFO("%s: Launch a detached communication and end right after", __func__);
261   bool dsend_done = false;
262   bool recv_done  = false;
263
264   simgrid::s4u::ActorPtr sender = simgrid::s4u::Actor::create("sender", all_hosts[1], [&dsend_done]() {
265     assert_exit(false, 0);
266     char* payload = xbt_strdup("toto");
267     simgrid::s4u::Mailbox::by_name("mb")->put_init(payload, 1000)->detach();
268     dsend_done = true;
269   });
270
271   simgrid::s4u::Actor::create("receiver", all_hosts[2], [&recv_done]() {
272     assert_exit(false, 3);
273     simgrid::s4u::this_actor::sleep_for(2);
274     void* payload = simgrid::s4u::Mailbox::by_name("mb")->get();
275     xbt_free(payload);
276     recv_done = true;
277   });
278
279   // Sleep long enough to let the test ends by itself. 3 + surf_precision should be enough.
280   simgrid::s4u::this_actor::sleep_for(4);
281   xbt_assert(dsend_done, "Sender killed somehow. It shouldn't");
282   xbt_assert(recv_done, "Receiver killed somehow. It shouldn't");
283 }
284
285 static void test_comm_dsend_and_quit_get_before_put()
286 {
287   XBT_INFO("%s: Launch a detached communication and end right after", __func__);
288   bool dsend_done = false;
289   bool recv_done  = false;
290
291   simgrid::s4u::ActorPtr sender = simgrid::s4u::Actor::create("sender", all_hosts[1], [&dsend_done]() {
292     assert_exit(false, 2);
293     char* payload = xbt_strdup("toto");
294     simgrid::s4u::this_actor::sleep_for(2);
295     simgrid::s4u::Mailbox::by_name("mb")->put_init(payload, 1000)->detach();
296     dsend_done = true;
297   });
298
299   simgrid::s4u::Actor::create("receiver", all_hosts[2], [&recv_done]() {
300     assert_exit(false, 3);
301     void* payload = simgrid::s4u::Mailbox::by_name("mb")->get();
302     xbt_free(payload);
303     recv_done = true;
304   });
305
306   // Sleep long enough to let the test ends by itself. 3 + surf_precision should be enough.
307   simgrid::s4u::this_actor::sleep_for(4);
308   xbt_assert(dsend_done, "Sender killed somehow. It shouldn't");
309   xbt_assert(recv_done, "Receiver killed somehow. It shouldn't");
310 }
311
312
313 static void test_comm_killsend()
314 {
315   XBT_INFO("%s: Launch a communication and kill the sender", __func__);
316   bool send_done = false;
317   bool recv_done = false;
318
319   simgrid::s4u::ActorPtr sender = simgrid::s4u::Actor::create("sender", all_hosts[1], [&send_done]() {
320     assert_exit(true, 2);
321     // Encapsulate the payload in a std::unique_ptr so that it is correctly free'd when the sender is killed during its
322     // communication (thanks to RAII).  The pointer is then released when the communication is over.
323     std::unique_ptr<char, decltype(&xbt_free_f)> payload(xbt_strdup("toto"), &xbt_free_f);
324     simgrid::s4u::Mailbox::by_name("mb")->put(payload.get(), 5000);
325     payload.release();
326     send_done = true;
327   });
328   simgrid::s4u::Actor::create("receiver", all_hosts[2], [&recv_done]() {
329     assert_exit(false, 2);
330     bool got_exception = false;
331     try {
332       void* payload = simgrid::s4u::Mailbox::by_name("mb")->get();
333       xbt_free(payload);
334     } catch (simgrid::NetworkFailureException const&) {
335       got_exception = true;
336     }
337     xbt_assert(got_exception);
338     recv_done = true;
339   });
340
341   simgrid::s4u::this_actor::sleep_for(2);
342   sender->kill();
343   // let the test ends by itself. waiting for surf_precision should be enough.
344   simgrid::s4u::this_actor::sleep_for(0.00001);
345
346   xbt_assert(not send_done, "Sender was not killed properly");
347   xbt_assert(recv_done, "Receiver killed somehow. It shouldn't");
348 }
349
350 static void test_host_off_while_receive()
351 {
352   XBT_INFO("%s: Launch an actor that waits on a recv, kill its host", __func__);
353   bool in_on_exit = false;
354   bool returned_from_main = false;
355   bool in_catch_before_on_exit = false;
356   bool in_catch_after_on_exit = false;
357   bool send_done               = false;
358
359   simgrid::s4u::ActorPtr receiver = simgrid::s4u::Actor::create(
360     "receiver", all_hosts[1], 
361     [&in_on_exit, &returned_from_main, &in_catch_before_on_exit, &in_catch_after_on_exit]() {
362        assert_exit(true, 1);
363        try {
364          simgrid::s4u::Mailbox::by_name("mb")->get();
365        } catch (simgrid::NetworkFailureException const&) {
366          // Shouldn't get in here
367          in_catch_before_on_exit = not in_on_exit;
368          in_catch_after_on_exit = in_on_exit;
369        }
370        returned_from_main = true;
371      });
372
373   receiver->on_exit([&in_on_exit](bool) { in_on_exit = true; });
374
375   simgrid::s4u::ActorPtr sender = simgrid::s4u::Actor::create("sender", all_hosts[2], [&send_done]() {
376     assert_exit(false, 1);
377     bool got_exception = false;
378     try {
379       int data = 42;
380       simgrid::s4u::Mailbox::by_name("mb")->put(&data, 100000);
381     } catch (simgrid::NetworkFailureException const&) {
382       got_exception = true;
383     }
384     xbt_assert(got_exception);
385     send_done = true;
386   });
387
388   simgrid::s4u::this_actor::sleep_for(1);
389   receiver->get_host()->turn_off();
390   
391   // Note: If we don't sleep here, we don't "see" the bug
392   simgrid::s4u::this_actor::sleep_for(1);
393
394   xbt_assert(in_on_exit, 
395     "Receiver's on_exit function was never called");
396   xbt_assert(not in_catch_before_on_exit, 
397     "Receiver mistakenly went to catch clause (before the on_exit function was called)");
398   xbt_assert(not in_catch_after_on_exit, 
399     "Receiver mistakenly went to catch clause (after the on_exit function was called)");
400   xbt_assert(not returned_from_main, 
401     "Receiver returned from main normally even though its host was killed");
402   xbt_assert(send_done, "Sender killed somehow. It shouldn't");
403   receiver->get_host()->turn_on();
404 }
405
406 static void test_link_off_helper(double delay)
407 {
408   const double start = simgrid::s4u::Engine::get_clock();
409
410   simgrid::s4u::ActorPtr receiver = simgrid::s4u::Actor::create("receiver", all_hosts[1], [&start]() {
411     assert_exit(false, 9);
412     double milestone[5] = {0.5, 3.5, 4.5, 7.5, 9.0};
413     for (int i = 0; i < 5; i++)
414       milestone[i] += start;
415     for (int i = 0; i < 4; i++) {
416       simgrid::s4u::this_actor::sleep_until(milestone[i]);
417       try {
418         XBT_VERB("get(%c)", 'A' + i);
419         simgrid::s4u::Mailbox::by_name("mb")->get();
420         return;
421       } catch (simgrid::NetworkFailureException const&) {
422         XBT_VERB("got expected NetworkFailureException");
423       }
424     }
425     simgrid::s4u::this_actor::sleep_until(milestone[4]);
426   });
427
428   simgrid::s4u::ActorPtr sender = simgrid::s4u::Actor::create("sender", all_hosts[2], [&start]() {
429     assert_exit(false, 9);
430     int data            = 42;
431     double milestone[5] = {1.5, 2.5, 5.5, 6.5, 9.0};
432     for (int i = 0; i < 5; i++)
433       milestone[i] += start;
434     for (int i = 0; i < 2; i++) {
435       simgrid::s4u::this_actor::sleep_until(milestone[i]);
436       XBT_VERB("dsend(%c)", 'A' + i);
437       simgrid::s4u::Mailbox::by_name("mb")->put_init(&data, 100000)->detach();
438     }
439     for (int i = 2; i < 4; i++) {
440       simgrid::s4u::this_actor::sleep_until(milestone[i]);
441       try {
442         XBT_VERB("put(%c)", 'A' + i);
443         simgrid::s4u::Mailbox::by_name("mb")->put(&data, 100000);
444         return;
445       } catch (simgrid::NetworkFailureException const&) {
446         XBT_VERB("got expected NetworkFailureException");
447       }
448     }
449     simgrid::s4u::this_actor::sleep_until(milestone[4]);
450   });
451
452   for (int i = 0; i < 4; i++) {
453     XBT_VERB("##### %d / 4 #####", i + 1);
454     simgrid::s4u::this_actor::sleep_for(delay);
455     XBT_VERB("link off");
456     simgrid::s4u::Link::by_name("link1")->turn_off();
457     simgrid::s4u::this_actor::sleep_for(2.0 - delay);
458     XBT_VERB("link on");
459     simgrid::s4u::Link::by_name("link1")->turn_on();
460   }
461   simgrid::s4u::this_actor::sleep_for(1.5);
462 }
463
464 static void test_link_off_before_send_recv()
465 {
466   XBT_INFO("%s: try to communicate with communicating link turned off before start", __func__);
467   test_link_off_helper(0.0);
468 }
469 static void test_link_off_between_send_recv()
470 {
471   XBT_INFO("%s: try to communicate with communicating link turned off between send and receive", __func__);
472   test_link_off_helper(1.0);
473 }
474 static void test_link_off_during_transfer()
475 {
476   XBT_INFO("%s: try to communicate with communicating link turned off during transfer", __func__);
477   test_link_off_helper(2.0);
478 }
479
480 static void test_link_off_during_wait_any()
481 {
482   const double start = simgrid::s4u::Engine::get_clock();
483
484   simgrid::s4u::ActorPtr receiver = simgrid::s4u::Actor::create("receiver", all_hosts[1], [&start]() {
485     assert_exit(false, 2);
486     bool receiver_got_network_failure_execution = false;
487     bool receiver_got_base_execution = false;
488     int *data;
489     std::vector<simgrid::s4u::CommPtr> pending_comms;
490     simgrid::s4u::CommPtr comm = simgrid::s4u::Mailbox::by_name("mb")->get_async((void**)&data);
491     pending_comms.push_back(comm);
492     try {
493       simgrid::s4u::Comm::wait_any(&pending_comms);
494     } catch (simgrid::NetworkFailureException const&) {
495       XBT_VERB("got expected NetworkFailureException");
496       receiver_got_network_failure_execution = true;
497     } catch (simgrid::Exception const&) {
498       XBT_VERB("got unexpected base Exception");
499       receiver_got_base_execution = true;
500     }
501     xbt_assert(receiver_got_network_failure_execution, "The receiver should have gotten a NetworkFailureException");
502     xbt_assert(not receiver_got_network_failure_execution, "The receiver should not have gotten a base Exception");
503   });
504
505   simgrid::s4u::ActorPtr sender = simgrid::s4u::Actor::create("sender", all_hosts[2], [&start]() {
506     assert_exit(false, 2);
507     int data = 42;
508     bool sender_got_network_failure_execution = false;
509     bool sender_got_base_execution = false;
510     try {
511       simgrid::s4u::Mailbox::by_name("mb")->put(&data, 100000);
512     } catch (simgrid::NetworkFailureException const&) {
513       XBT_VERB("got expected NetworkFailureException");
514       sender_got_network_failure_execution = true;
515     } catch (simgrid::Exception const&) {
516       XBT_VERB("got unexpected base Exception");
517       sender_got_base_execution = true;
518     }
519     xbt_assert(sender_got_network_failure_execution, "The sender should have gotten a NetworkFailureException");
520     xbt_assert(not sender_got_network_failure_execution, "The sender should not have gotten a base Exception");
521   });
522
523     simgrid::s4u::this_actor::sleep_for(2.0);
524     XBT_VERB("link off");
525     simgrid::s4u::Link::by_name("link1")->turn_off();
526 }
527
528
529 /* We need an extra actor here, so that it can sleep until the end of each test */
530 static void main_dispatcher()
531 {
532   run_test("sleep", test_sleep);
533   run_test("sleep killed at start", test_sleep_kill_begin);
534   run_test("sleep killed in middle", test_sleep_kill_middle);
535   /* We cannot kill right at the end of the action because killer actors are always rescheduled to the end of the round
536    * to avoid that they exit before their victim dereferences their name */
537   run_test("sleep restarted at start", test_sleep_restart_begin);
538   run_test("sleep restarted in middle", test_sleep_restart_middle);
539   // run_test("sleep restarted at end", test_sleep_restart_end);
540
541   run_test("exec", test_exec);
542   run_test("exec killed at start", test_exec_kill_begin);
543   run_test("exec killed in middle", test_exec_kill_middle);
544   run_test("exec restarted at start", test_exec_restart_begin);
545   run_test("exec restarted in middle", test_exec_restart_middle);
546   run_test("exec restarted at end", test_exec_restart_end);
547
548   run_test("comm", test_comm);
549   run_test("comm dsend and quit (put before get)", test_comm_dsend_and_quit_put_before_get);
550   run_test("comm dsend and quit (get before put)", test_comm_dsend_and_quit_get_before_put);
551   run_test("comm kill sender", test_comm_killsend);
552
553   run_test("comm recv and kill", test_host_off_while_receive);
554   run_test("comm turn link off before send/recv", test_link_off_before_send_recv);
555   run_test("comm turn link off between send/recv", test_link_off_between_send_recv);
556   run_test("comm turn link off during transfer", test_link_off_during_transfer);
557 //  run_test("comm turn link off during wait_any", test_link_off_during_wait_any);
558 }
559
560 int main(int argc, char* argv[])
561 {
562   simgrid::s4u::Engine e(&argc, argv);
563
564   const char* platf = argv[1];
565   if (argc <= 1) {
566     XBT_WARN("No platform file provided. Using './testing_platform.xml'");
567     platf = "./testing_platform.xml";
568   }
569   e.load_platform(platf);
570
571   all_hosts = e.get_all_hosts();
572   simgrid::s4u::Actor::create("main_dispatcher", all_hosts[0], main_dispatcher);
573
574   e.run();
575
576   XBT_INFO("Simulation done");
577
578   return 0;
579 }