Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
A whole bunch of test units from Sascha and Fred. Many thanks, dudes
[simgrid.git] / teshsuite / simdag / network / p2p / test_latency3.c
1
2 /*
3  * SimDag
4  * Latency tests
5  * Copyright (C) 2007 
6  * Sascha Hunold, Frederic Suter
7  */
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   double time;
24   SD_task_t root;
25   SD_task_t task1;
26   SD_task_t task2;
27   double communication_amount1[] = { 0.0, 1.0, 0.0, 0.0 };
28   double communication_amount2[] = { 0.0, 0.0, 1.0, 0.0 };
29   double no_cost1[] = { 0.0 };
30   double no_cost[] = { 0.0, 0.0 };
31   
32   SD_init(&argc, argv);
33   SD_create_environment(argv[1]);
34
35   root  = SD_task_create("Root", NULL, 1.0);
36   task1 = SD_task_create("Comm 1", NULL, 1.0);
37   task2 = SD_task_create("Comm 2", NULL, 1.0);
38   
39   SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost1,
40                         no_cost1, -1.0);
41   SD_task_schedule(task1, 2, SD_workstation_get_list(), no_cost,
42                         communication_amount1, -1.0);
43   SD_task_schedule(task2, 2, SD_workstation_get_list(), no_cost,
44                         communication_amount2, -1.0);
45   
46   SD_task_dependency_add(NULL, NULL, root, task1);
47   SD_task_dependency_add(NULL, NULL, root, task2);  
48   
49   SD_simulate(-1.0);
50   
51   time = SD_get_clock();
52
53   printf("%g\n", time);
54   fflush(stdout);
55   
56   SD_task_destroy(root);
57   SD_task_destroy(task1);
58   SD_task_destroy(task2);
59   
60   SD_exit();
61   
62   return 0;
63 }
64