Topology-Aware GPU Allocator That Minimizes Rack Spread
Last updated: November 29, 2026
Quick Overview
Implement an allocator over racks with known free GPU counts that places a job of k GPUs in the single rack with the tightest fit when possible, otherwise spans the fewest racks, and supports releasing a job's GPUs.
Fluidstack
November 29, 20260
0
0 solved
Implement an allocator over racks with known free GPU counts that places a job of k GPUs in the single rack with the tightest fit when possible, otherwise spans the fewest racks, and supports releasing a job's GPUs.
Training jobs on Fluidstack clusters run fastest when their GPUs share a rack or NVLink domain, because cross-rack traffic crosses more InfiniBand hops. This onsite coding question checks whether you can turn a placement policy into a small stateful class, reason about best-fit versus fewest-racks, and keep allocate and release consistent.
What the Interviewer Expects
- Return None instead of partially allocating when capacity is short
- Use best-fit (smallest sufficient rack) to limit fragmentation
- Span the fewest racks by taking largest-free racks first
- Track per-job placement so release is exact
- Discuss complexity and when a heap or sorted structure helps
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Racks belong to spines. How would you prefer racks under the same spine when a job must span?
- How would you handle requests that must be in multiples of 8 (whole nodes)?
- Best-fit can still fragment the cluster over time. How would you measure and counter that?
- How do you make allocate and release safe under concurrent requests?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
State: free GPU count per rack. allocate(job, k) returns a {rack: count} plan or None if total free is below k; nothing changes on failure. Prefer one rack; among single racks pick the one with ...
High-Level Design
Two-phase greedy. Phase 1: best-fit among racks with free >= k. Phase 2: sort racks by free descending and take greedily; taking the largest first provably minimizes the number of racks for a fixed ...