@@ -26,9 +26,9 @@ NEW_RUN_DIR="${REGRESSION_DIR}/run001/"
26
26
# #############################################
27
27
# Arch Sweep Arrays to use during benchmarking
28
28
DEFAULT_ARCH=" ${VTR_ROOT_DIR} /libs/libarchfpga/arch/sample_arch.xml"
29
- MEM_ARCH=" ${VTR_ROOT_DIR} /vtr_flow/arch/timing/k6_N10_mem32K_40nm .xml"
30
- SMALL_ARCH_SWEEP=" ${DEFAULT_ARCH} ${MEM_ARCH} "
31
- FULL_ARCH_SWEEP=$( find ${VTR_ROOT_DIR} /vtr_flow/arch/timing -maxdepth 1 | grep xml)
29
+ MEM_ARCH=" ${VTR_ROOT_DIR} /vtr_flow/arch/timing/k6_frac_N10_frac_chain_mem32K_40nm .xml"
30
+ SMALL_ARCH_SWEEP=" no_arch ${DEFAULT_ARCH} ${MEM_ARCH} "
31
+ FULL_ARCH_SWEEP=$( find ${VTR_ROOT_DIR} /vtr_flow/arch/timing -maxdepth 1 | grep xml | grep mem )
32
32
33
33
# #############################################
34
34
# Include more generic names here for better vector generation
@@ -42,7 +42,7 @@ _TEST=""
42
42
_NUMBER_OF_PROCESS=" 1"
43
43
_SIM_THREADS=" 1"
44
44
_VECTORS=" 100"
45
- _TIMEOUT=" 1200 "
45
+ _TIMEOUT=" 1200s "
46
46
_ADDER_DEF=" default"
47
47
_SIM_COUNT=" 1"
48
48
_RUN_DIR_OVERRIDE=" "
@@ -55,6 +55,7 @@ _BEST_COVERAGE_OFF="on"
55
55
_BATCH_SIM=" off"
56
56
_USE_PERF=" off"
57
57
_FORCE_SIM=" off"
58
+ _COLORIZE=" off"
58
59
59
60
# #############################################
60
61
# Exit Functions
@@ -117,7 +118,7 @@ printf "Called program with $INPUT
117
118
-j|--nb_of_process < N > $( _prt_cur_arg ${_NUMBER_OF_PROCESS} ) Number of process requested to be used
118
119
-s|--sim_threads < N > $( _prt_cur_arg ${_SIM_THREADS} ) Use multithreaded simulation using N threads
119
120
-V|--vectors < N > $( _prt_cur_arg ${_VECTORS} ) Use N vectors to generate per simulation
120
- -T|--timeout < N sec > $( _prt_cur_arg ${_TIMEOUT} ) Timeout a simulation/synthesis after N seconds
121
+ -T|--timeout < N[s|m|h] > $( _prt_cur_arg ${_TIMEOUT} ) Timeout a simulation/synthesis after N seconds
121
122
-a|--adder_def < /abs/path > $( _prt_cur_arg ${_ADDER_DEF} ) Use template to build adders
122
123
-n|--simulation_count < N > $( _prt_cur_arg ${_SIM_COUNT} ) Allow to run the simulation N times to benchmark the simulator
123
124
-d|--output_dir < /abs/path > $( _prt_cur_arg ${_RUN_DIR_OVERRIDE} ) Change the run directory output
@@ -132,6 +133,7 @@ printf "Called program with $INPUT
132
133
-b|--batch_sim $( _prt_cur_arg ${_BATCH_SIM} ) Use Batch mode multithreaded simulation
133
134
-p|--perf $( _prt_cur_arg ${_USE_PERF} ) Use Perf for monitoring execution
134
135
-f|--force_simulate $( _prt_cur_arg ${_FORCE_SIM} ) Force the simulation to be executed regardless of the config
136
+ -C|--colorize $( _prt_cur_arg ${_COLORIZE} ) Turn on pretty print for stdout
135
137
136
138
"
137
139
}
@@ -145,8 +147,9 @@ printf "
145
147
*small_sweep use a small set of timing architecture
146
148
*full_sweep sweep the whole vtr directory *** WILL FAIL ***
147
149
*default use the sample_arch.xml
148
- --simulate request simulation to be ran
150
+ --disable_simulation request simulation NOT to be ran
149
151
--no_threading do not use multithreading for this test ** useful if you have large test **
152
+ --source [relative_path] change where the benchmark files are, (relative to this config file) <default: ./>
150
153
"
151
154
}
152
155
@@ -287,38 +290,16 @@ function flag_is_number() {
287
290
esac
288
291
}
289
292
290
-
291
- # boolean type flags
292
- _low_ressource_flag=" "
293
- _valgrind_flag=" "
294
- _batch_sim_flag=" "
295
- _use_best_coverage_flag=" "
296
- _perf_flag=" "
297
-
298
- # number type flags
299
- _vector_flag=" "
300
- _timeout_flag=" "
301
- _simulation_threads_flag=" "
302
-
303
- _adder_definition_flag=" "
304
-
305
293
function _set_if() {
306
294
[ " $1 " == " on" ] && echo " $2 " || echo " "
307
295
}
308
296
309
- function _set_flag() {
310
- _low_ressource_flag=$( _set_if ${_LIMIT_RESSOURCE} " --limit_ressource" )
311
- _valgrind_flag=$( _set_if ${_VALGRIND} " --tool valgrind" )
312
- _batch_sim_flag=$( _set_if ${_BATCH_SIM} " --batch" )
313
- _use_best_coverage_flag=$( _set_if ${_BEST_COVERAGE_OFF} " --best_coverage" )
314
- _perf_flag=$( _set_if ${_USE_PERF} " --tool perf" )
315
-
316
- _vector_flag=" -g ${_VECTORS} "
317
- _timeout_flag=" --time_limit ${_TIMEOUT} s"
318
- _simulation_threads_flag=$( [ " ${_SIM_THREADS} " != " 1" ] && echo " -j ${_SIM_THREADS} " )
319
-
320
- _adder_definition_flag=" --adder_type ${_ADDER_DEF} "
297
+ function _echo_args() {
298
+ echo $@ | tr ' \n' ' ' | tr -s ' '
299
+ }
321
300
301
+ function _cat_args() {
302
+ _echo_args " $( cat $1 ) "
322
303
}
323
304
324
305
function parse_args() {
@@ -409,6 +390,10 @@ function parse_args() {
409
390
shift
410
391
411
392
# Boolean flags
393
+ ;;-C|--colorize)
394
+ _COLORIZE=" on"
395
+ echo " colorizing the output"
396
+
412
397
;;-g|--generate_bench)
413
398
_GENERATE_BENCH=" on"
414
399
echo " generating output vector for test given predefined input"
@@ -463,10 +448,30 @@ function sim() {
463
448
arch_list=" no_arch"
464
449
with_sim=" 0"
465
450
threads=${_NUMBER_OF_PROCESS}
466
- DEFAULT_CMD_PARAM=" ${_adder_definition_flag} ${_simulation_threads_flag} ${_batch_sim_flag} "
451
+ test_src=" ./"
452
+
453
+ # default flags
454
+ _low_ressource_flag=" --limit_ressource"
455
+ _valgrind_flag=" --tool valgrind"
456
+ _batch_sim_flag=" --batch"
457
+ _best_coverage_flag=" --best_coverage"
458
+ _perf_flag=" --tool perf"
459
+ _colorize_flag=" --colorize"
460
+
461
+ use_timeout=" --time_limit ${_TIMEOUT} "
462
+ use_valgrind=$( _set_if ${_VALGRIND} ${_valgrind_flag} )
463
+ use_low_ressource=$( _set_if ${_LIMIT_RESSOURCE} ${_low_ressource_flag} )
464
+ use_batch_sim=$( _set_if ${_BATCH_SIM} ${_batch_sim_flag} )
465
+ use_best_coverage=$( _set_if ${_BEST_COVERAGE_OFF} ${_best_coverage_flag} )
466
+ use_perf=$( _set_if ${_USE_PERF} ${_perf_flag} )
467
+ use_color=$( _set_if ${_COLORIZE} ${_colorize_flag} )
468
+
469
+ _vector_flag=" -g ${_VECTORS} "
470
+ _simulation_threads_flag=$( [ " ${_SIM_THREADS} " != " 1" ] && echo " -j ${_SIM_THREADS} " )
471
+ _adder_definition_flag=" --adder_type ${_ADDER_DEF} "
467
472
468
473
_SYNTHESIS=" on"
469
- _SIMULATE=${_FORCE_SIM}
474
+ _SIMULATE=" on "
470
475
471
476
if [ ! -d " $1 " ]
472
477
then
@@ -479,6 +484,11 @@ function sim() {
479
484
while [[ " $# " > 0 ]]
480
485
do
481
486
case $1 in
487
+ --source)
488
+ test_src=$2
489
+ shift
490
+ ;;
491
+
482
492
--custom_args_file)
483
493
with_custom_args=1
484
494
;;
@@ -506,15 +516,20 @@ function sim() {
506
516
shift
507
517
;;
508
518
509
- --simulate )
510
- _SIMULATE=" on "
519
+ --disable_simulation )
520
+ _SIMULATE=${_FORCE_SIM}
511
521
;;
512
522
513
523
--no_threading)
514
524
echo " This test will not be multithreaded"
515
525
threads=" 1"
516
526
;;
517
527
528
+ --valgrind)
529
+ echo " This test will be ran with valgrind"
530
+ use_valgrind=${_valgrind_flag}
531
+ ;;
532
+
518
533
* )
519
534
echo " Unknown internal parameter passed: $1 "
520
535
config_help
@@ -526,9 +541,23 @@ function sim() {
526
541
527
542
# ##########################################
528
543
# run custom benchmark
529
- bench_type=${benchmark_dir##*/ }
544
+ real_bench=" ${benchmark_dir} "
545
+ benchmark_dir=" ${benchmark_dir} /${test_src} "
546
+ if [ " _${benchmark_dir} " == " _" ] || [ ! -d ${benchmark_dir} ]; then
547
+ echo " invalid benchmark directory parameter passed: ${benchmark_dir} from ${test_src} "
548
+ ctrl_c
549
+ fi
550
+
551
+ benchmark_dir=$( readlink -f " ${benchmark_dir} " )
552
+ bench_type=${real_bench##*/ }
530
553
echo " BENCHMARK IS: ${bench_type} "
531
554
555
+
556
+ # #########################################
557
+ # setup defaults
558
+ DEFAULT_CMD_PARAM=" ${_adder_definition_flag} ${_simulation_threads_flag} ${_batch_sim_flag} "
559
+ DEFAULT_WRAPPER_CMD=" ${use_timeout} ${use_low_ressource} ${use_valgrind} ${use_perf} ${use_color} "
560
+
532
561
if [ " _${with_custom_args} " == " _1" ]
533
562
then
534
563
@@ -550,21 +579,14 @@ function sim() {
550
579
--log_file ${DIR} /odin.log
551
580
--test_name ${TEST_FULL_REF}
552
581
--failure_log ${global_odin_failure} .log
553
- ${_timeout_flag}
554
- ${_low_ressource_flag}
555
- ${_valgrind_flag} "
556
-
557
- if [ " ${_USE_PERF} " == " on" ]
558
- then
559
- wrapper_odin_command=" ${wrapper_odin_command} ${_perf_flag} ${DIR} /perf.data"
560
- fi
582
+ ${DEFAULT_WRAPPER_CMD} "
561
583
562
584
odin_command=" ${DEFAULT_CMD_PARAM}
563
- $( cat ${dir} /odin.args | tr ' \n ' ' ' )
585
+ $( _cat_args " ${dir} /odin.args" )
564
586
-o ${blif_file}
565
587
-sim_dir ${DIR} "
566
588
567
- echo $( echo " ${wrapper_odin_command} ${odin_command} " | tr ' \n ' ' ' | tr -s ' ' ) > ${DIR} /odin_param
589
+ _echo_args " ${wrapper_odin_command} ${odin_command} " > ${DIR} /odin_param
568
590
fi
569
591
done
570
592
@@ -587,12 +609,9 @@ function sim() {
587
609
basename=" "
588
610
case " ${benchmark} " in
589
611
* .v)
590
- _SYNTHESIS=" on"
591
612
basename=${benchmark% .v}
592
613
;;
593
614
* .blif)
594
- # this is a blif file
595
- _SYNTHESIS=" off"
596
615
basename=${benchmark% .blif}
597
616
;;
598
617
* )
@@ -620,7 +639,19 @@ function sim() {
620
639
TEST_FULL_REF=" ${bench_type} /${test_name} /${arch_name} "
621
640
622
641
DIR=" ${NEW_RUN_DIR} /${TEST_FULL_REF} "
623
- blif_file=" ${DIR} /odin.blif"
642
+ blif_file=" "
643
+
644
+ case " ${benchmark} " in
645
+ * .v)
646
+ _SYNTHESIS=" on"
647
+ blif_file=" ${DIR} /odin.blif"
648
+ ;;
649
+ * .blif)
650
+ # this is a blif file
651
+ _SYNTHESIS=" off"
652
+ blif_file=${benchmark}
653
+ ;;
654
+ esac
624
655
625
656
626
657
# build commands
@@ -634,22 +665,15 @@ function sim() {
634
665
--log_file ${DIR} /synthesis.log
635
666
--test_name ${TEST_FULL_REF}
636
667
--failure_log ${global_synthesis_failure} .log
637
- ${_timeout_flag}
638
- ${_low_ressource_flag}
639
- ${_valgrind_flag} "
640
-
641
- if [ " ${_USE_PERF} " == " on" ]
642
- then
643
- wrapper_synthesis_command=" ${wrapper_synthesis_command} ${_perf_flag} ${DIR} /perf.data"
644
- fi
668
+ ${DEFAULT_WRAPPER_CMD} "
645
669
646
670
synthesis_command=" ${DEFAULT_CMD_PARAM}
647
671
${arch_cmd}
648
672
-V ${benchmark}
649
673
-o ${blif_file}
650
674
-sim_dir ${DIR} "
651
675
652
- echo $( echo " ${wrapper_synthesis_command} ${synthesis_command} " | tr ' \n ' ' ' | tr -s ' ' ) > ${DIR} /cmd_param
676
+ _echo_args " ${wrapper_synthesis_command} ${synthesis_command} " > ${DIR} /cmd_param
653
677
fi
654
678
655
679
if [ " ${_SIMULATE} " == " on" ]
@@ -658,14 +682,7 @@ function sim() {
658
682
--log_file ${DIR} /simulation.log
659
683
--test_name ${TEST_FULL_REF}
660
684
--failure_log ${global_simulation_failure} .log
661
- ${_timeout_flag}
662
- ${_low_ressource_flag}
663
- ${_valgrind_flag} "
664
-
665
- if [ " ${_USE_PERF} " == " on" ]
666
- then
667
- wrapper_simulation_command=" ${wrapper_simulation_command} ${_perf_flag} ${DIR} /perf.data"
668
- fi
685
+ ${DEFAULT_WRAPPER_CMD} "
669
686
670
687
simulation_command=" ${DEFAULT_CMD_PARAM}
671
688
${arch_cmd}
@@ -675,7 +692,7 @@ function sim() {
675
692
676
693
if [ " ${_GENERATE_BENCH} " == " on" ] || [ ! -f ${input_vector_file} ]
677
694
then
678
- simulation_command=" ${simulation_command} ${_use_best_coverage_flag } ${_vector_flag} "
695
+ simulation_command=" ${simulation_command} ${use_best_coverage } ${_vector_flag} "
679
696
else
680
697
simulation_command=" ${simulation_command} -t ${input_vector_file} "
681
698
if [ " ${_GENERATE_OUTPUT} " == " off" ] && [ -f ${output_vector_file} ]
@@ -684,7 +701,7 @@ function sim() {
684
701
fi
685
702
fi
686
703
687
- echo $( echo " ${wrapper_simulation_command} ${simulation_command} " | tr ' \n ' ' ' | tr -s ' ' ) > ${DIR} /sim_param
704
+ _echo_args " ${wrapper_simulation_command} ${simulation_command} " > ${DIR} /sim_param
688
705
fi
689
706
690
707
done
@@ -872,7 +889,7 @@ function run_sim_on_directory() {
872
889
config_help
873
890
else
874
891
create_temp
875
- sim ${BENCHMARK_DIR} /${test_dir} $( cat ${BENCHMARK_DIR} /${test_dir} /config.txt)
892
+ sim " ${BENCHMARK_DIR} /${test_dir} " $( _cat_args " ${BENCHMARK_DIR} /${test_dir} /config.txt" )
876
893
fi
877
894
}
878
895
@@ -907,7 +924,6 @@ START=`get_current_time`
907
924
init_temp
908
925
909
926
parse_args $INPUT
910
- _set_flag
911
927
912
928
if [ " _${_TEST} " == " _" ]
913
929
then
0 commit comments