Skip to content

Commit 9467a74

Browse files
committed
format
1 parent bdd8cea commit 9467a74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1202
-1154
lines changed

.github/workflows/test_install_cuda.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,45 @@ on:
55
paths:
66
- 'install_cuda.sh'
77
- '.github/workflows/test_install_cuda.yml'
8+
- '*.sh'
89
pull_request:
910
paths:
1011
- 'install_cuda.sh'
1112
- '.github/workflows/test_install_cuda.yml'
13+
- '*.sh'
1214
workflow_dispatch:
1315

1416
jobs:
17+
shellcheck:
18+
runs-on: ubuntu-latest
19+
name: ShellCheck and Format Check
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v3
23+
24+
- name: Install ShellCheck
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y shellcheck
28+
29+
- name: Run format and check script
30+
run: |
31+
chmod +x format_scripts.sh
32+
./format_scripts.sh
33+
34+
- name: Check if any files were modified by formatting
35+
run: |
36+
if [ -n "$(git status --porcelain)" ]; then
37+
echo "❌ Files need formatting! Please run ./format_scripts.sh locally and commit the changes."
38+
git diff
39+
exit 1
40+
else
41+
echo "✅ All files are properly formatted!"
42+
fi
43+
1544
test-install-cuda:
1645
runs-on: ubuntu-latest
46+
needs: shellcheck
1747
timeout-minutes: 30
1848

1949
steps:

.shellcheckrc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ShellCheck configuration file
2+
# See https://github.com/koalaman/shellcheck/wiki/Ignore
3+
4+
# Disable warnings for unused variables (common in script templates)
5+
disable=SC2034
6+
7+
# Disable warnings for cd without error checking (we use pushd/popd pattern)
8+
disable=SC2164
9+
10+
# Disable warnings for command substitution in variable assignment
11+
disable=SC2155
12+
13+
# Enable additional checks
14+
enable=all
15+
16+
# Set shell dialect (bash by default)
17+
shell=bash
18+
19+
# External sources (if any)
20+
# external-sources=true

backup_torchbench/generate_profiling.sh

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,21 @@ output=/home/yhao/d/testing/runlog_for_profiling_jul12.txt
66

77
work_dir=/home/yhao/d/benchmark
88

