Task 1 of 6
Nearly every GPU program you'll ever write is built from a handful of patterns, and the first one has a name: map. Each output cell is a pure function of the input cell at the same index — no neighbors, no shared state, no "first do cell 3, then cell 4". That independence is exactly what lets the GPU run all the cells at once.
Here celsius holds 64 temperature readings. Converting them to Fahrenheit
is a textbook map: reading 7 becomes output 7, and nothing else matters to thread 7.
°F = °C × 9/5 + 32 — one thread per reading.celsius[this.thread.x]c * 9 / 5 + 32A map kernel touches exactly one input cell and one output cell, both at
index this.thread.x. If you find yourself reading any other index,
it's not a map any more.
return celsius[this.thread.x] * 9 / 5 + 32;This page is an interactive exercise — the editor, the GPU runner and your saved progress need JavaScript. The text above is the full brief.