Analysis of Programming Techniques for Creating Optimized CUDA Software

최적화된 CUDA 소프트웨어 제작을 위한 프로그래밍 기법 분석

  • 김성수 (서강대학교 컴퓨터공학과) ;
  • 김동헌 (서강대학교 컴퓨터공학과) ;
  • 우상규 (서강대학교 컴퓨터공학과) ;
  • 임인성 (서강대학교 컴퓨터공학과)
  • Received : 2009.12.15
  • Accepted : 2010.04.27
  • Published : 2010.07.15

Abstract

Unlike general-purpose CPUs, the GPUs have been specialized as many-core streaming processors, and are frequently replacing the CPUs in an increasing range of computations thanks to their outstanding parallel computing capacity. In order to respond to such trend, NVIDIA has recently issued a new parallel computing architecture called CUDA(Compute Unified Device Architecture), offering a flexible GPU programming environment for GPGPU(General Purpose GPU) computing. In general, when programmers use the CUDA API, they should clearly understand many aspects of GPU's computing architecture to produce efficient parallel software. In this article, we explain several optimization techniques for CUDA programming that we have verified through a lot of experiment and trial and error, and review how those techniques affect the performance of code execution. In particular, we use a specific problem as an example to analyze several elements that affect performances, such as effective accesses to hierarchical memory system, processor occupancy, and latency hiding. In conclusion, we present several directions that may be utilized effectively in CUDA-based parallel programming.

GPU(Graphics Processing Unit)는 범용 CPU와는 달리 다수코어 스트리밍 프로세서(manycore streaming processor) 형태로 특화되어 발전되어 왔으며, 최근 뛰어난 병렬 처리 연산 능력으로 인하여 점차 많은 영역에서 CPU의 역할을 대체하고 있다. 이러한 추세에 따라 최근 NVIDIA 사에서는 GPGPU(General Purpose GPU) 아키텍처인 CUDA(Compute Unified Device Architecture)를 발표하여 보다 유연한 GPU 프로그래밍 환경을 제공하고 있다. 일반적으로 CUDA API를 사용한 프로그래밍 작업시 GPU의 계산구조에 관한 여러 가지 요소들에 대한 특성을 정확히 파악해야 효율적인 병렬 소프트웨어를 개발할 수 있다. 본 논문에서는 다양한 실험과 시행착오를 통하여 획득한 CUDA 프로그래밍에 관한 최적화 기법에 대하여 설명하고, 그러한 방법들이 프로그램 수행의 효율에 어떠한 영향을 미치는지 알아본다. 특히 특정 예제 문제에 대하여 효과적인 계층 구조 메모리의 접근과 코어 활성화 비율(occupancy), 지연 감춤(latency hiding) 등과 같이 성능에 영향을 미치는 몇 가지 규칙을 실험을 통해 분석해봄으로써, 향후 CUDA를 기반으로 하는 효과적인 병렬 프로그래밍에 유용하게 활용할 수 있는 구체적인 방안을 제시한다.

Keywords

Acknowledgement

Supported by : 한국학술진흥재단, 한국과학재단

References

  1. Shuai Che, Michael Boyer, Jiayuan Meng, David Tarjan, Jeremy W. Sheaffer, and kevin Skadron, A Performance Study of General-Purpose Applicaions on Graphics Processors Using CUDA, Journal of Parallel and Distributed Computing, University of Virginia, 2008.
  2. Shane Ryoo, Christopher I. Rodrigues, Sara S. Baghsorkhi, Sam S. Stone, David B. Kirk, and Wen-mei W. Hwu, Optimization Principles and Application Performance Evaluation of a Multithreaded GPU Using CUDA, Proc. 13th ACM SIGPLAN Symp. Principles and Practice of Parallel Programming, ACM Press, 2008.
  3. NVIDIA. http://www.nvidia.com/object/product_geforc e_gtx_280_us.html, 2009.
  4. NVIDIA. NVIDIA CUDA Compute Unified Device Architecture: Programming Guide (Version 2.3), 2009.
  5. Maryam Moazeni, Alex Bui, and Majid Sarrafzadeh, A Memory Optimization Technique for Software- Managed Scratchpad Memory in GPUs, University of California, 2009.
  6. NVIDIA. NVIDIA CUDA Visual Profiler (Version 2.3), 2009.
  7. Joe Stam, Convolution Soup, NVIDIA, 2009.
  8. NVIDIA. NVIDIA CUDA Compute Unified Device Architecture: Technical Brief NVIDIA GeForce GTX 200 GPU Architectural Overview, 2008.
  9. NVIDIA. Optimizing CUDA, 2009.
  10. B. Parhami. Introduction to Parallel Processing: Algorithms and Architectures, Plenum Press, New York, pp.377-379, 1999.
  11. Sobel, I., Feldman,G., A 3x3 Isotropic Gradient Operator for Image Processing, presented at a talk at the Stanford Artificial Project, 1968.
  12. Victor Podlozhnyuk, Image Convolution with CUDA, NVIDIA CUDA 2.0 SDK document, 2007.
  13. Mark Segal, Kurt Akeley, The OpenGL Graphics System: A Specification(Version 2.1 - December 1), 2006.