Skip to main content
QUICK REVIEW

[Paper Review] Comparative Analysis of CPU and GPU Profiling for Deep Learning Models

Dipesh Gyawali|arXiv (Cornell University)|Sep 5, 2023
Parallel Computing and Optimization TechniquesComputer Science6 citations
TL;DR

This paper compares CPU and GPU profiling for deep learning models using PyTorch and NVIDIA tools, demonstrating that GPUs significantly reduce training time (from 13 hours on CPU to 2 hours on GPU for 20 epochs) while maintaining similar test accuracy (98–99%). The study quantifies time, memory, power, and temperature differences across batch sizes, revealing GPU memory underutilization at low batch sizes and high CPU utilization during data loading.

ABSTRACT

Deep Learning(DL) and Machine Learning(ML) applications are rapidly increasing in recent days. Massive amounts of data are being generated over the internet which can derive meaningful results by the use of ML and DL algorithms. Hardware resources and open-source libraries have made it easy to implement these algorithms. Tensorflow and Pytorch are one of the leading frameworks for implementing ML projects. By using those frameworks, we can trace the operations executed on both GPU and CPU to analyze the resource allocations and consumption. This paper presents the time and memory allocation of CPU and GPU while training deep neural networks using Pytorch. This paper analysis shows that GPU has a lower running time as compared to CPU for deep neural networks. For a simpler network, there are not many significant improvements in GPU over the CPU.

Motivation & Objective

  • To analyze and compare CPU and GPU resource utilization during deep learning model training.
  • To identify performance bottlenecks in training workflows using profiling tools.
  • To evaluate the impact of hyperparameters like batch size on time, memory, and power consumption.
  • To provide actionable insights for optimizing deep neural network training on CPU and GPU.

Proposed method

  • Trained a dog-cat classifier using PyTorch on a system with two NVIDIA A6000 GPUs and a multi-core CPU.
  • Employed PyTorch Profiler and TensorBoard to trace and log time and memory usage per operation at each training step.
  • Monitored GPU and CPU utilization, memory allocation, temperature, and power consumption using NVIDIA system commands and profiling tools.
  • Executed experiments with batch sizes of 64 and 128 to assess scalability and resource consumption differences.
  • Measured inference throughput and training time to compare CPU and GPU performance across metrics.
  • Visualized execution breakdowns using operator-wise profiling to identify time-consuming operations like data transfer to GPU.
Figure 1: CPU and GPU
Figure 1: CPU and GPU

Experimental results

Research questions

  • RQ1How does GPU utilization compare to CPU utilization during the training of a deep neural network?
  • RQ2What is the impact of batch size on GPU and CPU memory consumption and utilization?
  • RQ3How do power consumption and temperature vary between CPU and GPU during model training?
  • RQ4What is the difference in training time between CPU and GPU for the same deep learning model?
  • RQ5How does inference throughput differ between CPU and GPU deployments?

Key findings

  • Training the same model on CPU took approximately 13 hours for 20 epochs, while GPU training completed in just 2 hours with a batch size of 64.
  • GPU utilization reached up to 50% with a batch size of 64 and increased to 70% with a batch size of 128, indicating better scalability at higher batch sizes.
  • CPU memory usage remained constant at 32 GB out of 512 GB regardless of batch size, while GPU memory usage increased from ~3.4 GB to ~5 GB on GPU:0 with higher batch size.
  • The GPU:0 temperature peaked at 69°C with a batch size of 128, while CPU temperature remained between 60–70°C across all configurations.
  • Power consumption for GPU:0 reached 152W out of 300W, while GPU:1 used only 23W, indicating uneven load distribution across GPUs.
  • Inference time was 5 seconds per image on CPU, compared to 2–3 seconds on GPU, showing a significant throughput advantage for GPU inference.
Figure 2: NVIDIA A6000 specification
Figure 2: NVIDIA A6000 specification

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.