From 1e2a45174b961d4c95e6160b423093f42fac6558 Mon Sep 17 00:00:00 2001 From: Eren Kopuz Date: Wed, 17 Jun 2020 19:23:20 +0100 Subject: COMPMID-3452: Skip empty lines and lines starting with # when parsing the gemm configs CSV files - Updated total test number calculation to also ignore empty lines and comments Change-Id: Ic76e7c601094611a324c7a103cb01133a2bbbb05 Signed-off-by: Eren Kopuz Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3351 Reviewed-by: SiCong Li Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- examples/gemm_tuner/benchmark_gemm_examples.sh | 36 +++++++++++++++----------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/examples/gemm_tuner/benchmark_gemm_examples.sh b/examples/gemm_tuner/benchmark_gemm_examples.sh index d6f41cc22a..5d346d6d44 100755 --- a/examples/gemm_tuner/benchmark_gemm_examples.sh +++ b/examples/gemm_tuner/benchmark_gemm_examples.sh @@ -333,8 +333,11 @@ function run() { local total_num_experiment local num_params local num_configs - num_params=$( wc -l ${GEMM_SHAPES_FILE} | cut -d " " -f 1) - num_configs=$( wc -l ${GEMM_CONFIGS_FILE} | cut -d " " -f 1 ) + #local match_expression="^(?:\s*\d+\s*,)+\s*\d+\s*$" + local match_expression="^(\s*[0-9]+\s*,)+\s*[0-9]\s*$" + # Don't count empty lines and lines starting with # (comments) + num_params=$( grep -E "$match_expression" "${GEMM_SHAPES_FILE}" | wc -l | cut -d " " -f 1) + num_configs=$( grep -E "$match_expression" "${GEMM_CONFIGS_FILE}" | wc -l | cut -d " " -f 1) (( total_num_experiment=${num_params} * ${num_configs} )) # Time elapsed since the beginning in seconds local time_elapsed_s @@ -346,19 +349,22 @@ function run() { do while read gemm_config do - echo "Running..." 1>&2 - example_args="${gemm_shape},${gemm_config}" - # Run experiment - ${EXAMPLE_BIN_DIR}/${example_bin} --example_args=${example_args} --iterations=${NUM_ITERATION} --json-file=${OUT_DIR}/${expr_count}.${OUT_EXTENSION} --instruments=OPENCL_TIMER_MS - # Print progress - print_progress ${expr_count} ${total_num_experiment} - # Print time statistics - time_elapsed_s=$SECONDS - echo "Time elapsed since beginning: $(( $time_elapsed_s / 60 ))m $(( $time_elapsed_s % 60 ))s" 1>&2 - (( time_est_s=(${total_num_experiment} - ${expr_count}) * ${time_elapsed_s} / ${expr_count} )) - echo "Time estimated to finish: $(( $time_est_s / 60 ))m $(( $time_est_s % 60 ))s" 1>&2 - (( expr_count++ )) - echo "Done." 1>&2 + # Ignore empty lines and lines starting with # (comments) + if echo "$gemm_shape" | grep -Eq "$match_expression" && echo "$gemm_config" | grep -Pq "$match_expression";then + echo "Running..." 1>&2 + example_args="${gemm_shape},${gemm_config}" + # Run experiment + ${EXAMPLE_BIN_DIR}/${example_bin} --example_args=${example_args} --iterations=${NUM_ITERATION} --json-file=${OUT_DIR}/${expr_count}.${OUT_EXTENSION} --instruments=OPENCL_TIMER_MS + # Print progress + print_progress ${expr_count} ${total_num_experiment} + # Print time statistics + time_elapsed_s=$SECONDS + echo "Time elapsed since beginning: $(( $time_elapsed_s / 60 ))m $(( $time_elapsed_s % 60 ))s" 1>&2 + (( time_est_s=(${total_num_experiment} - ${expr_count}) * ${time_elapsed_s} / ${expr_count} )) + echo "Time estimated to finish: $(( $time_est_s / 60 ))m $(( $time_est_s % 60 ))s" 1>&2 + (( expr_count++ )) + echo "Done." 1>&2 + fi done < "${GEMM_CONFIGS_FILE}" done < "${GEMM_SHAPES_FILE}" echo "Finished running all configs for ${example_bin}" 1>&2 -- cgit v1.2.1