THE INVESTIGATION
Walk a grid-stride loop
Assign every element to its simulated CUDA thread using a grid-stride loop.
LLM ArchitectureML systems
What’s going wrong
Original LLM Architecture lab. This CUDA fundamentals exercise is a deterministic Python simulation, not CUDA code or GPU execution. Implement solve(data) using the Python standard library.
Given length, blocks and threads_per_block, return {"assignments": [[indices for thread 0], ...]} in global thread order. Each thread starts at its global index and advances by blocks * threads_per_block while the index is less than length. length is nonnegative; blocks and threads_per_block are positive.
Expected behavior
Assign every element to its simulated CUDA thread using a grid-stride loop.
Reproduction
01 Case 1
{"length": 10, "blocks": 2, "threads_per_block": 2}{"assignments": [[0, 4, 8], [1, 5, 9], [2, 6], [3, 7]]}02 Case 2
{"length": 4, "blocks": 2, "threads_per_block": 2}{"assignments": [[0], [1], [2], [3]]}03 Case 3
{"length": 0, "blocks": 1, "threads_per_block": 3}{"assignments": [[], [], []]}Before you begin
- Python lists and loops
Need a nudge?
Reveal one investigation hint at a time. Try each clue before opening the next.
The bug is intentional. Run the starter code to see it fail, then work toward a fix. Difficulty is provisional.
Ready when you are
Every fix starts with a failing test.
Read the report, then sign in to start your investigation.