Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Indent the rest of the code (examples, buildtools, doc...) except for examples/SMPI...
[simgrid.git] / teshsuite / simdag / network / p2p / test_latency3.c
1 /* Latency tests                                                            */
2
3 /* Copyright (c) 2007, 2009, 2010. The SimGrid Team.
4  * All rights reserved.                                                     */
5
6 /* This program is free software; you can redistribute it and/or modify it
7  * under the terms of the license (GNU LGPL) which comes with this package. */
8
9 #include <stdio.h>
10 #include <stdlib.h>
11
12 #include "simdag/simdag.h"
13
14 /**
15  * bw and latency test 3
16  * same intention as test 2
17  * sending 2 x 1 bytes at the same time 
18  * this time in opposite direction
19  * 
20  */
21
22 int main(int argc, char **argv)
23 {
24   double time;
25   SD_task_t root;
26   SD_task_t task1;
27   SD_task_t task2;
28   double communication_amount1[] = { 0.0, 1.0, 0.0, 0.0 };
29   double communication_amount2[] = { 0.0, 0.0, 1.0, 0.0 };
30   double no_cost1[] = { 0.0 };
31   double no_cost[] = { 0.0, 0.0 };
32
33   SD_init(&argc, argv);
34   SD_create_environment(argv[1]);
35
36   root = SD_task_create("Root", NULL, 1.0);
37   task1 = SD_task_create("Comm 1", NULL, 1.0);
38   task2 = SD_task_create("Comm 2", NULL, 1.0);
39
40   SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost1,
41                    no_cost1, -1.0);
42   SD_task_schedule(task1, 2, SD_workstation_get_list(), no_cost,
43                    communication_amount1, -1.0);
44   SD_task_schedule(task2, 2, SD_workstation_get_list(), no_cost,
45                    communication_amount2, -1.0);
46
47   SD_task_dependency_add(NULL, NULL, root, task1);
48   SD_task_dependency_add(NULL, NULL, root, task2);
49
50   SD_simulate(-1.0);
51
52   time = SD_get_clock();
53
54   printf("%g\n", time);
55   fflush(stdout);
56
57   SD_task_destroy(root);
58   SD_task_destroy(task1);
59   SD_task_destroy(task2);
60
61   SD_exit();
62
63   return 0;
64 }