Skip to content

Commit

Permalink
query GPUs only once each awake time
Browse files Browse the repository at this point in the history
  • Loading branch information
justanhduc committed Nov 4, 2021
1 parent c57f7d9 commit c05651b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,14 +654,15 @@ int next_run_job() {
if (firstjob == 0)
return -1;

/* Query GPUs */
int numFree;
int *freeGpuList = getFreeGpuList(&numFree);

/* Look for a runnable task */
p = firstjob;
while (p != 0) {
if (p->state == QUEUED || p->state == ALLOCATING) {
if (p->num_gpus && p->wait_free_gpus) {
int numFree;
/* get number of free GPUs at the moment */
int *freeGpuList = getFreeGpuList(&numFree);
if (numFree < p->num_gpus) {
/* if fewer GPUs than required then next */
p = p->next;
Expand Down

0 comments on commit c05651b

Please sign in to comment.