Skip to content

Commit 8bb8829

Browse files
committed
add velgrind test suite the odin regression
1 parent 79a7855 commit 8bb8829

File tree

10 files changed

+72
-57
lines changed

10 files changed

+72
-57
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--simulate
1+
--arch_list small_sweep
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--no_threading --simulate
1+
--no_threading
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--arch_list small_sweep --simulate
1+
--arch_list small_sweep
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--arch_list memories --no_threading --simulate
1+
--arch_list memories --no_threading
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--arch_list small_sweep --simulate
1+
--arch_list small_sweep
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--arch_list small_sweep --simulate
1+
--arch_list small_sweep
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--simulate
1+
--arch_list small_sweep
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--arch_list small_sweep --disable_simulation --source ../operators --valgrind

ODIN_II/verify_odin.sh

Lines changed: 59 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ _TEST=""
4242
_NUMBER_OF_PROCESS="1"
4343
_SIM_THREADS="1"
4444
_VECTORS="100"
45-
_TIMEOUT="1200"
45+
_TIMEOUT="1200s"
4646
_ADDER_DEF="default"
4747
_SIM_COUNT="1"
4848
_RUN_DIR_OVERRIDE=""
@@ -117,7 +117,7 @@ printf "Called program with $INPUT
117117
-j|--nb_of_process < N > $(_prt_cur_arg ${_NUMBER_OF_PROCESS}) Number of process requested to be used
118118
-s|--sim_threads < N > $(_prt_cur_arg ${_SIM_THREADS}) Use multithreaded simulation using N threads
119119
-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
120+
-T|--timeout < N[s|m|h] > $(_prt_cur_arg ${_TIMEOUT}) Timeout a simulation/synthesis after N seconds
121121
-a|--adder_def < /abs/path > $(_prt_cur_arg ${_ADDER_DEF}) Use template to build adders
122122
-n|--simulation_count < N > $(_prt_cur_arg ${_SIM_COUNT}) Allow to run the simulation N times to benchmark the simulator
123123
-d|--output_dir < /abs/path > $(_prt_cur_arg ${_RUN_DIR_OVERRIDE}) Change the run directory output
@@ -145,8 +145,9 @@ printf "
145145
*small_sweep use a small set of timing architecture
146146
*full_sweep sweep the whole vtr directory *** WILL FAIL ***
147147
*default use the sample_arch.xml
148-
--simulate request simulation to be ran
148+
--disable_simulation request simulation NOT to be ran
149149
--no_threading do not use multithreading for this test ** useful if you have large test **
150+
--source [relative_path] change where the benchmark files are, (relative to this config file) <default: ./>
150151
"
151152
}
152153

@@ -287,40 +288,10 @@ function flag_is_number() {
287288
esac
288289
}
289290

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-
305291
function _set_if() {
306292
[ "$1" == "on" ] && echo "$2" || echo ""
307293
}
308294

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}"
321-
322-
}
323-
324295
function parse_args() {
325296
while [[ "$#" > 0 ]]
326297
do
@@ -463,10 +434,28 @@ function sim() {
463434
arch_list="no_arch"
464435
with_sim="0"
465436
threads=${_NUMBER_OF_PROCESS}
466-
DEFAULT_CMD_PARAM="${_adder_definition_flag} ${_simulation_threads_flag} ${_batch_sim_flag}"
437+
test_src="./"
438+
439+
# default flags
440+
_low_ressource_flag="--limit_ressource"
441+
_valgrind_flag="--tool valgrind"
442+
_batch_sim_flag="--batch"
443+
_best_coverage_flag="--best_coverage"
444+
_perf_flag="--tool perf"
445+
446+
use_timeout="--time_limit ${_TIMEOUT}"
447+
use_valgrind=$(_set_if ${_VALGRIND} ${_valgrind_flag})
448+
use_low_ressource=$(_set_if ${_LIMIT_RESSOURCE} ${_low_ressource_flag})
449+
use_batch_sim=$(_set_if ${_BATCH_SIM} ${_batch_sim_flag})
450+
use_best_coverage=$(_set_if ${_BEST_COVERAGE_OFF} ${_best_coverage_flag})
451+
use_perf=$(_set_if ${_USE_PERF} ${_perf_flag})
452+
453+
_vector_flag="-g ${_VECTORS}"
454+
_simulation_threads_flag=$([ "${_SIM_THREADS}" != "1" ] && echo "-j ${_SIM_THREADS}")
455+
_adder_definition_flag="--adder_type ${_ADDER_DEF}"
467456

468457
_SYNTHESIS="on"
469-
_SIMULATE=${_FORCE_SIM}
458+
_SIMULATE="on"
470459

471460
if [ ! -d "$1" ]
472461
then
@@ -479,6 +468,11 @@ function sim() {
479468
while [[ "$#" > 0 ]]
480469
do
481470
case $1 in
471+
--source)
472+
test_src=$2
473+
shift
474+
;;
475+
482476
--custom_args_file)
483477
with_custom_args=1
484478
;;
@@ -506,15 +500,20 @@ function sim() {
506500
shift
507501
;;
508502

509-
--simulate)
510-
_SIMULATE="on"
503+
--disable_simulation)
504+
_SIMULATE=${_FORCE_SIM}
511505
;;
512506

513507
--no_threading)
514508
echo "This test will not be multithreaded"
515509
threads="1"
516510
;;
517511