9-
func(){
10-
echo "" > $output
9+
func() {
10+
echo "" >$output
1111

12-
# for model in fambench_dlrm fambench_xlmr detectron2_maskrcnn vision_maskrcnn timm_efficientnet timm_vision_transformer hf_Bert hf_GPT2 hf_T5
13-
# for model in fambench_dlrm fambench_xlmr detectron2_maskrcnn vision_maskrcnn timm_efficientnet timm_vision_transformer hf_Bert hf_GPT2 hf_T5 resnet50 timm_resnest resnext50_32x4d hf_BigBird hf_Bart soft_actor_critic alexnet timm_vovnet mobilenet_v3_large vgg16 shufflenet_v2_x1_0 pytorch_unet dlrm mnasnet1_0 resnet50_quantized_qat tts_angular hf_Reformer nvidia_deeprecommender mobilenet_v2_quantized_qat mobilenet_v2 LearningToPaint hf_Longformer opacus_cifar10 resnet18 timm_regnet dcgan maml BERT_pytorch Super_SloMo pytorch_struct pplbench_beanmachine drq pyhpc_isoneutral_mixing hf_Albert attention_is_all_you_need_pytorch moco Background_Matting pyhpc_turbulent_kinetic_energy maml_omniglot pyhpc_equation_of_state timm_nfnet demucs densenet121 pytorch_CycleGAN_and_pix2pix tacotron2 squeezenet1_1 fastNLP_Bert pytorch_stargan hf_DistilBert speech_transformer yolov3 timm_efficientdet
14-
for model in dlrm nvidia_deeprecommender
15-
do
12+
# for model in fambench_dlrm fambench_xlmr detectron2_maskrcnn vision_maskrcnn timm_efficientnet timm_vision_transformer hf_Bert hf_GPT2 hf_T5
13+
# for model in fambench_dlrm fambench_xlmr detectron2_maskrcnn vision_maskrcnn timm_efficientnet timm_vision_transformer hf_Bert hf_GPT2 hf_T5 resnet50 timm_resnest resnext50_32x4d hf_BigBird hf_Bart soft_actor_critic alexnet timm_vovnet mobilenet_v3_large vgg16 shufflenet_v2_x1_0 pytorch_unet dlrm mnasnet1_0 resnet50_quantized_qat tts_angular hf_Reformer nvidia_deeprecommender mobilenet_v2_quantized_qat mobilenet_v2 LearningToPaint hf_Longformer opacus_cifar10 resnet18 timm_regnet dcgan maml BERT_pytorch Super_SloMo pytorch_struct pplbench_beanmachine drq pyhpc_isoneutral_mixing hf_Albert attention_is_all_you_need_pytorch moco Background_Matting pyhpc_turbulent_kinetic_energy maml_omniglot pyhpc_equation_of_state timm_nfnet demucs densenet121 pytorch_CycleGAN_and_pix2pix tacotron2 squeezenet1_1 fastNLP_Bert pytorch_stargan hf_DistilBert speech_transformer yolov3 timm_efficientdet
14+
for model in dlrm nvidia_deeprecommender; do
1615

17-
echo "@Yueming Hao: start model tests" >> $output
18-
echo "@Yueming Hao: Run $model" >> $output
16+
echo "@Yueming Hao: start model tests" >>$output
17+
echo "@Yueming Hao: Run $model" >>$output
1918
mkdir ./logs/$model
20-
python run.py -d cuda --profile --profile-detailed --profile-devices cpu,cuda --profile-folder ./logs/$model/ -t train $model --precision fp32 >> $output 2>&1
21-
echo "@Yueming Hao: end model tests" >> $output
19+
python run.py -d cuda --profile --profile-detailed --profile-devices cpu,cuda --profile-folder ./logs/$model/ -t train $model --precision fp32 >>$output 2>&1
20+
echo "@Yueming Hao: end model tests" >>$output
2221

23-
done
22+
done
2423

2524
}
2625

27-
func
26+
func

backup_torchbench/gpu_mem_monitor.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ while true; do
99

1010
# Call the test.py script using Python
1111
bash training_scripts/single_gpu/run_350m.sh
12-
12+
1313
# Check the return code of the script
1414
if [[ $? -eq 0 ]]; then
1515
# If the script returns successfully, send a "successfully" notification
@@ -18,11 +18,10 @@ while true; do
1818
# If the script fails, send a "fail" notification
1919
notify "Task failed."
2020
fi
21-
21+
2222
exit 0
2323
fi
2424

2525
# Sleep for 60 seconds before the next check
2626
sleep 60
2727
done
28-
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#!/bin/bash
22
# This script prints all models' categories in torchbenchmark/models
33
benchmark_path=${benchmark_path:-"/home/yhao24/p/p8/benchmark"}
4-
all_models=`ls $benchmark_path/torchbenchmark/models`
4+
all_models=$(ls $benchmark_path/torchbenchmark/models)
55
cd $benchmark_path/
66
output="/tmp/model_class.txt"
7-
for model in $all_models
8-
do
9-
# if model ends with .md, skip it
10-
if [[ $model == *.md ]]; then
11-
continue
12-
fi
13-
echo -n "$model, " >> $output
14-
python3 -c "from torchbenchmark.models.$model import Model; print(Model.task)" >> $output
15-
done
7+
for model in $all_models; do
8+
# if model ends with .md, skip it
9+
if [[ $model == *.md ]]; then
10+
continue
11+
fi
12+
echo -n "$model, " >>$output
13+
python3 -c "from torchbenchmark.models.$model import Model; print(Model.task)" >>$output
14+
done

backup_torchbench/run_all.sh

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
11
#!/bin/bash
22

33
SHELL_FOLDER=$(
4-
cd "$(dirname "$0")"
5-
pwd
4+
cd "$(dirname "$0")"
5+
pwd
66
)
77
source ${SHELL_FOLDER}/run_base.sh
88

99
cd $tb_path
1010

11-
1211
func() {
13-
for ((i = 1; i <= $max_iter; i++)); do
14-
python run.py -d cuda ${tflops} -t $mode $model >>$output 2>&1
15-
if [ $? -ne 0 ]; then
16-
break
17-
fi
18-
done
12+
for ((i = 1; i <= $max_iter; i++)); do
13+
python run.py -d cuda ${tflops} -t $mode $model >>$output 2>&1
14+
if [ $? -ne 0 ]; then
15+
break
16+
fi
17+
done
1918
}
2019

21-
22-
2320
echo $(date) >>$output
2421
for model in $all_models; do
25-
# for model in resnet50 hf_Bart hf_Bart; do
26-
conda activate $env1
27-
echo "@Yueming Hao origin $model" >>$output
28-
func
22+
# for model in resnet50 hf_Bart hf_Bart; do
23+
conda activate $env1
24+
echo "@Yueming Hao origin $model" >>$output
25+
func
2926
done
3027

3128
echo $(date) >>$output

backup_torchbench/run_all_eg.sh

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
11
#!/bin/bash
22

3-
4-
5-
63
# model=detectron2_maskrcnn_r_50_c4
74
output=/home/yhao/d/tmp/run_all_egs.log
8-
echo "" > $output
5+
echo "" >$output
96
cd /home/yhao/d/benchmark_11.6
107

118
max_iter=1
12-
func(){
13-
for (( i = 1 ; i <= $max_iter; i++ ))
14-
do
15-
# python run.py -d cuda -m jit -t train $model --precision fp32 --torchdynamo nvfuser >> $output 2>&1
16-
python run.py -d cuda -t train --profile-eg --profile --profile-detailed --profile-devices cpu,cuda --profile-folder ./logs/$model $model --precision fp32 >> $output 2>&1
17-
done
9+
func() {
10+
for ((i = 1; i <= $max_iter; i++)); do
11+
# python run.py -d cuda -m jit -t train $model --precision fp32 --torchdynamo nvfuser >> $output 2>&1
12+
python run.py -d cuda -t train --profile-eg --profile --profile-detailed --profile-devices cpu,cuda --profile-folder ./logs/$model $model --precision fp32 >>$output 2>&1
13+
done
1814
}
1915

20-
for model in detectron2_maskrcnn_r_101_fpn mnasnet1_0 shufflenet_v2_x1_0 BERT_pytorch detectron2_maskrcnn_r_50_c4 mobilenet_v2 soft_actor_critic Background_Matting detectron2_maskrcnn_r_50_fpn mobilenet_v2_quantized_qat speech_transformer LearningToPaint dlrm mobilenet_v3_large squeezenet1_1 Super_SloMo drq moco tacotron2 alexnet fambench_dlrm nvidia_deeprecommender timm_efficientdet attention_is_all_you_need_pytorch fambench_xlmr opacus_cifar10 timm_efficientnet dcgan fastNLP_Bert pplbench_beanmachine timm_nfnet demucs hf_Albert pyhpc_equation_of_state timm_regnet densenet121 hf_Bart pyhpc_isoneutral_mixing timm_resnest detectron2_fasterrcnn_r_101_c4 hf_Bert pyhpc_turbulent_kinetic_energy timm_vision_transformer detectron2_fasterrcnn_r_101_dc5 hf_BigBird timm_vovnet detectron2_fasterrcnn_r_101_fpn hf_DistilBert pytorch_stargan tts_angular detectron2_fasterrcnn_r_50_c4 hf_GPT2 pytorch_struct vgg16 detectron2_fasterrcnn_r_50_dc5 hf_Longformer pytorch_unet vision_maskrcnn detectron2_fasterrcnn_r_50_fpn hf_Reformer resnet18 yolov3 detectron2_fcos_r_50_fpn hf_T5 resnet50 detectron2_maskrcnn maml resnet50_quantized_qat detectron2_maskrcnn_r_101_c4 maml_omniglot resnext50_32x4d
21-
do
16+
for model in detectron2_maskrcnn_r_101_fpn mnasnet1_0 shufflenet_v2_x1_0 BERT_pytorch detectron2_maskrcnn_r_50_c4 mobilenet_v2 soft_actor_critic Background_Matting detectron2_maskrcnn_r_50_fpn mobilenet_v2_quantized_qat speech_transformer LearningToPaint dlrm mobilenet_v3_large squeezenet1_1 Super_SloMo drq moco tacotron2 alexnet fambench_dlrm nvidia_deeprecommender timm_efficientdet attention_is_all_you_need_pytorch fambench_xlmr opacus_cifar10 timm_efficientnet dcgan fastNLP_Bert pplbench_beanmachine timm_nfnet demucs hf_Albert pyhpc_equation_of_state timm_regnet densenet121 hf_Bart pyhpc_isoneutral_mixing timm_resnest detectron2_fasterrcnn_r_101_c4 hf_Bert pyhpc_turbulent_kinetic_energy timm_vision_transformer detectron2_fasterrcnn_r_101_dc5 hf_BigBird timm_vovnet detectron2_fasterrcnn_r_101_fpn hf_DistilBert pytorch_stargan tts_angular detectron2_fasterrcnn_r_50_c4 hf_GPT2 pytorch_struct vgg16 detectron2_fasterrcnn_r_50_dc5 hf_Longformer pytorch_unet vision_maskrcnn detectron2_fasterrcnn_r_50_fpn hf_Reformer resnet18 yolov3 detectron2_fcos_r_50_fpn hf_T5 resnet50 detectron2_maskrcnn maml resnet50_quantized_qat detectron2_maskrcnn_r_101_c4 maml_omniglot resnext50_32x4d; do
2217

23-
source /home/yhao/d/conda/bin/activate
24-
conda activate pt_aug1
25-
echo "@Yueming Hao origin $model" >>$output
26-
func
18+
source /home/yhao/d/conda/bin/activate
19+
conda activate pt_aug1
20+
echo "@Yueming Hao origin $model" >>$output
21+
func
2722

2823
done
29-

backup_torchbench/run_all_for_overhead.sh

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ cd /home/yhao/d/benchmark
44

55
output=/home/yhao/d/testing/runlog_100ms_train_all.txt
66

7-
func(){
8-
echo "" > $output
7+
func() {
8+
echo "" >$output
99

10-
# for model in fambench_dlrm fambench_xlmr detectron2_maskrcnn vision_maskrcnn timm_efficientnet timm_vision_transformer hf_Bert hf_GPT2 hf_T5
11-
for model in fambench_dlrm fambench_xlmr detectron2_maskrcnn vision_maskrcnn timm_efficientnet timm_vision_transformer hf_Bert hf_GPT2 hf_T5 resnet50 timm_resnest resnext50_32x4d hf_BigBird hf_Bart soft_actor_critic alexnet timm_vovnet mobilenet_v3_large vgg16 shufflenet_v2_x1_0 pytorch_unet dlrm mnasnet1_0 resnet50_quantized_qat tts_angular hf_Reformer nvidia_deeprecommender mobilenet_v2_quantized_qat mobilenet_v2 LearningToPaint hf_Longformer opacus_cifar10 resnet18 timm_regnet dcgan maml BERT_pytorch Super_SloMo pytorch_struct pplbench_beanmachine drq pyhpc_isoneutral_mixing hf_Albert attention_is_all_you_need_pytorch moco Background_Matting pyhpc_turbulent_kinetic_energy maml_omniglot pyhpc_equation_of_state timm_nfnet demucs densenet121 pytorch_CycleGAN_and_pix2pix tacotron2 squeezenet1_1 fastNLP_Bert pytorch_stargan hf_DistilBert speech_transformer yolov3 timm_efficientdet
12-
do
10+
# for model in fambench_dlrm fambench_xlmr detectron2_maskrcnn vision_maskrcnn timm_efficientnet timm_vision_transformer hf_Bert hf_GPT2 hf_T5
11+
for model in fambench_dlrm fambench_xlmr detectron2_maskrcnn vision_maskrcnn timm_efficientnet timm_vision_transformer hf_Bert hf_GPT2 hf_T5 resnet50 timm_resnest resnext50_32x4d hf_BigBird hf_Bart soft_actor_critic alexnet timm_vovnet mobilenet_v3_large vgg16 shufflenet_v2_x1_0 pytorch_unet dlrm mnasnet1_0 resnet50_quantized_qat tts_angular hf_Reformer nvidia_deeprecommender mobilenet_v2_quantized_qat mobilenet_v2 LearningToPaint hf_Longformer opacus_cifar10 resnet18 timm_regnet dcgan maml BERT_pytorch Super_SloMo pytorch_struct pplbench_beanmachine drq pyhpc_isoneutral_mixing hf_Albert attention_is_all_you_need_pytorch moco Background_Matting pyhpc_turbulent_kinetic_energy maml_omniglot pyhpc_equation_of_state timm_nfnet demucs densenet121 pytorch_CycleGAN_and_pix2pix tacotron2 squeezenet1_1 fastNLP_Bert pytorch_stargan hf_DistilBert speech_transformer yolov3 timm_efficientdet; do
1312

14-
# this part is for total overhead
13+
# this part is for total overhead
1514
# echo "@Yueming Hao: start model tests" >> $output
1615
# echo "@Yueming Hao: Run $model" >> $output
1716
# { time python run.py -d cuda -t train $model >> $output 2>&1 ; } 2>> $output
@@ -27,28 +26,27 @@ func(){
2726
# { time python run.py -d cuda -t train --flops dcgm $model >> $output 2>&1 ; } 2>> $output
2827
# echo "@Yueming Hao: end model tests" >> $output
2928

30-
31-
# this part is for computation overhead
32-
echo "@Yueming Hao: start model tests" >> $output
33-
echo "@Yueming Hao: Run $model" >> $output
34-
python run.py -d cuda -t train $model >> $output 2>&1
35-
python run.py -d cuda -t train $model >> $output 2>&1
36-
python run.py -d cuda -t train $model >> $output 2>&1
37-
python run.py -d cuda -t train $model >> $output 2>&1
38-
python run.py -d cuda -t train $model >> $output 2>&1
39-
echo "@Yueming Hao: Run $model with dcgm flops" >> $output 2>&1
40-
python run.py -d cuda -t train --flops dcgm $model >> $output 2>&1
41-
python run.py -d cuda -t train --flops dcgm $model >> $output 2>&1
42-
python run.py -d cuda -t train --flops dcgm $model >> $output 2>&1
43-
python run.py -d cuda -t train --flops dcgm $model >> $output 2>&1
44-
python run.py -d cuda -t train --flops dcgm $model >> $output 2>&1
45-
echo "@Yueming Hao: end model tests" >> $output
46-
done
29+
# this part is for computation overhead
30+
echo "@Yueming Hao: start model tests" >>$output
31+
echo "@Yueming Hao: Run $model" >>$output
32+
python run.py -d cuda -t train $model >>$output 2>&1
33+
python run.py -d cuda -t train $model >>$output 2>&1
34+
python run.py -d cuda -t train $model >>$output 2>&1
35+
python run.py -d cuda -t train $model >>$output 2>&1
36+
python run.py -d cuda -t train $model >>$output 2>&1
37+
echo "@Yueming Hao: Run $model with dcgm flops" >>$output 2>&1
38+
python run.py -d cuda -t train --flops dcgm $model >>$output 2>&1
39+
python run.py -d cuda -t train --flops dcgm $model >>$output 2>&1
40+
python run.py -d cuda -t train --flops dcgm $model >>$output 2>&1
41+
python run.py -d cuda -t train --flops dcgm $model >>$output 2>&1
42+
python run.py -d cuda -t train --flops dcgm $model >>$output 2>&1
43+
echo "@Yueming Hao: end model tests" >>$output
44+
done
4745

4846
}
4947

50-
func
48+
func
5149

5250
# output=runlog_100ms_all.txt
5351

54-
# func
52+
# func
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
#!/bin/bash
22
# This script is used to print out all guard check logs with TorchInductor
33
SHELL_FOLDER=$(
4-
cd "$(dirname "$0")"
5-
pwd
4+
cd "$(dirname "$0")"
5+
pwd
66
)
77
source ${SHELL_FOLDER}/run_base.sh
88

99
cd $tb_path
1010

1111
profile_suffix=logs_profile_${mode}
1212
if [ $env1 ] && [ $env1 != "pt_sep14" ]; then
13-
profile_suffix=logs_profile_${mode}_$env1_$(date +'%Y%m%d%H%M')
13+
profile_suffix=logs_profile_${mode}_$env1_$(date +'%Y%m%d%H%M')
1414
fi
1515

1616
enable_profile=${enable_profile:-0}
1717

1818
enable_amp=${enable_amp:-0}
1919
if [ $enable_amp -eq 1 ]; then
20-
amp_placeholder="--amp"
20+
amp_placeholder="--amp"
2121
else
22-
amp_placeholder=""
22+
amp_placeholder=""
2323
fi
2424

2525
max_iter=1
2626
func_torchinductor() {
27-
if [ $enable_profile -eq 1 ]; then
28-
profile_placeholder="--profile --profile-detailed --profile-devices cpu,cuda --profile-folder ${work_path}/${profile_suffix}/${model}/"
29-
else
30-
profile_placeholder=""
31-
fi
32-
for ((i = 1; i <= $max_iter; i++)); do
33-
python run.py -d cuda $profile_placeholder $amp_placeholder -t $mode --metrics none $model --torchdynamo inductor >>$output 2>&1
34-
done
27+
if [ $enable_profile -eq 1 ]; then
28+
profile_placeholder="--profile --profile-detailed --profile-devices cpu,cuda --profile-folder ${work_path}/${profile_suffix}/${model}/"
29+
else
30+
profile_placeholder=""
31+
fi
32+
for ((i = 1; i <= $max_iter; i++)); do
33+
python run.py -d cuda $profile_placeholder $amp_placeholder -t $mode --metrics none $model --torchdynamo inductor >>$output 2>&1
34+
done
3535
}
3636

3737
source $cuda_env1
@@ -40,8 +40,8 @@ echo $(date) >>$output
4040
conda activate $env1
4141
# for model in $all_models
4242
for model in resnet18 resnet50; do
43-
echo "@Yueming Hao origin $model" >>$output
44-
func_torchinductor
43+
echo "@Yueming Hao origin $model" >>$output
44+
func_torchinductor
4545
done
4646
echo $(date) >>$output
4747
notify

0 commit comments

Comments
 (0)