Debug GPU Resource Allocation
Problem Description
You are tasked with debugging a small codebase for a GPU resource manager. The provided repository includes a README, logs, and unit tests. Your primary goal is to leverage the failing tests and logs to pinpoint root causes, implement minimal necessary fixes, and clearly explain your modifications.
The system's core function is to assign computational jobs to available GPUs. Each job is characterized by its required GPU type, memory requirements, priority level, and optional user-defined preferences for specific GPU IDs or types. Conversely, each GPU is defined by its unique ID, type, available memory capacity, health status, its current lease owner (if any), and the lease's expiration timestamp.
The failing unit tests highlight issues across three distinct functional areas:
1. GPU Scoring and Preference Handling
The system fails to respect a user's explicit GPU preference when multiple GPUs are otherwise valid candidates for a job. This indicates a flaw in the GPU selection or scoring logic.
2. Resource Allocation and Preemption Logic
A critical bug allows a GPU to be assigned to a job without properly creating or updating a corresponding lease. This oversight can lead directly to resource double allocation, where multiple jobs believe they have exclusive access to the same GPU.
3. Smarter Preemption Strategy
When the system determines that preemption of an existing job is necessary to accommodate a higher-priority incoming job, the current logic is flawed. Candidate GPUs for preemption are not being ranked by a defined score before a running job is chosen for eviction. This suggests an inefficient or incorrect preemption decision-making process.
Your explanation should cover your debugging methodology, the specific code sections you would investigate, the minimal code changes you would propose, and how you would validate your fixes using the existing tests and logs.
AI interview prep
Core dilemma
Ensuring correct and efficient resource allocation in a dynamic, multi-tenant environment with complex prioritization and preemption rules, while maintaining system stability and preventing resource contention.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Debug GPU Resource Allocation
Problem Description
You are tasked with debugging a small codebase for a GPU resource manager. The provided repository includes a README, logs, and unit tests. Your primary goal is to leverage the failing tests and logs to pinpoint root causes, implement minimal necessary fixes, and clearly explain your modifications.
The system's core function is to assign computational jobs to available GPUs. Each job is characterized by its required GPU type, memory requirements, priority level, and optional user-defined preferences for specific GPU IDs or types. Conversely, each GPU is defined by its unique ID, type, available memory capacity, health status, its current lease owner (if any), and the lease's expiration timestamp.
The failing unit tests highlight issues across three distinct functional areas:
1. GPU Scoring and Preference Handling
The system fails to respect a user's explicit GPU preference when multiple GPUs are otherwise valid candidates for a job. This indicates a flaw in the GPU selection or scoring logic.
2. Resource Allocation and Preemption Logic
A critical bug allows a GPU to be assigned to a job without properly creating or updating a corresponding lease. This oversight can lead directly to resource double allocation, where multiple jobs believe they have exclusive access to the same GPU.
3. Smarter Preemption Strategy
When the system determines that preemption of an existing job is necessary to accommodate a higher-priority incoming job, the current logic is flawed. Candidate GPUs for preemption are not being ranked by a defined score before a running job is chosen for eviction. This suggests an inefficient or incorrect preemption decision-making process.
Your explanation should cover your debugging methodology, the specific code sections you would investigate, the minimal code changes you would propose, and how you would validate your fixes using the existing tests and logs.