NVIDIA Deep Learning Examples
ResNeXt101-32x4d for TensorFlow1
Resource
NVIDIA Deep Learning Examples
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=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=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=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=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 128 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=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=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 resnext101-32x4d, by simply running: bash ./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 /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.3879.20
    Training accuracy: NVIDIA DGX-1 (8x V100 16G)

    Our results were obtained by running the /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) / 128 (AMP)79.3579.30
    25064 (FP32) / 128 (AMP)80.2180.21

    Example training loss plot

    TrainingLoss

    Training performance results

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

    Our results were obtained by running the 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)371 img/s1132 img/s3.05x1.00x1.00x
    8128 (TF) / 256 (AMP)2854 img/s8500 img/s2.98x7.69x7.51x
    Training performance: NVIDIA DGX-1 (8x V100 16G)

    Our results were obtained by running the 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 - FP32Throughput - mixed precisionThroughput speedup (FP32 - mixed precision)Weak scaling - FP32Weak scaling - mixed precision
    164 (FP32) / 128 (AMP)166 img/s566 img/s3.40x1.00x1.00x
    864 (FP32) / 128 (AMP)1210 img/s4160 img/s3.44x7.29x7.35x
    Training performance: NVIDIA DGX-2 (16x V100 32G)

    Our results were obtained by running the 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 - FP32Throughput - mixed precisionThroughput speedup (FP32 - mixed precision)Weak scaling - FP32Weak scaling - mixed precision
    164 (FP32) / 128 (AMP)170 img/s572 img/s3.36x1.00x1.00x
    1664 (FP32) / 128 (AMP)2500 img/s7750 img/s3.10x14.70x13.55x

    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~35h~94h
    8~2h~5h
    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~56h~192h
    8~8h~27h
    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~55h~188h
    16~4h~12h

    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
    1111.07 img/s9.04 ms9.05 ms9.10 ms9.45 ms
    2200.35 img/s10.01 ms10.05 ms10.08 ms10.24 ms
    4283.11 img/s14.15 ms14.36 ms14.43 ms14.65 ms
    8416.93 img/s19.19 ms19.64 ms19.90 ms20.14 ms
    16629.64 img/s25.44 ms25.82 ms25.97 ms26.51 ms
    32766.57 img/s41.83 ms42.30 ms42.65 ms43.45 ms
    64836.72 img/s76.50 ms77.07 ms77.44 ms78.72 ms
    128864.37 img/s148.27 ms148.54 ms148.93 ms149.62 ms
    256902.67 img/s283.60 ms284.57 ms285.02 ms285.74 ms

    TF32 Inference Latency + XLA

    Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
    1107.46 img/s9.34 ms9.36 ms9.40 ms9.95 ms
    2192.54 img/s10.42 ms10.48 ms10.54 ms11.21 ms
    4280.89 img/s14.26 ms14.41 ms14.53 ms14.94 ms
    8387.41 img/s20.65 ms21.19 ms21.37 ms21.74 ms
    16676.19 img/s23.67 ms24.34 ms24.55 ms25.61 ms
    32902.44 img/s35.46 ms36.22 ms36.40 ms37.00 ms
    641028.06 img/s62.34 ms63.46 ms64.38 ms72.65 ms
    1281096.39 img/s116.80 ms118.10 ms118.82 ms121.00 ms
    2561153.50 img/s221.93 ms223.18 ms223.49 ms223.90 ms

    Mixed Precision Inference Latency

    Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
    1127.96 img/s7.84 ms7.88 ms7.92 ms8.00 ms
    2243.62 img/s8.24 ms8.28 ms8.31 ms8.58 ms
    4491.02 img/s8.18 ms8.36 ms8.43 ms8.99 ms
    8952.95 img/s8.40 ms8.80 ms8.94 ms9.31 ms
    161625.38 img/s9.85 ms10.19 ms10.45 ms10.86 ms
    321991.14 img/s16.22 ms16.46 ms16.78 ms17.59 ms
    642138.11 img/s30.08 ms31.02 ms31.34 ms32.27 ms
    1282140.59 img/s59.81 ms61.37 ms61.77 ms62.53 ms
    2562185.86 img/s117.12 ms118.35 ms118.72 ms119.84 ms

    Mixed Precision Inference Latency + XLA

    Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
    186.02 img/s11.66 ms11.78 ms11.82 ms12.18 ms
    2166.91 img/s12.01 ms12.10 ms12.14 ms12.25 ms
    4330.75 img/s12.10 ms12.45 ms12.87 ms13.27 ms
    8675.53 img/s11.84 ms12.08 ms12.24 ms12.59 ms
    161234.52 img/s13.06 ms13.89 ms14.11 ms15.01 ms
    322501.78 img/s13.09 ms14.14 ms15.25 ms25.57 ms
    643049.35 img/s21.12 ms22.24 ms23.27 ms28.62 ms
    1283324.24 img/s38.98 ms40.07 ms40.81 ms51.07 ms
    2563166.28 img/s82.05 ms94.93 ms101.78 ms119.88 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
    198.34 img/s10.24 ms10.27 ms10.32 ms12.89 ms
    2167.04 img/s11.98 ms12.17 ms12.24 ms12.59 ms
    4214.18 img/s18.68 ms18.80 ms18.88 ms19.73 ms
    8259.96 img/s30.78 ms31.04 ms31.08 ms31.44 ms
    16350.71 img/s45.63 ms45.81 ms45.88 ms47.96 ms
    32407.80 img/s78.74 ms78.66 ms79.04 ms110.32 ms
    64461.88 img/s138.57 ms139.34 ms139.68 ms141.54 ms
    128493.61 img/s259.57 ms260.38 ms260.84 ms262.40 ms

    Mixed Precision Inference Latency

    Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
    184.74 img/s11.85 ms11.95 ms12.02 ms12.17 ms
    2183.64 img/s10.94 ms11.08 ms11.18 ms11.36 ms
    4359.91 img/s11.17 ms11.35 ms11.46 ms11.80 ms
    8736.61 img/s10.87 ms11.17 ms11.31 ms11.46 ms
    161058.59 img/s15.22 ms15.30 ms15.47 ms16.51 ms
    321152.14 img/s28.03 ms27.99 ms28.11 ms29.55 ms
    641275.35 img/s50.38 ms50.41 ms50.52 ms51.39 ms
    1281347.11 img/s95.02 ms95.51 ms95.70 ms96.29 ms

    Mixed Precision Inference Latency + XLA

    Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
    159.84 img/s16.77 ms16.95 ms17.00 ms17.23 ms
    2120.41 img/s16.66 ms16.90 ms16.97 ms17.21 ms
    4242.75 img/s16.48 ms16.96 ms17.10 ms17.55 ms
    8466.47 img/s17.15 ms17.50 ms17.65 ms17.94 ms
    16861.72 img/s18.69 ms19.19 ms19.33 ms19.68 ms
    321472.21 img/s22.06 ms22.32 ms22.82 ms23.91 ms
    641728.76 img/s37.24 ms37.49 ms37.65 ms38.08 ms
    1281892.97 img/s67.62 ms68.24 ms68.49 ms69.47 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
    196.91 img/s10.38 ms10.46 ms10.53 ms11.32 ms
    2163.02 img/s12.33 ms12.54 ms12.77 ms13.45 ms
    4206.76 img/s19.35 ms19.52 ms19.63 ms20.09 ms
    8249.68 img/s32.05 ms32.24 ms32.31 ms33.26 ms
    16330.36 img/s48.43 ms48.63 ms48.69 ms49.03 ms
    32399.97 img/s80.00 ms80.44 ms80.62 ms81.28 ms
    64481.88 img/s132.94 ms133.05 ms133.16 ms133.71 ms
    128519.85 img/s246.22 ms247.09 ms247.71 ms250.49 ms

    Mixed Precision Inference Latency

    Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
    1108.86 img/s9.24 ms9.36 ms9.42 ms9.57 ms
    2215.01 img/s9.36 ms9.42 ms9.46 ms9.68 ms
    4422.09 img/s9.48 ms9.70 ms9.80 ms10.10 ms
    8791.52 img/s10.12 ms10.24 ms10.32 ms10.58 ms
    161064.30 img/s15.16 ms15.27 ms15.32 ms17.23 ms
    321190.90 img/s27.11 ms27.00 ms27.10 ms27.97 ms
    641319.63 img/s48.49 ms48.73 ms48.82 ms49.32 ms
    1281397.36 img/s91.60 ms91.93 ms92.07 ms92.61 ms

    Mixed Precision Inference Latency + XLA

    Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
    176.34 img/s13.16 ms13.37 ms13.49 ms13.74 ms
    2150.90 img/s13.31 ms13.54 ms13.61 ms13.87 ms
    4284.88 img/s14.10 ms15.28 ms15.38 ms15.68 ms
    8587.77 img/s13.61 ms13.87 ms13.94 ms14.06 ms
    161089.95 img/s14.80 ms14.91 ms15.04 ms15.46 ms
    321503.51 img/s21.55 ms21.33 ms21.38 ms21.91 ms
    641765.86 img/s36.47 ms36.39 ms36.51 ms37.15 ms
    1282003.04 img/s63.91 ms64.95 ms65.07 ms65.47 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
    131.92 img/s31.42 ms31.58 ms31.78 ms37.56 ms
    245.62 img/s43.92 ms44.83 ms45.80 ms46.99 ms
    470.42 img/s56.80 ms57.14 ms57.47 ms59.30 ms
    885.68 img/s93.36 ms93.66 ms93.76 ms94.15 ms
    1699.58 img/s160.65 ms160.91 ms161.39 ms162.34 ms
    32105.04 img/s304.63 ms305.53 ms305.96 ms307.22 ms
    64108.31 img/s590.85 ms591.31 ms591.70 ms593.23 ms
    128110.05 img/s1163.04 ms1163.52 ms1163.75 ms1164.24 ms

    Mixed Precision Inference Latency

    Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
    180.61 img/s12.50 ms12.56 ms12.66 ms13.54 ms
    2104.47 img/s19.23 ms19.73 ms19.92 ms20.68 ms
    4143.68 img/s27.91 ms28.42 ms28.71 ms29.47 ms
    8176.65 img/s45.29 ms45.93 ms46.15 ms46.75 ms
    16203.55 img/s78.60 ms78.95 ms79.25 ms79.74 ms
    32209.77 img/s152.54 ms153.41 ms153.75 ms154.82 ms
    64222.97 img/s287.03 ms287.91 ms288.27 ms289.56 ms
    128226.19 img/s565.89 ms566.21 ms566.38 ms567.52 ms

    Mixed Precision Inference Latency + XLA

    Batch SizeAvg throughputAvg latency90% Latency95% Latency99% Latency
    154.68 img/s18.40 ms19.17 ms19.34 ms19.53 ms
    2102.20 img/s19.67 ms20.37 ms20.55 ms24.65 ms
    4153.96 img/s26.05 ms26.31 ms27.01 ms28.96 ms
    8177.98 img/s44.94 ms45.25 ms45.43 ms45.66 ms
    16237.70 img/s67.31 ms68.35 ms68.87 ms69.63 ms
    32241.79 img/s132.34 ms133.18 ms133.87 ms134.92 ms
    64263.80 img/s242.60 ms244.25 ms245.27 ms246.56 ms
    128272.17 img/s470.29 ms471.29 ms471.78 ms473.61 ms

    NVIDIA uses cookies to improve your experience on our web site. We and our third-party partners also use cookies and other tools to collect and record information you provide as well as information about your interactions with our websites for performance improvement, analytics, and to assist in marketing efforts. By clicking "Accept All", you consent to our use of cookies and other tools as described in our Cookie Policy. You can manage your cookie settings by clicking on "Manage Settings." By continuing to use this site or by clicking one of the buttons below, you agree to our Terms of Service (which contains important waivers). Please see our Privacy Policy for more information on our privacy practices.