Nvidia: Hash-partition an array on the GPU and return partition offsets
Problem. You get an input array and a partition count P. Hash each element into one of the P partitions, lay the elements out on the GPU so that every partition is contiguous, and return the starting offset of each partition. The screen was in C++.
Expected shape of a solution. The candidate used three passes:
- Count how many elements hash to each partition (a histogram).
- Take a prefix sum over the histogram to get each partition's start offset.
- Scatter each element into its slot.
Follow-ups. Most of the remaining time went on GPU-specific optimization questions. The candidate could not recall them in detail afterwards.
What the interviewer cared about. Getting a correct sequential answer was only the start. The interviewer mainly probed how well the candidate knew GPU execution and memory behaviour. The candidate had little GPU background and rated their answers as average. They still moved to the next round.
Comments 0
No comments yet. Ask the author something, or add what happened in your own round.