ASCI Logo
ASCI.Academy
LearnPracticeCompeteCareer
Sign InGet Started

Search ASCI Academy

Universal search across Courses, Lessons, Skills, Projects, Challenges, Competitions, Jobs, Internships, and Users

nvidia dli-deep-learning

Curriculum Index

Current LevelInitiate
0/ 500 XP
Gravit Certificate:
100% Required
  • 1.1 CUDA Global Thread Index Calculation
•
1
2
3
4
5
6
7
8
9
10
Module 1: CUDA Architecture & Memory Hierarchy•Lesson 1

1.1 CUDA Global Thread Index Calculation

### CUDA 1D Thread Indexing
In CUDA, threads execute in blocks. To map each thread to an element in an array, compute the global index:

``c
int idx = blockIdx.x * blockDim.x + threadIdx.x;
``
Python 3.11
•
Interactive Challenge
+50 XP
Challenge Objective

Compute the global CUDA thread index for block 3, blockDim 256, thread 42.

solution.py
UTF-84 SpacesAuto-saved
cpython3.11:~/workspace
CPython 3.11.8 (WASM)
$python3 -u solution.py
Click "Compile & Run" (or press Ctrl + Enter) to compile AST, verify bytecode, and execute the solution.