512+
--valgrind)
513+
echo "This test will be ran with valgrind"
514+
use_valgrind=${_valgrind_flag}
515+
;;
516+
518517
*)
519518
echo "Unknown internal parameter passed: $1"
520519
config_help
@@ -526,9 +525,23 @@ function sim() {
526525

527526
###########################################
528527
# run custom benchmark
529-
bench_type=${benchmark_dir##*/}
528+
real_bench="${benchmark_dir}"
529+
benchmark_dir="${benchmark_dir}/${test_src}"
530+
if [ "_${benchmark_dir}" == "_" ] || [ ! -d ${benchmark_dir} ]; then
531+
echo "invalid benchmark directory parameter passed: ${benchmark_dir} from ${test_src}"
532+
ctrl_c
533+
fi
534+
535+
benchmark_dir=$(readlink -f "${benchmark_dir}")
536+
bench_type=${real_bench##*/}
530537
echo " BENCHMARK IS: ${bench_type}"
531538

539+
540+
##########################################
541+
# setup defaults
542+
DEFAULT_CMD_PARAM="${_adder_definition_flag} ${_simulation_threads_flag} ${_batch_sim_flag}"
543+
DEFAULT_WRAPPER_CMD="${_timeout_flag} ${_low_ressource_flag} ${use_valgrind}"
544+
532545
if [ "_${with_custom_args}" == "_1" ]
533546
then
534547

@@ -552,7 +565,7 @@ function sim() {
552565
--failure_log ${global_odin_failure}.log
553566
${_timeout_flag}
554567
${_low_ressource_flag}
555-
${_valgrind_flag}"
568+
${use_valgrind}"
556569

557570
if [ "${_USE_PERF}" == "on" ]
558571
then
@@ -636,9 +649,9 @@ function sim() {
636649
--failure_log ${global_synthesis_failure}.log
637650
${_timeout_flag}
638651
${_low_ressource_flag}
639-
${_valgrind_flag}"
652+
${use_valgrind}"
640653

641-
if [ "${_USE_PERF}" == "on" ]
654+
if [ "${use_perf}" == "on" ]
642655
then
643656
wrapper_synthesis_command="${wrapper_synthesis_command} ${_perf_flag} ${DIR}/perf.data"
644657
fi
@@ -658,9 +671,9 @@ function sim() {
658671
--log_file ${DIR}/simulation.log
659672
--test_name ${TEST_FULL_REF}
660673
--failure_log ${global_simulation_failure}.log
661-
${_timeout_flag}
662-
${_low_ressource_flag}
663-
${_valgrind_flag}"
674+
${use_timeout}
675+
${use_low_ressource}
676+
${use_valgrind}"
664677

665678
if [ "${_USE_PERF}" == "on" ]
666679
then
@@ -675,7 +688,7 @@ function sim() {
675688

676689
if [ "${_GENERATE_BENCH}" == "on" ] || [ ! -f ${input_vector_file} ]
677690
then
678-
simulation_command="${simulation_command} ${_use_best_coverage_flag} ${_vector_flag}"
691+
simulation_command="${simulation_command} ${use_best_coverage} ${_vector_flag}"
679692
else
680693
simulation_command="${simulation_command} -t ${input_vector_file}"
681694
if [ "${_GENERATE_OUTPUT}" == "off" ] && [ -f ${output_vector_file} ]
@@ -753,6 +766,7 @@ function sim() {
753766
fi
754767

755768
fi
769+
756770
}
757771

758772
function run_failed() {
@@ -907,7 +921,6 @@ START=`get_current_time`
907921
init_temp
908922

909923
parse_args $INPUT
910-
_set_flag
911924

912925
if [ "_${_TEST}" == "_" ]
913926
then

ODIN_II/wrapper_odin.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if [ ! -f ${EXEC} ]; then
2020
fi
2121

2222
TIME_EXEC=$($SHELL -c "which time")
23-
VALGRIND_EXEC="valgrind --leak-check=full --max-stackframe=128000000"
23+
VALGRIND_EXEC="valgrind --leak-check=full --max-stackframe=128000000 --error-exitcode=1"
2424
PERF_EXEC="perf stat record -a -d -d -d -o"
2525
GDB_EXEC="gdb --args"
2626
LOG=""
@@ -221,17 +221,18 @@ do
221221

222222
if [ "${USE_TIMEOUT}" == "on" ]; then
223223
if [ "${CANCEL_LOGS}" == "off" ] && [ "_${LOG_FILE}" != "_" ]; then
224-
timeout ${TIME_LIMIT} /bin/bash -c "${TIME_EXEC} --output=${LOG_FILE} --append ${EXEC} ${ODIN_ARGS} &>> ${LOG_FILE}" &> /dev/null && EXIT_STATUS=0 || EXIT_STATUS=1
224+
timeout ${TIME_LIMIT} /bin/bash -c "${TIME_EXEC} --output=${LOG_FILE} --append ${EXEC} ${ODIN_ARGS} &>> ${LOG_FILE}" &> /dev/null
225225
else
226-
timeout ${TIME_LIMIT} /bin/bash -c "${TIME_EXEC} ${EXEC} ${ODIN_ARGS}" && EXIT_STATUS=0 || EXIT_STATUS=1
226+
timeout ${TIME_LIMIT} /bin/bash -c "${TIME_EXEC} ${EXEC} ${ODIN_ARGS}"
227227
fi
228228
else
229229
if [ "${CANCEL_LOGS}" == "off" ] && [ "_${LOG_FILE}" != "_" ]; then
230-
/bin/bash -c "${EXEC} ${ODIN_ARGS} &>> ${LOG_FILE}" &> /dev/null && EXIT_STATUS=0 || EXIT_STATUS=1
230+
/bin/bash -c "${EXEC} ${ODIN_ARGS} &>> ${LOG_FILE}" &> /dev/null
231231
else
232232
/bin/bash -c "${EXEC} ${ODIN_ARGS}"
233233
fi
234234
fi
235+
EXIT_STATUS=$?
235236

236237
break
237238
;;

0 commit comments

Comments
 (0)