NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
SE-ResNeXt101-32x4d for TensorFlow1
Resource
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
SE-ResNeXt101-32x4d for TensorFlow1

ResNet with bottleneck 3x3 Convolutions substituted by 3x3 Grouped Convolutions.

The performance measurements in this document were conducted at the time of publication and may not reflect the performance achieved from NVIDIA's latest software release. For the most up-to-date performance measurements, go to NVIDIA Data Center Deep Learning Product Performance.

Benchmarking

The following section shows how to run benchmarks measuring the model performance in training and inference modes.

Training performance benchmark

To benchmark the training performance on a specific batch size, run:

  • For 1 GPU

    • FP32 / TF32

      python ./main.py --arch=se-resnext101-32x4d --mode=training_benchmark --warmup_steps 200 --batch_size <batch size> --data_dir=<path to imagenet> --results_dir=<path to results directory>

    • AMP

      python ./main.py --arch=se-resnext101-32x4d --mode=training_benchmark --amp --warmup_steps 200 --batch_size <batch size> --data_dir=<path to imagenet> --results_dir=<path to results directory>

  • For multiple GPUs

    • FP32 / TF32

      mpiexec --allow-run-as-root --bind-to socket -np <num_gpus> python ./main.py --arch=se-resnext101-32x4d --mode=training_benchmark --batch_size <batch size> --data_dir=<path to imagenet> --results_dir=<path to results directory>

    • AMP

      mpiexec --allow-run-as-root --bind-to socket -np <num_gpus> python ./main.py --arch=se-resnext101-32x4d --mode=training_benchmark --amp --batch_size <batch size> --data_dir=<path to imagenet> --results_dir=<path to results directory>

Each of these scripts runs 200 warm-up iterations and measures the first epoch.

To control warmup and benchmark length, use the --warmup_steps, --num_iter and --iter_unit flags. Features like XLA or DALI can be controlled with --xla and --dali flags. For proper throughput reporting the value of --num_iter must be greater than --warmup_steps value. Suggested batch sizes for training are 96 for mixed precision training and 64 for single precision training per single V100 16 GB.

If no --data_dir=<path to imagenet> flag is specified then the benchmarks will use a synthetic dataset. The resolution of synthetic images used can be controlled with --synthetic_data_size flag.

Inference performance benchmark

To benchmark the inference performance on a specific batch size, run:

  • FP32 / TF32

python ./main.py --arch=se-resnext101-32x4d --mode=inference_benchmark --warmup_steps 20 --num_iter 100 --iter_unit batch --batch_size <batch size> --data_dir=<path to imagenet> --results_dir=<path to results directory>

  • AMP

python ./main.py --arch=se-resnext101-32x4d --mode=inference_benchmark --amp --warmup_steps 20 --num_iter 100 --iter_unit batch --batch_size <batch size> --data_dir=<path to imagenet> --results_dir=<path to results directory>

By default, each of these scripts runs 20 warm-up iterations and measures the next 80 iterations. To control warm-up and benchmark length, use the --warmup_steps, --num_iter and --iter_unit flags. If no --data_dir=<path to imagenet> flag is specified then the benchmarks will use a synthetic dataset.

The benchmark can be automated with the inference_benchmark.sh script provided in se-resnext101-32x4d, by simply running: bash ./se-resnext101-32x4d/inference_benchmark.sh <data dir> <data idx dir>

The <data dir> parameter refers to the input data directory (by default /data/tfrecords inside the container). By default, the benchmark tests the following configurations: FP32, AMP, AMP + XLA with different batch sizes. When the optional directory with the DALI index files <data idx dir> is specified, the benchmark executes an additional DALI + AMP + XLA configuration. For proper throughput reporting the value of --num_iter must be greater than --warmup_steps value.

For performance benchamrk of raw model, synthetic dataset can be used. To use synthetic dataset, use --synthetic_data_size flag instead of --data_dir to specify input image size.

Results

The following sections provide details on how we achieved our performance and accuracy in training and inference.

Training accuracy results

Training accuracy: NVIDIA DGX A100 (8x A100 40GB)

Our results were obtained by running the /se-resnet50v1.5/training/DGXA100_RN50_{PRECISION}_90E.sh training script in the TensorFlow 20.06-tf1-py3 NGC container NGC container on NVIDIA DGX A100 (8x A100 40GB) GPUs.

EpochsBatch Size / GPUAccuracy - TF32 (top1)Accuracy - mixed precision (top1)
90128 (TF32) / 256 (AMP)79.7379.60
Training accuracy: NVIDIA DGX-1 (8x V100 16G)

