Docsity

CUDA Execution Model: A Comprehensive Guide to GPU Programming, Lecture notes of Advanced Computer Architecture

Partial preview of the text

Download CUDA Execution Model: A Comprehensive Guide to GPU Programming and more Lecture notes Advanced Computer Architecture in PDF only on Docsity!

Lecture 4 CUDA Execution

Model II

Kyu Ho Park Mar. 9, 2017

nvidia-smi

nvidia-smi command reports the following:

ļ‚„ MEMORY

ļ‚„ UTILIZATION

ļ‚„ ECC

TEMPERATURE

ļ‚„ POWER

ļ‚„ CLOCK

ļ‚„ COMPUTE

ļ‚„ PIDs

CUDA Execution Model

Local Memory

Local memory does not physically exist. Actually automatic array variables are put in the global memory by the compiler.

Automatic variables other than arrays:

ļ‚„ Put in Register, Scope: Thread, Lifetime:

Kernel

Automatic array variables:

ļ‚„ Put in local memory, Scope: Thread,

Kernel function Host 스스스 Kernel function Device Grid 0 Block Block Block Block 스스스 스스스 스스스 Grid 1 Block Block Block 스스스 스스스 스스스 CUDA Execution Flow

  • (^) One grid execution at a time on a device.
  • (^) Different kernels may have different grid structures.

Fermi SM

Two warp schedulers!

SIMT vs. SIMD

The SIMT (single instruction multiple threads) has 3 features that SIMD does not have.

ļ‚„ Each thread has its own instruction

address counter.

ļ‚„ Each thread has its own register state.

ļ‚„ Each thread may have an independent

execution path.

SIMD Architecture

Data Data Data Data Instructi on

thread execution in a SM

  1. A thread block is scheduled on only one SM.
  2. An SM can have more than one blocks.
  3. Shared Memory is partitioned among thread blocks of the SM.
  4. Registers are partitioned among threads.
  5. All threads in a block execute logically in parallel, but physically not all threads execute at the same time. 6.Warps in a thread block may be scheduled in any order. The number of active warps is limited by SM resources. 7.Switching between concurrent warps has no overhead because hardware resources are partitioned among all threads and blocks on an SM, so the state of the newly scheduled warp is already stored on the SM.

Fermi Architecture

16 load/store unit, allowing source and destination addresses to be calculated for 16 threads per clock cycle. Special function units (SFUs) execute one intrinsic instruction per thread per clock cycle