본문 바로가기

NVIDIA48

Array of Structures 와 Structure of Arrays References Professional CUDA C Programming Contents Array of Structures vs. Structure of Arrays 여기 두 가지 데이터를 구성하는 방법이 있습니다. Array of Structures (AoS) Structure of Arrays (SoA) 이 두 가지 방법은 각각 두 가지의 데이터 타입(구조체와 배열)을 활용할 수 있는 다른 방법을 보여주기 때문에 항상 흥미로운 주제입니다. 두 개의 float 데이터를 저장하는 예제를 살펴보겠습니다. 먼저, AoS 방법을 사용하면, innerStruct라는 배열을 정의할 수 있습니다. struct innerStruct { float x; float y; }; 그리고 이 구조체의 배열을 정의합니다... 2022. 1. 15.
Zero-Copy Memory & Unified Virtual Addressing References Professional CUDA C Programming Contents Zero-Copy Memory Unified Virtual Addressing Zero-Copy Memory 일반적으로 host는 device 변수에 직접 액세스할 수 없고, device는 host 변수에 직접 액세스할 수 없습니다. 하지만 여기에 한 가지 예외인 zero-copy 메모리가 있습니다. host와 device는 모두 zero-copy 메모리에 액세스할 수 있습니다. GPU 스레드들은 직접 zero-copy 메모리에 액세스할 수 있습니다. zero-copy 메모리를 커널 내에서 사용하면 다음의 몇 가지 이점을 얻을 수 있습니다. Leveragin host memory when there is insu.. 2022. 1. 15.
Pinned Memory References Professional CUDA C Programming Contents Pinned Memory Pinned Memory 할당된 Host 메모리는 기본적으로 pageable합니다. 즉, OS에 의해 host의 가상 메모리에서 다른 물리 메모리로 데이터를 이동하는 페이지 폴트(page fault) 동작이 일어날 수 있습니다. L1 캐시가 물리적으로 사용 가능한 메모리보다 훨씬 더 많은 on-chip 메모리를 제공하는 것처럼 가상 메모리는 물리적으로 사용 가능한 것보다 훨씬 더 많은 메모리를 제공합니다. GPU에서는 host OS가 데이터를 물리적으로 이동하는 시점을 제어할 수 없기 때문에 pageable한 host 메모리에 있는 데이터를 안전하게 액세스할 수 없습니다. pageable.. 2022. 1. 14.
CUDA Memory Model References Professional CUDA C Programming Contents CUDA Memory Model Memory Types Example for Static Global Memory 아래의 이전 포스팅에서 행렬곱 커널에 대해서 알아보며, CUDA의 메모리 타입에 대해서 언급을 했었습니다. CUDA의 메모리 Access와 Type (예제 : matrix multiplication) CUDA의 메모리 Access와 Type (예제 : matrix multiplication) References Programming Massively Parallel Processors Contents 메모리 액세스 효율 (compute-to-global-memory-access) Matrix Mult.. 2022. 1. 13.
Nested Reduction (Dynamic Parallelism) References Professional CUDA C Programming Contents Dynamic Parallelism Nested Reduction (reduction problem) 이번 포스팅에서는 지난 포스팅에서 살펴본 Sum Reduction을 동적 병렬(Dynamic Parallelism)을 사용한 커널로 구현할 예정입니다. Warp의 Branch Divergence (reduction problem) Warp의 Branch Divergence (reduction problem) References Professional CUDA C Programming Contents Parallel Reduction Neighbored vs Interleaved Approach Unrolling .. 2022. 1. 11.
Warp의 Branch Divergence (reduction problem) References Professional CUDA C Programming Contents Parallel Reduction Neighbored vs Interleaved Approach Unrolling Loops Use template parameter in device functions (템플릿 파라미터 사용) Divergent Wraps (예제 : Sum Reduction) Divergent Wraps (예제 : Sum Reduction) References Programming Massively Parallel Processors https://developer.download.nvidia.com/assets/cuda/files/reduction.pdf Contents Warp Partioni.. 2022. 1. 8.
Nsight Compute로 Warp 성능 측정하기 References Professional CUDA C Programming https://docs.nvidia.com/nsight-compute/NsightComputeCli/index.html Contents Matrix Addition 예제 Active Warp 측정 Memory Operations 측정 WARP Execution WARP Execution References Professional CUDA C Programming https://docs.nvidia.com/gameworks/content/developertools/desktop/analysis/report/cudaexperiments/kernellevel/issueefficiency.htm Contents Warps 이해하기 Wa.. 2022. 1. 7.
WARP Execution References Professional CUDA C Programming https://docs.nvidia.com/gameworks/content/developertools/desktop/analysis/report/cudaexperiments/kernellevel/issueefficiency.htm Contents Warps 이해하기 Warp Divergence Resource Partitioning Latency Hiding Occupancy 지금까지 CUDA 프로그래밍과 GPU 아키텍처에 대해서 쭉 알아왔는데, Warp에 대해서 자세하게 살펴볼 기회가 없어서 이번에 Warp에 대해서 조금 더 공부하면서 이번 포스팅을 준비했습니다. 커널이 실행될 때, 소프트웨어의 관점에서는 커널의 모든 스레드들.. 2022. 1. 5.
CUDA Dynamic Parallelism (동적 병렬) References https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html Programming Massively Parallel Processors Contents Dynamic Parallelism Overview Memory Data Visibility Execution Environment Synchronization, Streams, and Events CUDA Dynamic Parallelism(동적 병렬)은 CUDA 프로그래밍 모델의 확장이며, CUDA 커널이 새로운 커널을 launch함으로써 새로운 스레드 그리드를 만들 수 있게 해줍니다. 동적 병렬은 Kepler 아키텍처에서 도입되었고, GK110 칩에서 처음 선보였습니다. 과거.. 2022. 1. 1.
Graph Search (Breadth-First Search) References Programming Massively Parallel Processors Contents Breadth-First Search (BFS) A Sequential BFS Function A Parallel BFS Function Optimization 이번에 살펴 볼 병렬 패턴은 Graph Search입니다. 그래프는 개체(entity)간의 관계(relation)를 나타내는 자료구조이며, 이 개체(entity)는 vertices(정점)으로 표현하고 관계는 edges(간선)으로 표현합니다. 세상의 많은 중요한 문제들은 아주 큰 스케일의 그래프 문제로 볼 수 있습니다. 예를 들면, 소셜 네트워크나 네비게이션 등이 있습니다. 그래프는 알고보면 희소 행렬(sparse matrix)와도 관련이.. 2021. 12. 30.