bugger.
All challenges/Pythonmediumcuda-block-reduction-v1
THE INVESTIGATION

Reduce partial blocks

Compute a sum per simulated thread block, including an incomplete final block.

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 values (a list of integers) and a positive block_size, return {"block_sums": [...], "total": integer}. Consecutive block_size values belong to each block. Sum the final partial block too; an empty input has no blocks and total zero.

Expected behavior

Compute a sum per simulated thread block, including an incomplete final block.

Reproduction

01 Case 1
{"values": [1, 2, 3, 4, 5], "block_size": 2}
{"block_sums": [3, 7, 5], "total": 15}
02 Case 2
{"values": [1, 2, 3, 4], "block_size": 2}
{"block_sums": [3, 7], "total": 10}
03 Case 3
{"values": [], "block_size": 4}
{"block_sums": [], "total": 0}

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.
    Read-only preview
    Ready when you are
    Every fix starts with a failing test.

    Read the report, then sign in to start your investigation.