본문 바로가기
HW Knowledge

NVIDIA GPU 관련 이해 (feat. vs. CPU)

by 스쳐가는인연 2022. 3. 31.

아는 것이 부족하여, 공부해보지만, 이해력이 떨어져서 가성비가 ... 슬픈 현실 ...

 

GPU가 주요해진 것은 하루 이틀의 이야기는 아니지만, 외면하기엔 너무도 발목을 잡고 있어

조금이라도 알아보고자, 자료를 보고 또 보면서 ... 시간이 지나면 잊겠지만, 기록은 남기에 ...

 

CPU vs GPU

CPU(Central Processing Unit) GPU(Graphics Processing Unit)
Several cores Many cores
Low latency High throughput
Good for serial processing Good for parallel processing
Can do a handful of operations at once Can do thousands of operations at once

 

CPU(Central Processing Unit)는 다양한/여러 복잡한 명령(미리 정의되어 있어 이해하고 처리할 수 있는 명령이 대략 900개 이상)을 빠르게 순차적 처리하는 것이 주 목적

GPU(Graphics Processing Unit)는 (상대적으로?) 단순한/(정해진 소수) 명령(미리 정의되어 있어 이해하고 처리할 수 있는 명령이 대략 100개 이하)을 많이/동시에 처리하는 것이 주 목적

 

CPU는 일반적으로 GPU보다 빠르며(높은 Clock 속도), 더 많은 명령을 수행할 수 있음 (처리: GPU 2 / CPU 30+ or higher)

CPU는 분기 또는 루프가 있는 코드 수행에 적합

GPU는 CPU대비 FP 연산에 최적화 되어 있음

GPU는 분기 또는 루프가 없는 코드 수행에 적합 / 분기 발생 시, 연관 그룹의 core가 동일 연산이 아닌 경우, 동일 수행 시까지 대기/지연이 발생됨

 

 

CUDA core는 한 Cycle(1 GPU clock)에 하나의 FP32 연산을 여러 core에서 처리함

- Pascal 이전의 세대에서 사용된 core

- Warp(GPU의 명령 수행 단위 그룹으로, 32개 core/thread(lane)가 하나의 warp)으로 묶인/공유하는 core는 같은/동일 연산이 필요한 경우 득이나, 서로 다른 연산이 필요한 경우 또는 앞의 연산 결과가 뒤의 연산에 영향을 주는 경우 등의 상황에, 필요 수행 core외 나머지 core는 대기(땡땡이) 하는 상황이 발생할 수 있음

Tensor core는 한 Cycle(1 GPU clock)에 64개 FP16 연산을 처리할 수 있음 (4x4 행렬 연산 수행)

- Volta 이후의 세대에서 사용된 core (CUDA core(FP32) 대비 빠른 처리 속도를 얻으나, 정확도는 일부 낮아짐(FP16))

- Ampere 이후 FP16 연산의 정확도를 보정/보완하도록 개선됨

 

Nvidia - Supported core precisions

 

Note. 연관용어...

AMD의 경우, 64개 thread를 하나의 묶음으로 wavefront 라고 부름.

HIP(The Heterogeneous Interface for Portability), CUDA에 대응되는(?) AMD의 개발 환경

CUDA(Compute Unified Device Architecture)는 NVIDIA의 독자적 개발 환경

 

 

보다 상세한 정보는 많은 전문가 분들의 기고글에서 참조 필요...

 

참고자료:

What’s the Difference Between a CPU and a GPU? : https://blogs.nvidia.com/blog/2009/12/16/whats-the-difference-between-a-cpu-and-a-gpu/

CUDA : https://en.wikipedia.org/wiki/CUDA
CUDA Cores vs. Tensor Cores : https://dreamgonfly.github.io/blog/cuda-cores-vs-tensor-cores/
What is the difference between CUDA cores and Tensor cores? : https://www.quora.com/What-is-the-difference-between-CUDA-cores-and-Tensor-cores

NVIDIA TENSOR CORES: https://www.nvidia.com/en-us/data-center/tensor-cores/

엔비디아 A100 GPU의 AI 성능이 달라진 이유는 엔비디아 암페어 아키텍처, TF32로 단정밀도 연산 가속화하고 코드 변경 없이 높은 정확성 유지한다
https://blogs.nvidia.co.kr/2020/05/22/tensorfloat-32-precision-format/

What’s the Difference Between Single-, Double-, Multi- and Mixed-Precision Computing?
https://blogs.nvidia.com/blog/2019/11/15/whats-the-difference-between-single-double-multi-and-mixed-precision-computing/

What's a Tensor? : https://www.youtube.com/watch?v=f5liqUk0ZTw
Tensor Cores in a Nutshell : https://www.youtube.com/watch?v=yyR0ZoCeBO8
What are Tensor Cores? : https://www.youtube.com/watch?v=fqQyopIWN-8
Analysis of a Tensor Core : https://www.youtube.com/watch?v=xjjN9q2ym6s

What Are CUDA Cores? : https://www.youtube.com/watch?v=JFhG9UntZs4
Intro to CUDA (part 1): High Level Concepts : youtube.com/watch?v=4APkMJdiudU
Intro to CUDA (part 2): Programming Model : https://www.youtube.com/watch?v=cKI20rITSvo

쿠다, CUDA, GPGPU 강의 강좌 1강 : https://www.youtube.com/watch?v=F_SvRKSZ7B4
[NVIDIA AI Conference 정리] Tensorcore를 이용한 딥러닝 학습 가속을 쉽게 하는 방법 : https://brstar96.github.io/dl%20training%20tip/event&seminar/NVIDIAAIConf_session1/

 

Using CUDA Warp-Level Primitives : https://developer.nvidia.com/blog/using-cuda-warp-level-primitives/
SIMT (Single Instruction, Multiple Thread). NVIDIA GPUs execute warps of 32 parallel threads using SIMT,
Introduction to GPUs CUDA : https://nyu-cds.github.io/python-gpu/02-cuda/
thread, warp and SIMT: https://wh00300.tistory.com/82

 

 

 

 

 

반응형