-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdgflySimulator.cc
More file actions
5311 lines (5046 loc) · 250 KB
/
Copy pathdgflySimulator.cc
File metadata and controls
5311 lines (5046 loc) · 250 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
FOGSim, simulator for interconnection networks.
http://fuentesp.github.io/fogsim/
Copyright (C) 2017 University of Cantabria
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "dgflySimulator.h"
#include "global.h"
#include "configurationFile.h"
#include "generator/generatorModule.h"
#include "generator/burstGenerator.h"
#include "generator/traceGenerator.h"
#include "generator/graph500Generator.h"
#include "generator/stencilGenerator.h"
#include "switch/ioqSwitchModule.h"
#include <math.h>
#include <sstream>
#include <iomanip>
#include <string>
#include <cmath>
#include <tuple>
#include <vector>
#include <fstream>
#include <algorithm>
using namespace std;
int module(int a, int b) {
int c;
c = a % int(b);
if (c < 0) {
c = c + b;
}
return (c);
}
bool parity(int a, int b) {
bool p = (((a % 2 == 0) && (b % 2 == 0)) || ((a % 2 != 0) && (b % 2 != 0)));
return (p);
}
int main(int argc, char *argv[]) {
int i, j;
/* Print back command from prompt; useful for cluster use */
for (i = 0; i < argc; i++) {
cout << argv[i] << " ";
}
cout << endl;
/* Read parameters in config file */
readConfiguration(argc, argv);
srand(g_seed);
g_reng.seed(g_seed);
/* Open output file */
g_output_file.open(g_output_file_name, ios::out);
if (!g_output_file) {
cerr << "Can't open the output file" << g_output_file_name << endl;
exit(-1);
}
g_output_file.close();
createNetwork();
#if DEBUG
cout << "Network has been created" << endl;
#endif
/* Read/translate trace-related files */
if (g_traffic == TRACE) {
for (i = 0; i < g_num_traces; i++) {
/* read_trace() receives a vector of trace instances to
* load. For first initialization, all trace instances
* must be load at once. */
translate_pcf_file(i);
vector<int> instances;
for (j = 0; j < g_trace_instances[i]; j++)
instances.push_back(j);
read_trace(i, instances);
}
}
/* Run simulation */
action();
/* Write results into output file */
for (i = 0; i < g_number_switches; i++) {
if (g_switches_list[i]->packetsInj > g_max_injection_packets_per_sw) {
g_max_injection_packets_per_sw = g_switches_list[i]->packetsInj;
g_sw_with_max_injection_pkts = g_switches_list[i]->label;
}
if (g_switches_list[i]->cnmPacketsInj > g_max_injection_cnmPackets_per_sw) {
g_max_injection_cnmPackets_per_sw = g_switches_list[i]->cnmPacketsInj;
g_sw_with_max_injection_cnmPkts = g_switches_list[i]->label;
}
}
g_min_injection_packets_per_sw = g_max_injection_packets_per_sw;
g_min_injection_cnmPackets_per_sw = g_max_injection_cnmPackets_per_sw;
for (i = 0; i < g_number_switches; i++) {
if (g_switches_list[i]->packetsInj < g_min_injection_packets_per_sw) {
g_min_injection_packets_per_sw = g_switches_list[i]->packetsInj;
g_sw_with_min_injection_pkts = g_switches_list[i]->label;
}
if (g_switches_list[i]->cnmPacketsInj < g_min_injection_cnmPackets_per_sw) {
g_min_injection_cnmPackets_per_sw = g_switches_list[i]->cnmPacketsInj;
g_sw_with_min_injection_cnmPkts = g_switches_list[i]->label;
}
}
assert(g_min_injection_packets_per_sw <= g_max_injection_packets_per_sw);
assert(g_min_injection_cnmPackets_per_sw <= g_max_injection_cnmPackets_per_sw);
cout << "Write output" << endl;
writeOutput();
if (g_print_hists) {
writeLatencyHistogram(g_output_file_name);
writeHopsHistogram(g_output_file_name);
writeGeneratorsInjectionProbability(g_output_file_name);
if (g_congestion_management == QCNSW) if (g_qcn_transient_stats) {
writeQcnPortEnruteMinProbability(g_output_file_name);
writeQcnPortCongestionValue(g_output_file_name);
}
}
if (g_transient_stats) writeTransientOutput(g_output_file_name);
if (g_traffic == RANDOMPERMUTATION || g_traffic == RECIPROCALRANDOMPERMUTATION)
writeDestMap(g_output_file_name);
if (g_print_hists && (g_routing == ACOR || g_routing == PB_ACOR)) {
writeAcorGroup0SwsPacketsBlocked(g_output_file_name);
if (g_acor_state_management == SWITCHCGCSRS || g_acor_state_management == SWITCHCGRS ||
g_acor_state_management == SWITCHCSRS)
writeAcorGroup0SwsStatus(g_output_file_name);
}
if (g_print_hists && (g_routing == TPR || g_routing == LITPR))
writeTPRstatistics(g_output_file_name);
freeMemory();
cout << "Simulation finished" << endl;
return 0;
}
/*
* Reads config parameters from config file.
* - Asserted parameters are required.
* -'If-ed' parameters are optional (see default value in global.cc)
*/
void readConfiguration(int argc, char *argv[]) {
char * filename = argv[1];
int i, j, total_trace_nodes;
string value;
vector < string > list_values;
ConfigFile config;
TrafficType auxTraffic;
/* Open configuration file */
if (config.LoadConfig(filename) < 0) {
cerr << "Can't read the configuration file: " << filename << endl;
exit(-1);
}
/* Config file parameters are loaded up in a map, to be read.
* We check for parameters in the command line, and overwrite
* those in config file if necessary. */
for (i = 2; i < argc; i++) {
if (config.updateKeyValue("CONFIG", argv[i]) != 0) {
cerr << endl << "Argument " << argv[i] << " doesn't follow prompt convention! Remember that first argument"
" must be output file, and following arguments must be preceded by argument name and"
" '=' symbol [no space in between]" << endl;
exit(-1);
}
}
/* READ PARAMETERS */
/* Necessary parameters (must be present in ALL cases) */
assert(config.getKeyValue("CONFIG", "P", value) == 0);
g_p_computing_nodes_per_router = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "A", value) == 0);
g_a_routers_per_group = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "H", value) == 0);
g_h_global_ports_per_router = atoi(value.c_str());
g_number_switches = (g_a_routers_per_group * g_h_global_ports_per_router + 1) * g_a_routers_per_group;
g_number_generators = g_number_switches * g_p_computing_nodes_per_router;
assert(config.getKeyValue("CONFIG", "MaxCycles", value) == 0);
g_max_cycles = atoi(value.c_str());
if (config.getKeyValue("CONFIG", "WarmupCycles", value) == 0)
g_warmup_cycles = atoi(value.c_str());
else
g_warmup_cycles = g_max_cycles;
if (config.getKeyValue("CONFIG", "PrintCycles", value) == 0) g_print_cycles = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "ArbiterIterations", value) == 0);
g_allocator_iterations = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "InjectionQueueLength", value) == 0);
g_injection_queue_length = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "LocalQueueLength", value) == 0);
g_local_queue_length = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "GlobalQueueLength", value) == 0);
g_global_queue_length = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "Probability", value) == 0);
g_injection_probability = atof(value.c_str());
assert(config.getKeyValue("CONFIG", "Seed", value) == 0);
g_seed = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "OutputFileName", value) == 0);
g_output_file_name = new char[value.length() + 1];
strcpy(g_output_file_name, value.c_str());
assert(config.getKeyValue("CONFIG", "LocalLinkTransmissionDelay", value) == 0);
g_local_link_transmission_delay = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "GlobalLinkTransmissionDelay", value) == 0);
g_global_link_transmission_delay = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "InjectionDelay", value) == 0);
g_injection_delay = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "PacketSize", value) == 0);
g_packet_size = atoi(value.c_str());
assert(g_packet_size > 0);
assert(config.getKeyValue("CONFIG", "FlitSize", value) == 0);
g_flit_size = atoi(value.c_str());
assert(g_flit_size > 0);
g_flits_per_packet = g_packet_size / g_flit_size;
assert(g_flits_per_packet % 1 == 0);
assert(config.getKeyValue("CONFIG", "GlobalChannels", value) == 0);
g_global_link_channels = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "LocalLinkChannels", value) == 0);
g_local_link_channels = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "InjectionChannels", value) == 0);
g_injection_channels = atoi(value.c_str());
if (config.getKeyValue("CONFIG", "VcInjectionPolicy", value) == 0) {
readVcInj(value.c_str(), &g_vc_injection);
}
if (config.getKeyValue("CONFIG", "VcUsage", value) == 0) {
readVcUsage(value.c_str(), &g_vc_usage);
}
g_channels = (g_injection_channels > g_local_link_channels) ? g_injection_channels : g_local_link_channels;
if (g_global_link_channels > g_channels) g_channels = g_global_link_channels;
if (g_vc_usage == FLEXIBLE || g_vc_usage == TBFLEX) {
g_channels = g_local_link_channels + g_global_link_channels;
if (config.getKeyValue("CONFIG", "VcAllocation", value) == 0) readVcAlloc(value.c_str(), &g_vc_alloc);
}
assert(config.getKeyValue("CONFIG", "PalmTreeConfiguration", value) == 0);
g_palm_tree_configuration = atoi(value.c_str());
if (config.getKeyValue("CONFIG", "InputArbiter", value) == 0) {
readArbiterType(value.c_str(), &g_input_arbiter_type);
}
if (config.getKeyValue("CONFIG", "OutputArbiter", value) == 0) {
readArbiterType(value.c_str(), &g_output_arbiter_type);
}
if (config.getKeyValue("CONFIG", "TransitPriority", value) == 0) {
cerr
<< "WARNING: deprecated parameter: TransitPriority. This parameter should be replaced by a LRS/PrioLRS OutputArbiter parameter."
<< endl;
if (atoi(value.c_str()) == 1) {
g_output_arbiter_type = PrioLRS;
} else {
g_output_arbiter_type = LRS;
}
}
/* Switch type */
if (config.getKeyValue("CONFIG", "Switch", value) == 0) {
readSwitchType(value.c_str(), &g_switch_type);
if (g_switch_type == IOQ_SW) {
assert(config.getKeyValue("CONFIG", "XbarDelay", value) == 0);
g_xbar_delay = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "OutQueueLength", value) == 0);
g_out_queue_length = atoi(value.c_str());
if (config.getKeyValue("CONFIG", "InternalSpeedup", value) == 0) {
g_internal_speedup = strtod(value.c_str(), NULL);
}
if (config.getKeyValue("CONFIG", "NumberSegregatedTrafficFlows", value) == 0) {
g_segregated_flows = atoi(value.c_str());
assert(g_segregated_flows >= 1 && g_segregated_flows < 3); /* Number of flows
needs to be equal or greater than 1; currently only up to 2 flows are supported */
}
}
}
/* Buffer type */
if (config.getKeyValue("CONFIG", "Buffer", value) == 0) {
readBufferType(value.c_str(), &g_buffer_type);
if (g_buffer_type == DYNAMIC) {
assert(config.getKeyValue("CONFIG", "ReservedBufferLocal", value) == 0);
g_local_queue_reserved = atoi(value.c_str());
if (g_local_queue_reserved > (g_local_queue_length / g_flit_size / g_local_link_channels))
cerr << "ERROR! with DYNAMIC buffers; for a local link buffer size of " << g_local_queue_length
<< " phits and " << g_local_link_channels << " vcs, maximum reserved memory must be <= "
<< (g_local_queue_length / g_flit_size / g_local_link_channels) << " pkts (input value: "
<< g_local_queue_reserved << ")" << endl;
assert(g_local_queue_reserved <= (g_local_queue_length / g_flit_size / g_local_link_channels));
assert(config.getKeyValue("CONFIG", "ReservedBufferGlobal", value) == 0);
g_global_queue_reserved = atoi(value.c_str());
if (g_global_queue_reserved > (g_global_queue_length / g_flit_size / g_global_link_channels))
cerr << "ERROR! with DYNAMIC buffers; for a local link buffer size of " << g_global_queue_length
<< " phits and " << g_global_link_channels << " vcs, maximum reserved memory must be <= "
<< (g_global_queue_length / g_flit_size / g_global_link_channels) << " pkts (input value: "
<< g_global_queue_reserved << ")" << endl;
assert(g_global_queue_reserved <= (g_global_queue_length / g_flit_size / g_global_link_channels));
}
}
/* Class of service levels */
if (config.getKeyValue("CONFIG", "CosLevels", value) == 0) {
g_cos_levels = atoi(value.c_str());
assert(
g_cos_levels > 0
&& ((g_congestion_management != QCNSW && g_cos_levels < 9)
|| (g_congestion_management == QCNSW && g_cos_levels < 8)));
}
/* Traffic pattern */
assert(config.getKeyValue("CONFIG", "Traffic", value) == 0);
readTrafficPattern(value.c_str(), &g_traffic);
switch (g_traffic) {
case UN_RCTV:
g_reactive_traffic = true;
g_traffic = UN;
break;
case ADV_RANDOM_NODE_RCTV:
g_reactive_traffic = true;
g_traffic = ADV_RANDOM_NODE;
break;
case BURSTY_UN_RCTV:
g_reactive_traffic = true;
g_traffic = BURSTY_UN;
break;
case HOTREGION_RCTV:
g_reactive_traffic = true;
g_traffic = HOTREGION;
break;
case RANDOMPERMUTATION_RCTV:
g_reactive_traffic = true;
g_traffic = RANDOMPERMUTATION;
break;
case RECIPROCALRANDOMPERMUTATION_RCTV:
g_reactive_traffic = true;
g_traffic = RECIPROCALRANDOMPERMUTATION;
break;
// Only use this switch for the reactive traffic types
}
/* Reactive traffic patterns need to have initial injection probability halved because
* every petition triggers a response packet, effectively doubling the amount of communications.
* Also the VCs must be evenly split between the two ways, making up for an even number of
* VCs in local and global links. */
if (g_reactive_traffic) {
g_injection_probability /= 2;
assert(g_routing != OFAR); /* Currently OFAR does not support reactive traffic due to the use of VCs that is hard-coded into the OFAR class */
/* With Flexible VC usage, we need to set the number of VCs reserved for the responses */
if (g_vc_usage == FLEXIBLE || g_vc_usage == TBFLEX) {
assert(config.getKeyValue("CONFIG", "LocalResChannels", value) == 0);
g_local_res_channels = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "GlobalResChannels", value) == 0);
g_global_res_channels = atoi(value.c_str());
} else {
assert((g_local_link_channels % 2) == 0);
assert((g_global_link_channels % 2) == 0);
}
if (config.getKeyValue("CONFIG", "MaxPetitionsOnFlight", value) == 0) {
g_max_petitions_on_flight = atoi(value.c_str());
assert(g_max_petitions_on_flight > 0);
}
}
// Auxiliar variables for cluster traffic pattern initialization
int sum=0, trafficPercentagesCount=0, trafficPatternsCount=0, trafficAdvDistancesCount=0, aux=0;
switch (g_traffic) {
case ADV:
case ADV_RANDOM_NODE:
assert(config.getKeyValue("CONFIG", "AdvTrafficDistance", value) == 0);
g_adv_traffic_distance = atoi(value.c_str());
assert(g_adv_traffic_distance != 0);
break;
case ADV_LOCAL:
assert(config.getKeyValue("CONFIG", "AdvTrafficLocalDistance", value) == 0);
g_adv_traffic_distance = atoi(value.c_str());
assert(g_adv_traffic_distance != 0);
break;
case ADVc:
break;
case oADV:
assert(config.getKeyValue("CONFIG", "AdvTrafficDistance", value) == 0);
g_adv_traffic_distance = atoi(value.c_str());
break;
case MIX:
if (config.getKeyValue("CONFIG", "randomTrafficPercent", value) == 0) {
cerr
<< "WARNING: deprecated parameter: randomTrafficPercent. MIX traffic is now a mix of any combination of different traffic patterns."
<< endl;
g_phase_traffic_percent.push_back(atoi(value.c_str()));
assert(config.getKeyValue("CONFIG", "localAdvTrafficPercent", value) == 0);
g_phase_traffic_percent.push_back(atoi(value.c_str()));
assert(config.getKeyValue("CONFIG", "globalAdvTrafficPercent", value) == 0);
g_phase_traffic_percent.push_back(atoi(value.c_str()));
g_phase_traffic_type.push_back(UN);
g_phase_traffic_type.push_back(ADV_LOCAL);
g_phase_traffic_type.push_back(ADV_RANDOM_NODE);
g_phase_traffic_adv_dist.push_back(-1);
assert(config.getKeyValue("CONFIG", "AdvTrafficDistance", value) == 0);
g_phase_traffic_adv_dist.push_back(atoi(value.c_str()));
assert(config.getKeyValue("CONFIG", "AdvTrafficLocalDistance", value) == 0);
g_phase_traffic_adv_dist.push_back(atoi(value.c_str()));
} else {
assert(config.getListValues("CONFIG", "mixTrafficPatterns", list_values) == 0);
for (i = 0; i < list_values.size(); i++) {
readTrafficPattern(list_values[i].c_str(), &auxTraffic);
g_phase_traffic_type.push_back(auxTraffic);
}
assert(config.getListValues("CONFIG", "mixTrafficPercentages", list_values) == 0);
for (i = 0; i < list_values.size(); i++)
g_phase_traffic_percent.push_back(atoi(list_values[i].c_str()));
assert(config.getListValues("CONFIG", "mixAdvTrafficDistances", list_values) == 0);
for (i = 0; i < list_values.size(); i++) {
g_phase_traffic_adv_dist.push_back(atoi(list_values[i].c_str()));
assert(g_phase_traffic_adv_dist[i] != 0);
}
}
/* NEED to generate a list of boundaries for each traffic pattern, based on the
* percentage specified for each; e.g., if you have 20% UN, 50% ADV1, and 30% ADVc,
* the boundaries should be 20, 70, 100. Also, it should be checked that the
* addition of percentages adds up to 100. Otherwise, throw an error (it does not
* make sense to only have 80% in total. Another option is to throw a warning and
* scale up (if total is 90%, multiply each boundary by 100/90).*/
for (int i = 1; i < g_phase_traffic_percent.size(); i++)
g_phase_traffic_percent[i] += g_phase_traffic_percent[i - 1];
assert(g_phase_traffic_percent.back() == 100);
break;
case CLUSTER:
assert(config.getListValues("CONFIG", "clusterTrafficPercentages", list_values) == 0);
for (i = 0; i < list_values.size(); i++) {
g_phase_traffic_percent.push_back(atoi(list_values[i].c_str()));
sum += g_phase_traffic_percent.back();
trafficPercentagesCount++;
}
assert(sum == 100);
assert(config.getListValues("CONFIG", "clusterTrafficPatterns", list_values) == 0);
for (i = 0; i < list_values.size(); i++) {
readTrafficPattern(list_values[i].c_str(), &auxTraffic);
g_phase_traffic_type.push_back(auxTraffic);
trafficPatternsCount++;
}
assert(config.getListValues("CONFIG", "clusterAdvTrafficDistances", list_values) == 0);
for (i = 0; i < list_values.size(); i++) {
g_phase_traffic_adv_dist.push_back(atoi(list_values[i].c_str()));
assert(g_phase_traffic_adv_dist[i] != 0);
trafficAdvDistancesCount++;
}
assert(trafficPercentagesCount==trafficPatternsCount);
assert(trafficPercentagesCount==trafficAdvDistancesCount);
// Set the percentages in order
for(i = 1; i < g_phase_traffic_percent.size(); i++) {
if(g_phase_traffic_percent[i-1] < g_phase_traffic_percent[i]) {
aux = g_phase_traffic_percent[i];
g_phase_traffic_percent[i] = g_phase_traffic_percent[i-1];
g_phase_traffic_percent[i-1] = aux;
aux = g_phase_traffic_type[i];
g_phase_traffic_type[i] = g_phase_traffic_type[i-1];
g_phase_traffic_type[i-1] = (TrafficType) aux;
aux = g_phase_traffic_adv_dist[i];
g_phase_traffic_adv_dist[i] = g_phase_traffic_adv_dist[i-1];
g_phase_traffic_adv_dist[i-1] = aux;
i=0;
}
}
// Check distribution of nodes
aux=0;
for(i = 0; i < g_phase_traffic_percent.size() - 1; i++) {
aux += nearbyint(g_phase_traffic_percent[i] * (float)g_number_generators/100);
assert(aux < g_number_generators);
}
if (config.getKeyValue("CONFIG", "clusterRandomDistribution", value) == 0)
g_cluster_random = atoi(value.c_str());
if (config.getKeyValue("CONFIG", "clusterInterleavedDistribution", value) == 0)
g_cluster_interleaved = atoi(value.c_str());
if (g_cluster_interleaved) {
assert(trafficPercentagesCount == 2);
assert(!g_cluster_random);
}
if (config.getKeyValue("CONFIG", "clusterDestinations", value) == 0)
g_cluster_destinations = atoi(value.c_str());
break;
case TRANSIENT:
g_transient_stats = true;
if (config.getKeyValue("CONFIG", "AdvTrafficDistance", value) == 0) {
cerr
<< "WARNING: deprecated parameters: AdvTrafficDistance/transientTrafficNextDist. These parameters should be entries in a transientAdvTrafficDistances list."
<< endl;
g_phase_traffic_adv_dist.push_back(atoi(value.c_str()));
assert(config.getKeyValue("CONFIG", "transientTrafficNextDist", value) == 0);
g_phase_traffic_adv_dist.push_back(atoi(value.c_str()));
} else {
assert(config.getListValues("CONFIG", "transientAdvTrafficDistances", list_values) == 0);
for (i = 0; i < list_values.size(); i++)
g_phase_traffic_adv_dist.push_back(atoi(value.c_str()));
}
if (config.getKeyValue("CONFIG", "transientTrafficFirstPattern", value) == 0) {
cerr
<< "WARNING: deprecated parameters: transientTrafficFirstPattern/transientTrafficSecondPattern. These parameters should be replaced by a transientTrafficPatterns list."
<< endl;
readTrafficPattern(value.c_str(), &auxTraffic);
g_phase_traffic_type.push_back(auxTraffic);
assert(config.getKeyValue("CONFIG", "transientTrafficSecondPattern", value) == 0);
readTrafficPattern(value.c_str(), &auxTraffic);
g_phase_traffic_type.push_back(auxTraffic);
} else {
assert(config.getListValues("CONFIG", "transientTrafficPatterns", list_values) == 0);
for (i = 0; i < list_values.size(); i++) {
readTrafficPattern(list_values[i].c_str(), &auxTraffic);
g_phase_traffic_type.push_back(auxTraffic);
}
}
//TODO: adapt transient traffic to be able to perform multiple transitions
if (config.getKeyValue("CONFIG", "transientTrafficFirstProbability", value) == 0)
g_phase_traffic_probability[0] = atof(value.c_str());
else
g_phase_traffic_probability[0] = g_injection_probability;
if (config.getKeyValue("CONFIG", "transientTrafficSecondProbability", value) == 0)
g_phase_traffic_probability[1] = atof(value.c_str());
else
g_phase_traffic_probability[1] = g_injection_probability;
assert(config.getKeyValue("CONFIG", "transientTrafficCycle", value) == 0);
g_transient_traffic_cycle = atoi(value.c_str());
break;
case ALL2ALL:
g_injection_probability = 100;
g_warmup_cycles = 0;
g_max_cycles = 10000000;
assert(config.getKeyValue("CONFIG", "phases", value) == 0);
g_phases = atoi(value.c_str());
assert(g_phases > 0);
if(config.getKeyValue("CONFIG", "AllToAllType", value) == 0) {
readAllToAllType(value.c_str(), &g_all2all_type);
}
g_single_burst_length = (g_number_generators - 1) * g_phases * g_flits_per_packet;
break;
case SINGLE_BURST:
g_injection_probability = 100;
g_warmup_cycles = 0;
g_max_cycles = 1000000;
assert(config.getKeyValue("CONFIG", "burstLength", value) == 0);
g_single_burst_length = atoi(value.c_str());
g_single_burst_length = g_single_burst_length * g_flits_per_packet;
if (config.getKeyValue("CONFIG", "burstTrafficAdvDist1", value) == 0) {
cerr
<< "WARNING: deprecated parameters: burstTrafficAdvDist1, 2 & 3. These parameters are replaced by entries in the burstTrafficAdvDistances list."
<< endl;
g_phase_traffic_adv_dist.push_back(atoi(value.c_str()));
assert(config.getKeyValue("CONFIG", "burstTrafficAdvDist2", value) == 0);
g_phase_traffic_adv_dist.push_back(atoi(value.c_str()));
assert(config.getKeyValue("CONFIG", "burstTrafficAdvDist3", value) == 0);
g_phase_traffic_adv_dist.push_back(atoi(value.c_str()));
} else {
assert(config.getListValues("CONFIG", "burstTrafficAdvDistances", list_values) == 0);
for (i = 0; i < list_values.size(); i++)
g_phase_traffic_adv_dist.push_back(atoi(list_values[i].c_str()));
}
if (config.getKeyValue("CONFIG", "burstTrafficType1", value) == 0) {
cerr
<< "WARNING: deprecated parameters: burstTrafficType1, 2 & 3. These parameters are replaced by a burstTrafficTypes list."
<< endl;
readTrafficPattern(list_values[i].c_str(), &auxTraffic);
g_phase_traffic_type.push_back(auxTraffic);
assert(config.getKeyValue("CONFIG", "burstTrafficType2", value) == 0);
readTrafficPattern(list_values[i].c_str(), &auxTraffic);
g_phase_traffic_type.push_back(auxTraffic);
assert(config.getKeyValue("CONFIG", "burstTrafficType3", value) == 0);
readTrafficPattern(list_values[i].c_str(), &auxTraffic);
g_phase_traffic_type.push_back(auxTraffic);
} else {
assert(config.getListValues("CONFIG", "burstTrafficTypes", list_values) == 0);
for (i = 0; i < list_values.size(); i++) {
readTrafficPattern(list_values[i].c_str(), &auxTraffic);
g_phase_traffic_type.push_back(auxTraffic);
}
}
if (config.getKeyValue("CONFIG", "burstTrafficTypePercent1", value) == 0) {
cerr
<< "WARNING: deprecated parameter: burstTrafficTypePercent1, 2 & 3. These parameters should be replaced by the burstTrafficTypePercentage list."
<< endl;
g_phase_traffic_percent.push_back(atoi(value.c_str()));
assert(config.getKeyValue("CONFIG", "burstTrafficTypePercent2", value) == 0);
g_phase_traffic_percent.push_back(atoi(value.c_str()));
assert(config.getKeyValue("CONFIG", "burstTrafficTypePercent3", value) == 0);
g_phase_traffic_percent.push_back(atoi(value.c_str()));
} else {
assert(config.getListValues("CONFIG", "burstTrafficTypePercentage", list_values) == 0);
for (i = 0; i < list_values.size(); i++) {
g_phase_traffic_percent.push_back(atoi(list_values[i].c_str()));
}
}
for (int i = 1; i < g_phase_traffic_percent.size(); i++)
g_phase_traffic_percent[i] += g_phase_traffic_percent[i - 1];
assert(g_phase_traffic_percent.back() == 100);
break;
case BURSTY_UN:
assert(config.getKeyValue("CONFIG", "avgBurstLength", value) == 0);
g_bursty_avg_length = atoi(value.c_str());
break;
case GRAPH500:
assert(g_deadlock_avoidance == DALLY && g_flit_size == g_packet_size);
assert(config.getKeyValue("CONFIG", "GraphCoalescingSize", value) == 0);
g_graph_coalescing_size = atoi(value.c_str());
if (config.getKeyValue("CONFIG", "GraphQueryTime", value) == 0) {
g_graph_query_time = atof(value.c_str());
g_injection_probability = (100.0 * g_flit_size) / (g_graph_query_time * g_graph_coalescing_size);
} else
g_graph_query_time = (100.0 * g_flit_size) / (g_injection_probability * g_graph_coalescing_size);
if (config.getListValues("CONFIG", "GraphNodesCapMod", list_values) == 0) {
assert(int(list_values.size()) <= g_number_generators);
for (i = 0; i < list_values.size(); i++) {
assert(atoi(list_values[i].c_str()) < g_number_generators);
g_graph_nodes_cap_mod.push_back(atoi(list_values[i].c_str()));
}
} else if (config.getKeyValue("CONFIG", "GraphNodesCapMod", value) == 0) {
assert(atoi(value.c_str()) < g_number_generators);
g_graph_nodes_cap_mod.push_back(atoi(value.c_str()));
}
if (g_graph_nodes_cap_mod.size() > 0) {
assert(config.getKeyValue("CONFIG", "GraphCapModFactor", value) == 0);
g_graph_cap_mod_factor = atoi(value.c_str());
assert(g_graph_cap_mod_factor > 0 && g_graph_cap_mod_factor <= 200);
}
assert(config.getKeyValue("CONFIG", "GraphScale", value) == 0);
g_graph_scale = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "GraphEdgefactor", value) == 0);
g_graph_edgefactor = atoi(value.c_str());
if (config.getKeyValue("CONFIG", "GraphMaxLevels", value) == 0) g_graph_max_levels = atoi(value.c_str());
/* Reused variables from trace generators: if specified, use the number of
* processes used to run the benchmark and the number of benchmark instances.
* By default consider that the benchmark execution employs the whole system. */
g_num_traces = 1;
if (config.getKeyValue("CONFIG", "GraphProcesses", value) == 0)
g_trace_nodes.push_back(atol(value.c_str()));
else
g_trace_nodes.push_back(g_number_generators);
if (config.getKeyValue("CONFIG", "GraphInstances", value) == 0)
g_trace_instances.push_back(atoi(value.c_str()));
else
g_trace_instances.push_back(1);
assert(g_trace_nodes[0] * g_trace_instances[0] <= g_number_generators);
/* 2 ways of specifying benchmark layout: through a trace map
* file, and selecting a preset trace distribution */
if (config.getKeyValue("CONFIG", "TraceMap", value) == 0) {
readTraceMap(value.c_str());
} else {
if (config.checkSection("TRACE_MAP")) {
readTraceMap(filename);
} else {
if (config.getKeyValue("CONFIG", "TraceDistribution", value) == 0)
readTraceDistribution(value.c_str(), &g_trace_distribution);
assert(g_trace_instances.size() != 0); // Sanity check; value was previously collected
buildTraceMap();
}
}
if (config.getKeyValue("CONFIG", "GraphRootDegree", value) == 0)
for (i = 0; i < g_trace_instances[0]; i++)
g_graph_root_degree.push_back(atoi(value.c_str()));
else {
/* If a root vertex connectivity is not provided, determine it through a lognormal distribution */
lognormal_distribution<float> g_graph_lognormal(
log(pow(0.3604, g_graph_scale)) + 1.0661704 * g_graph_scale, 0.079313065 * g_graph_scale);
for (i = 0; i < g_trace_instances[0]; i++)
g_graph_root_degree.push_back(ceil(g_graph_lognormal(g_reng)));
}
for (i = 0; i < g_trace_instances[0]; i++) {
g_graph_tree_level.push_back(0);
/* Choose a random node of the current instance as root */
g_graph_root_node.push_back(
g_trace_2_gen_map[0][rand() / (int) (((unsigned) RAND_MAX + 1) / (g_trace_nodes[0]))][i]);
/* Upper bound of the p2p queries */
g_graph_queries_remain.push_back(
pow(2, g_graph_scale + 1) * g_graph_edgefactor * ((g_trace_nodes[0] - 1.0) / g_trace_nodes[0]));
g_graph_queries_rem_minus_means.push_back(
g_graph_queries_remain[i]
- ceil(g_graph_root_degree[i] * (g_trace_nodes[0] - 1.0) / g_trace_nodes[0]));
}
#if DEBUG /* These statistics are not computed in a release compilation because they eat too much memory */
g_graph_p2pmess_node2node = new long long **[g_graph_max_levels];
for (int l = 0; l < g_graph_max_levels; l++) {
g_graph_p2pmess_node2node[l] = new long long *[g_number_generators];
for (i = 0; i < g_number_generators; i++) {
g_graph_p2pmess_node2node[l][i] = new long long[g_number_generators];
for (int z = 0; z < g_number_generators; z++)
g_graph_p2pmess_node2node[l][i][z] = 0;
}
}
#endif
break;
case STENCIL:
assert(g_deadlock_avoidance == DALLY && g_flit_size == g_packet_size);
/* Reused variables from trace generators: if specified, use the number of
* processes used to run the benchmark and the number of benchmark instances.
* By default consider that the benchmark execution employs the whole system. */
g_num_traces = 1;
if (config.getKeyValue("CONFIG", "StencilProcesses", value) == 0)
g_trace_nodes.push_back(atol(value.c_str()));
else
g_trace_nodes.push_back(g_number_generators);
if (config.getKeyValue("CONFIG", "StencilInstances", value) == 0)
g_trace_instances.push_back(atoi(value.c_str()));
else
g_trace_instances.push_back(1);
assert(g_trace_nodes[0] * g_trace_instances[0] <= g_number_generators);
if (config.getKeyValue("CONFIG", "TraceDistribution", value) == 0)
readTraceDistribution(value.c_str(), &g_trace_distribution);
// else: CONSECUTIVE
if (g_trace_instances[0] == 1 && g_trace_distribution == INTERLEAVED)
cerr << "Warning: Interleaved distribution with one instance is the same as CONSECUTIVE" << endl;
if (config.getKeyValue("CONFIG", "StencilSendOrder", value) == 0)
readStencilSendOrder(value.c_str(), &g_stencil_send_order);
// else: ASC
if (config.getKeyValue("CONFIG", "StencilIterations", value) == 0)
g_stencil_iterations = atoi(value.c_str());
if (config.getKeyValue("CONFIG", "StencilComputeDelay", value) == 0)
g_stencil_compute_delay = atoi(value.c_str());
// Map INSTANCE,NODE to GENERATOR
{
int i, j, instance, node, generator;
string fileName(g_output_file_name);
ofstream traceMapFile;
assert(g_trace_nodes.size() == 1 && g_trace_instances.size() == 1);
/* Open trace map file and write section header */
fileName.append(".traceMap");
traceMapFile.open(fileName.c_str(), ios::out);
traceMapFile << "[TRACE_MAP_STENCIL]" << endl;
/* Initiate trace2gen map */
for (i = 0; i < g_trace_instances[0]; i++) {
vector < vector<int> > aux; // Aux vector
for (j = 0; j < g_trace_nodes[0]; j++) {
aux.push_back(vector<int>()); // Add an empty vector (will be later increased by every gen mapped to the trace node)
}
g_trace_2_gen_map.push_back(aux);
}
/* Associate every trace node with a generator */
for (instance = 0; instance < g_trace_instances[0]; instance++) {
for (node = 0; node < g_trace_nodes[0]; node++) {
switch (g_trace_distribution) {
case CONSECUTIVE:
generator = node + instance * g_trace_nodes[0];
break;
case INTERLEAVED:
generator = instance + node * g_trace_instances[0];
break;
case RANDOM:
do
generator = rand() % g_number_generators;
while (g_gen_2_trace_map.count(generator) == 1);
break;
default:
assert(false);
break;
}
assert(generator >= 0 && generator < g_number_generators); // Sanity check
g_trace_2_gen_map[instance][node].push_back(generator);
assert(g_gen_2_trace_map.insert(pair<int, TraceNodeId>(generator, { instance, node })).second == true);
}
}
/* Save trace map to file */
for (generator = 0; generator < g_number_generators; generator++) {
assert(g_gen_2_trace_map.count(generator) <= 1);
if (g_gen_2_trace_map.count(generator) > 0) {
traceMapFile << generator << "=" << g_gen_2_trace_map[generator].trace_id << ","
<< g_gen_2_trace_map[generator].trace_node << endl;
}
}
traceMapFile.close();
}
// Read stencil file
assert(config.getKeyValue("CONFIG", "StencilMatrixFile", value) == 0);
g_stencil_matrix_file = value.c_str();
break;
case TRACE:
/* TRACE simulations need to be REDEFINED!! to use a map of assignments */
assert(config.getKeyValue("CONFIG", "numTraces", value) == 0);
g_num_traces = atoi(value.c_str());
assert(g_num_traces > 0); //Current code doesn't support more than two trace files
/* Depending on the number of different traces employed, one or other function
* will be used to determine variable values. */
if (g_num_traces == 1) {
assert(config.getKeyValue("CONFIG", "trcFile", value) == 0);
g_trace_file.push_back(value);
assert(config.getKeyValue("CONFIG", "trace_nodes", value) == 0);
g_trace_nodes.push_back(atol(value.c_str()));
assert(config.getKeyValue("CONFIG", "pcfFile", value) == 0);
g_pcf_file.push_back(value);
if (config.getKeyValue("CONFIG", "trace_copies", value) == 0) {
g_trace_instances.push_back(atoi(value.c_str()));
} else {
g_trace_instances.push_back(1);
}
} else {
assert(config.getListValues("CONFIG", "trcFile", list_values) == 0);
assert(int(list_values.size()) == g_num_traces); // Sanity check
for (i = 0; i < g_num_traces; i++)
g_trace_file.push_back(list_values[i]);
assert(config.getListValues("CONFIG", "trace_nodes", list_values) == 0);
assert(int(list_values.size()) == g_num_traces); // Sanity check
for (i = 0; i < g_num_traces; i++)
g_trace_nodes.push_back(atol(list_values[i].c_str()));
assert(config.getListValues("CONFIG", "pcfFile", list_values) == 0);
assert(int(list_values.size()) == g_num_traces); // Sanity check
for (i = 0; i < g_num_traces; i++)
g_pcf_file.push_back(list_values[i]);
if (config.getListValues("CONFIG", "trace_copies", list_values) == 0) {
assert(int(list_values.size()) == g_num_traces); // Sanity check
for (i = 0; i < g_num_traces; i++)
g_trace_instances.push_back(atoi(list_values[i].c_str()));
} else {
for (i = 0; i < g_num_traces; i++)
g_trace_instances.push_back(1);
}
}
/* 2 ways of specifying trace layout: through a trace map
* file, and selecting a preset trace distribution */
if (config.getKeyValue("CONFIG", "TraceMap", value) == 0) {
readTraceMap(value.c_str());
} else {
if (config.checkSection("TRACE_MAP")) {
readTraceMap(filename);
} else {
assert(config.getKeyValue("CONFIG", "trace_distribution", value) == 0);
readTraceDistribution(value.c_str(), &g_trace_distribution);
assert(g_trace_instances.size() != 0); // Sanity check; value was previously collected
buildTraceMap();
}
}
/* Sanity check: can not have more trace source ids than generators in the network */
total_trace_nodes = 0;
for (i = 0; i < g_num_traces; i++)
total_trace_nodes += g_trace_nodes[i] * g_trace_instances[i];
assert(total_trace_nodes <= g_number_generators);
if (config.getKeyValue("CONFIG", "cpu_speed", value) == 0) {
g_cpu_speed = atof(value.c_str());
}
if (config.getKeyValue("CONFIG", "op_per_cycle", value) == 0) {
g_op_per_cycle = atol(value.c_str());
}
if (config.getKeyValue("CONFIG", "cutmpi", value) == 0) {
g_cutmpi = atol(value.c_str());
}
if (config.getKeyValue("CONFIG", "phit_size", value) == 0) {
g_phit_size = atol(value.c_str());
}
break;
case HOTREGION:
if (config.getKeyValue("CONFIG", "PercentTrafficToCongest", value) == 0) {
g_percent_traffic_to_congest = atoi(value.c_str());
assert(g_percent_traffic_to_congest > 0 && g_percent_traffic_to_congest < 100);
}
if (config.getKeyValue("CONFIG", "PercentNodesIntoRegion", value) == 0) {
g_percent_nodes_into_region = atof(value.c_str());
assert(g_percent_nodes_into_region > 0.0 && g_percent_nodes_into_region < 100.0);
}
break;
case HOTSPOT:
if (config.getKeyValue("CONFIG", "PercentTrafficToCongest", value) == 0) {
g_percent_traffic_to_congest = atoi(value.c_str());
assert(g_percent_traffic_to_congest > 0 && g_percent_traffic_to_congest < 100);
}
if (config.getKeyValue("CONFIG", "HotspotNode", value) == 0) {
g_hotspot_node = atoi(value.c_str());
assert(g_hotspot_node >= 0 && g_hotspot_node < (g_number_generators - 1));
}
break;
default:
break;
}
/* Deadlock avoidance & Routing */
assert(config.getKeyValue("CONFIG", "deadlock_avoidance", value) == 0);
readDeadlockAvoidanceMechanism(value.c_str(), &g_deadlock_avoidance);
switch (g_deadlock_avoidance) {
case DALLY:
/* Dally usage of VCs - deadlock avoidance */
break;
case RING:
assert(config.getKeyValue("CONFIG", "rings", value) == 0);
g_rings = atoi(value.c_str());
assert(g_rings >= 1);
assert(config.getKeyValue("CONFIG", "RingInjectionBubble", value) == 0);
g_ring_injection_bubble = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "ringDirs", value) == 0);
g_ringDirs = atoi(value.c_str());
assert(g_ringDirs == 0 || g_ringDirs == 1 || g_ringDirs == 2);
if (g_rings > 1) {
assert(config.getKeyValue("CONFIG", "onlyRing2", value) == 0);
g_onlyRing2 = atoi(value.c_str());
}
g_ring_ports = 2 * g_rings; /* Ring dedicated physical ports */
assert(g_channels_escape == 0); // Sanity check
if (config.getKeyValue("CONFIG", "forbid_from_injQueues_to_ring", value) == 0) {
g_forbid_from_inj_queues_to_ring = atoi(value.c_str());
}
break;
case EMBEDDED_RING:
assert(config.getKeyValue("CONFIG", "rings", value) == 0);
g_rings = atoi(value.c_str());
assert(g_rings >= 1);
if (g_rings > 1) {
assert(config.getKeyValue("CONFIG", "onlyRing2", value) == 0);
g_onlyRing2 = atoi(value.c_str());
}
assert(config.getKeyValue("CONFIG", "RingInjectionBubble", value) == 0);
g_ring_injection_bubble = atoi(value.c_str());
assert(config.getKeyValue("CONFIG", "channels_ring", value) == 0);
g_channels_escape = atoi(value.c_str());
// Sanity checks
assert(g_palm_tree_configuration == 1);
assert(g_channels_escape > 0);
if (g_injection_channels < g_local_link_channels + g_channels_escape) {
/* Update number of VCs */
g_channels = g_local_link_channels + g_channels_escape;
}
if (config.getKeyValue("CONFIG", "forbid_from_injQueues_to_ring", value) == 0) {
g_forbid_from_inj_queues_to_ring = atoi(value.c_str());
}
break;
case EMBEDDED_TREE:
assert(config.getKeyValue("CONFIG", "channels_tree", value) == 0);
g_channels_escape = atoi(value.c_str());
// Sanity checks
assert(g_palm_tree_configuration == 1);
assert(g_channels_escape > 0);
if (g_injection_channels < g_local_link_channels + g_channels_escape) {
/* Update number of VCs */
g_channels = g_local_link_channels + g_channels_escape;
}
break;
default:
cerr << "ERROR: NO DEADLOCK AVOIDANCE MECHANISM HAS BEEN FOUND" << endl;
exit(0);
}
if (g_deadlock_avoidance == RING || g_deadlock_avoidance == EMBEDDED_RING
|| g_deadlock_avoidance == EMBEDDED_TREE) {
/* Ring and tree escape subnetworks are only defined for its
* usage with global network palm tree disposal, not with the
* "traditional" distribution */
assert(g_palm_tree_configuration == 1);
/* If deadlock avoidance mechanism is a escape subnetwork,