Our results were obtained by running the /se-resnext101-32x4d/training/{/DGX1_RNxt101-32x4d_{PRECISION}_{EPOCHS}E.sh training script in the TensorFlow 20.06-tf1-py3 NGC container NGC container on NVIDIA DGX-1 with (8x V100 16G) GPUs.

EpochsBatch Size / GPUAccuracy - FP32Accuracy - mixed precision
9064 (FP32) / 96 (AMP)79.6979.81
25064 (FP32) / 96 (AMP)80.8780.84

Example training loss plot

TrainingLoss

Training performance results

Training performance: NVIDIA DGX A100 (8x A100 40GB)

Our results were obtained by running the se-resnext101-32x4d/training/training_perf.sh benchmark script in the TensorFlow 20.06-tf1-py3 NGC container NGC container on NVIDIA DGX A100 (8x A100 40GB) GPUs. Performance numbers (in images per second) were averaged over an entire training epoch.

GPUsBatch Size / GPUThroughput - TF32 + XLAThroughput - mixed precision + XLAThroughput speedup (TF32 - mixed precision)Weak scaling - TF32 + XLAWeak scaling - mixed precision + XLA
1128 (TF) / 256 (AMP)342 img/s975 img/s2.86x1.00x1.00x
8128 (TF) / 256 (AMP)2610 img/s7230 img/s2.77x7.63x7.41x
Training performance: NVIDIA DGX-1 (8x V100 16G)

Our results were obtained by running the se-resnext101-32x4d/training/training_perf.sh benchmark script in the TensorFlow 20.06-tf1-py3 NGC container NGC container on NVIDIA DGX-1 with (8x V100 16G) GPUs. Performance numbers (in images per second) were averaged over an entire training epoch.

GPUsBatch Size / GPUThroughput - FP32 + XLAThroughput - mixed precision + XLAThroughput speedup (FP32 - mixed precision)Weak scaling - FP32 + XLAWeak scaling - mixed precision + XLA
164 (FP32) / 96 (AMP)152 img/s475 img/s3.12x1.00x1.00x
864 (FP32) / 96 (AMP)1120 img/s3360 img/s3.00x7.37x7.07x
Training performance: NVIDIA DGX-2 (16x V100 32G)

Our results were obtained by running the se-resnext101-32x4d/training/training_perf.sh benchmark script in the TensorFlow 20.06-tf1-py3 NGC container NGC container on NVIDIA DGX-2 with (16x V100 32G) GPUs. Performance numbers (in images per second) were averaged over an entire training epoch.

GPUsBatch Size / GPUThroughput - FP32 + XLAThroughput - mixed precision + XLAThroughput speedup (FP32 - mixed precision)Weak scaling - FP32 + XLAWeak scaling - mixed precision + XLA
164 (FP32) / 96 (AMP)158 img/s472 img/s2.98x1.00x1.00x
1664 (FP32) / 96 (AMP)2270 img/s6580 img/s2.89x14.36x13.94x

Training Time for 90 Epochs

Training time: NVIDIA DGX A100 (8x A100 40GB)

Our results were estimated based on the training performance results on NVIDIA DGX A100 with (8x A100 40G) GPUs.

GPUsTime to train - mixed precision + XLATime to train - TF32 + XLA
1~36h~102h
8~5h~14h
Training time: NVIDIA DGX-1 (8x V100 16G)

Our results were estimated based on the training performance results on NVIDIA DGX-1 with (8x V100 16G) GPUs.

GPUsTime to train - mixed precision + XLATime to train - FP32 + XLA
1~68h~210h
8~10h~29h
Training time: NVIDIA DGX-2 (16x V100 32G)

Our results were estimated based on the training performance results on NVIDIA DGX-2 with (16x V100 32G) GPUs.

GPUsTime to train - mixed precision + XLATime to train - FP32 + XLA
1~68h~202h
16~5h~14h

Inference performance results

Inference performance: NVIDIA DGX A100 (1x A100 40GB)

Our results were obtained by running the inference_benchmark.sh inferencing benchmarking script in the TensorFlow 20.06-tf1-py3 NGC container NGC container on NVIDIA DGX A100 with (1x A100 40G) GPU.

TF32 Inference Latency

Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
195.32 img/s10.52 ms10.52 ms10.55 ms11.10 ms
2169.59 img/s11.82 ms11.83 ms11.92 ms12.56 ms
4258.97 img/s15.45 ms15.70 ms15.78 ms16.22 ms
8355.09 img/s22.53 ms22.74 ms22.84 ms23.17 ms
16561.11 img/s28.52 ms28.85 ms29.09 ms29.50 ms
32698.94 img/s45.78 ms46.36 ms46.56 ms46.87 ms
64751.17 img/s85.21 ms86.74 ms87.27 ms87.95 ms
128802.64 img/s159.47 ms160.01 ms160.35 ms161.42 ms
256840.72 img/s304.50 ms305.87 ms306.11 ms306.57 ms

TF32 Inference Latency + XLA

Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
192.46 img/s10.84 ms10.90 ms10.96 ms11.14 ms
2161.55 img/s12.40 ms12.44 ms12.51 ms12.62 ms
4237.41 img/s16.88 ms17.54 ms17.79 ms18.25 ms
8358.39 img/s22.35 ms23.56 ms24.29 ms25.53 ms
16577.33 img/s27.72 ms28.64 ms28.92 ms29.22 ms
32800.81 img/s39.97 ms40.93 ms41.42 ms41.87 ms
64921.00 img/s69.64 ms70.44 ms70.90 ms79.54 ms
1281024.70 img/s124.99 ms125.70 ms126.10 ms138.57 ms
2561089.80 img/s234.90 ms236.02 ms236.37 ms237.26 ms

Mixed Precision Inference Latency

Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
184.06 img/s11.92 ms11.94 ms11.96 ms12.08 ms
2170.38 img/s11.76 ms11.82 ms11.87 ms11.94 ms
4336.09 img/s11.93 ms12.06 ms12.17 ms12.62 ms
8669.91 img/s11.94 ms12.33 ms12.47 ms12.88 ms
161119.49 img/s14.36 ms14.86 ms15.11 ms16.11 ms
321482.46 img/s21.66 ms22.04 ms22.38 ms23.72 ms
641680.85 img/s38.09 ms39.02 ms39.34 ms41.02 ms
1281728.27 img/s74.30 ms74.92 ms75.22 ms75.60 ms
2561761.56 img/s145.33 ms146.54 ms146.83 ms147.34 ms

Mixed Precision Inference Latency + XLA

Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
174.83 img/s13.39 ms13.45 ms13.49 ms13.57 ms
2135.28 img/s14.81 ms14.98 ms15.10 ms16.19 ms
4272.18 img/s14.70 ms15.07 ms15.30 ms15.80 ms
8517.69 img/s15.50 ms16.63 ms17.05 ms18.10 ms
161050.03 img/s15.38 ms16.84 ms17.49 ms17.97 ms
321781.06 img/s18.27 ms19.54 ms20.00 ms25.94 ms
642551.55 img/s25.26 ms26.03 ms26.62 ms29.67 ms
1282834.59 img/s45.50 ms46.85 ms47.72 ms54.91 ms
2563367.18 img/s76.03 ms77.06 ms77.36 ms78.13 ms
Inference performance: NVIDIA DGX-1 (1x V100 16G)

Our results were obtained by running the inference_benchmark.sh inferencing benchmarking script in the TensorFlow 20.06-tf1-py3 NGC container NGC container on NVIDIA DGX-1 with (1x V100 16G) GPU.

FP32 Inference Latency

Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
175.72 img/s13.25 ms13.38 ms13.50 ms13.66 ms
2112.58 img/s17.90 ms20.74 ms20.91 ms21.87 ms
4191.09 img/s20.93 ms21.05 ms21.09 ms21.27 ms
8235.39 img/s33.98 ms34.14 ms34.19 ms34.28 ms
16315.24 img/s50.76 ms50.96 ms51.01 ms51.32 ms
32376.05 img/s85.09 ms85.56 ms85.71 ms86.40 ms
64427.39 img/s149.84 ms150.08 ms150.37 ms161.87 ms
128460.82 img/s277.76 ms278.97 ms279.48 ms280.95 ms

Mixed Precision Inference Latency

Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
166.44 img/s15.10 ms15.17 ms15.25 ms16.01 ms
2132.33 img/s15.16 ms15.32 ms15.37 ms15.50 ms
4273.84 img/s14.63 ms15.14 ms15.83 ms17.38 ms
8509.35 img/s15.71 ms16.10 ms16.21 ms16.55 ms
16770.02 img/s20.78 ms20.96 ms21.03 ms21.24 ms
32926.46 img/s34.55 ms34.88 ms35.05 ms36.32 ms
641039.74 img/s61.55 ms61.82 ms61.99 ms62.32 ms
1281102.00 img/s116.15 ms116.62 ms116.80 ms116.97 ms

Mixed Precision Inference Latency + XLA

Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
158.55 img/s17.12 ms17.21 ms17.28 ms17.42 ms
2105.00 img/s19.10 ms19.29 ms19.36 ms19.67 ms
4207.60 img/s19.31 ms19.59 ms19.67 ms19.84 ms
8413.16 img/s19.37 ms19.77 ms19.87 ms20.24 ms
16739.12 img/s21.80 ms24.48 ms24.71 ms26.93 ms
321196.83 img/s26.99 ms27.10 ms27.49 ms28.80 ms
641470.31 img/s43.74 ms44.02 ms44.18 ms46.28 ms
1281683.63 img/s76.03 ms77.00 ms77.23 ms78.15 ms
Inference performance: NVIDIA DGX-2 (1x V100 32G)

Our results were obtained by running the inference_benchmark.sh inferencing benchmarking script in the TensorFlow 20.06-tf1-py3 NGC container NGC container on NVIDIA DGX-2 with (1x V100 32G) GPU.

FP32 Inference Latency

Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
171.44 img/s14.07 ms14.22 ms14.43 ms16.44 ms
2149.68 img/s13.43 ms13.79 ms13.94 ms16.63 ms
4183.01 img/s21.85 ms22.12 ms22.18 ms22.44 ms
8220.67 img/s36.25 ms36.84 ms37.17 ms37.43 ms
16310.27 img/s51.57 ms51.88 ms52.09 ms53.37 ms
32381.41 img/s83.89 ms84.30 ms84.66 ms85.04 ms
64440.37 img/s145.45 ms145.49 ms145.86 ms147.53 ms
128483.84 img/s264.54 ms265.04 ms265.46 ms266.43 ms

Mixed Precision Inference Latency

Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
173.06 img/s13.74 ms14.07 ms14.20 ms14.35 ms
2155.23 img/s12.95 ms13.13 ms13.33 ms15.49 ms
4303.68 img/s13.23 ms13.38 ms13.46 ms14.34 ms
8583.43 img/s13.72 ms13.90 ms14.08 ms15.47 ms
16783.30 img/s20.43 ms20.66 ms21.31 ms21.97 ms
32932.10 img/s34.34 ms34.71 ms34.81 ms35.70 ms
641058.07 img/s60.48 ms60.75 ms60.94 ms62.49 ms
1281129.65 img/s113.30 ms113.53 ms113.66 ms114.81 ms

Mixed Precision Inference Latency + XLA

Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
166.43 img/s15.14 ms15.24 ms15.31 ms19.18 ms
2122.85 img/s16.39 ms18.28 ms18.45 ms20.33 ms
4247.80 img/s16.14 ms16.44 ms16.57 ms17.24 ms
8498.19 img/s16.07 ms16.26 ms16.66 ms17.70 ms
16831.20 img/s19.40 ms19.30 ms19.39 ms25.41 ms
321223.75 img/s26.42 ms26.31 ms26.70 ms29.88 ms
641520.64 img/s42.09 ms42.45 ms42.57 ms42.84 ms
1281739.61 img/s73.58 ms73.98 ms74.17 ms74.72 ms
Inference performance: NVIDIA T4 (1x T4 16G)

Our results were obtained by running the inference_benchmark.sh inferencing benchmarking script in the TensorFlow 20.06-tf1-py3 NGC container NGC container on NVIDIA T4 with (1x T4 16G) GPU.

FP32 Inference Latency

Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
127.39 img/s36.68 ms38.85 ms39.01 ms40.40 ms
244.56 img/s44.96 ms46.25 ms46.92 ms48.92 ms
465.11 img/s61.43 ms62.22 ms62.93 ms65.01 ms
880.09 img/s99.88 ms100.34 ms100.85 ms101.79 ms
1693.98 img/s170.24 ms170.72 ms171.27 ms171.98 ms
3299.86 img/s320.42 ms320.99 ms321.37 ms322.28 ms
64103.31 img/s619.44 ms620.08 ms620.55 ms622.19 ms
128105.16 img/s1217.18 ms1218.09 ms1218.59 ms1221.16 ms

Mixed Precision Inference Latency

Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
157.21 img/s17.57 ms18.06 ms18.15 ms20.74 ms
280.34 img/s24.97 ms25.38 ms25.69 ms27.12 ms
4115.12 img/s34.77 ms35.61 ms36.74 ms37.61 ms
8147.51 img/s54.24 ms54.79 ms55.28 ms58.25 ms
16173.83 img/s92.04 ms92.50 ms93.26 ms94.72 ms
32182.19 img/s175.64 ms176.51 ms177.44 ms178.52 ms
64193.20 img/s331.25 ms332.56 ms333.34 ms334.58 ms
128195.17 img/s655.82 ms657.24 ms658.79 ms661.76 ms

Mixed Precision Inference Latency + XLA

Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
146.19 img/s21.72 ms21.90 ms21.93 ms23.64 ms
280.98 img/s24.77 ms24.99 ms25.15 ms25.63 ms
4129.49 img/s30.89 ms31.26 ms31.34 ms32.31 ms
8156.91 img/s51.00 ms52.17 ms52.51 ms53.32 ms
16204.45 img/s78.26 ms79.58 ms79.96 ms80.44 ms
32215.22 img/s148.68 ms149.63 ms150.41 ms151.62 ms
64235.36 img/s272.05 ms273.56 ms274.33 ms275.86 ms
128244.45 img/s523.62 ms525.12 ms525.89 ms528.42 ms