Skip to content

Commit

Permalink
add some modification to support torchbench-cpu well
Browse files Browse the repository at this point in the history
  • Loading branch information
Guo-Peilin committed Nov 28, 2022
1 parent a84111a commit 22db73e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/torchbench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,18 @@ jobs:
exec_command: bash ./pytorch_blade/benchmark/TorchBench/test_torch_bench.sh cpu full
push_command: ""
remote_dev_docker: ""
secrets: inherit
secrets: inherit
TorchBenchCpuFull8Threads:
if: github.event.schedule == '30 15 * * 5'
uses: ./.github/workflows/reusable.yml
with:
name: torch-offcial-benchmark
base_image: bladedisc/bladedisc:latest-runtime-torch1.12.0-cpu
device: cpu_benchmark
timeout_minutes: 4320 # 72h
dockerfile: docker/cronjobs/Dockerfile.torch.bench
extra_envs: -e RELATED_DIFF_PERCENT=3
exec_command: bash ./pytorch_blade/benchmark/TorchBench/test_torch_bench.sh cpu full 8 "0-7"
push_command: ""
remote_dev_docker: ""
secrets: inherit
5 changes: 4 additions & 1 deletion pytorch_blade/benchmark/TorchBench/requirements_cpu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ librosa
torchvision==0.13.0+cpu
torchaudio==0.12.0+cpu
torchtext==0.13.0
torchdynamo
onnx
onnxruntime
intel_extension_for_pytorch==1.12.0
torchdynamo==1.13.0
18 changes: 14 additions & 4 deletions pytorch_blade/benchmark/TorchBench/test_torch_bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,30 @@ ln -s $benchmark_repo_dir torchbenchmark
# setup benchmark env
export DISC_EXPERIMENTAL_SPECULATION_TLP_ENHANCE=true \
DISC_CPU_LARGE_CONCAT_NUM_OPERANDS=4 DISC_CPU_ENABLE_EAGER_TRANSPOSE_FUSION=1 \
OMP_NUM_THREADS=1 TORCHBENCH_ATOL=1e-2 TORCHBENCH_RTOL=1e-2
TORCHBENCH_ATOL=1e-2 TORCHBENCH_RTOL=1e-2

config_file=blade_$1_$2.yaml
bench_target=$2
binding_cores=0

if [ $1 == "cpu" ]
then
# 4 cores
export GOMP_CPU_AFFINITY="2-5"
if [ -z "$3" ]
then
export OMP_NUM_THREADS=1 GOMP_CPU_AFFINITY=0
else
# eg: bash test_torch_bench.sh cpu tiny 32 "0-63:2"
export OMP_NUM_THREADS=$3 GOMP_CPU_AFFINITY=$4
binding_cores=$4
fi
results=(eval-cpu-fp32)
taskset -c $binding_cores python3 torchbenchmark/.github/scripts/run-config.py \
-c $config_file -b ./torchbenchmark/ --output-dir .
else
results=(eval-cuda-fp32 eval-cuda-fp16)
python3 torchbenchmark/.github/scripts/run-config.py \
-c $config_file -b ./torchbenchmark/ --output-dir .
fi
python3 torchbenchmark/.github/scripts/run-config.py -c $config_file -b ./torchbenchmark/ --output-dir .

# results
date_str=$(date '+%Y%m%d-%H')
Expand Down

0 comments on commit 22db73e

Please sign in to comment.