1#!/bin/bash 2 3. ./common.sh 4 5test_cpu_speed_torch () { 6 echo "Testing: torch.*, CPU" 7 8 export OMP_NUM_THREADS=4 9 export MKL_NUM_THREADS=4 10 11 git clone https://github.com/yf225/perf-tests.git 12 13 if [ "$1" == "compare_with_baseline" ]; then 14 export ARGS=(--compare ../cpu_runtime.json) 15 elif [ "$1" == "compare_and_update" ]; then 16 export ARGS=(--compare ../cpu_runtime.json --update ../new_cpu_runtime.json) 17 elif [ "$1" == "update_only" ]; then 18 export ARGS=(--update ../new_cpu_runtime.json) 19 fi 20 21 if ! python perf-tests/modules/test_cpu_torch.py "${ARGS[@]}"; then 22 echo "To reproduce this regression, run \`cd .ci/pytorch/perf_test/ && bash ${FUNCNAME[0]}.sh\` on your local machine and compare the runtime before/after your code change." 23 exit 1 24 fi 25} 26 27if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then 28 run_test test_cpu_speed_torch "$@" 29fi 30