From a8045aaefbb0f07b2cf58daf1acf46c541327061 Mon Sep 17 00:00:00 2001 From: Newnius Date: Mon, 6 Jul 2020 10:29:22 +0800 Subject: [PATCH] update --- src/job_manager.go | 2 +- src/resource_pool.go | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/job_manager.go b/src/job_manager.go index 45f01ce..0a5e869 100644 --- a/src/job_manager.go +++ b/src/job_manager.go @@ -88,7 +88,7 @@ func (jm *JobManager) start() { if GPU.MemoryUsed == GPU.MemoryTotal { shouldWait = "1" isScheduleAhead = true - } else if GPU.MemoryUsed > 0 { + } else if GPU.MemoryAllocated > 0 { isShare = true } /* attach to GPUs */ diff --git a/src/resource_pool.go b/src/resource_pool.go index 13a3f94..71b72d7 100644 --- a/src/resource_pool.go +++ b/src/resource_pool.go @@ -714,7 +714,6 @@ func (pool *ResourcePool) doAcquireResource(job Job) []NodeStatus { if len(job.Tasks) == 0 { return []NodeStatus{} } - task := job.Tasks[0] segID := rand.Intn(pool.poolsCount) if pool.TotalGPU < 100 { segID = 0 @@ -739,6 +738,7 @@ func (pool *ResourcePool) doAcquireResource(job Job) []NodeStatus { loadRatio := float64(pool.UsingGPU) / float64(pool.TotalGPU) /* first, choose sharable GPUs */ + task := job.Tasks[0] if len(job.Tasks) == 1 && task.NumberGPU == 1 && loadRatio >= config.EnableShareRatio { // check sharable allocationType = 1 @@ -803,8 +803,6 @@ func (pool *ResourcePool) doAcquireResource(job Job) []NodeStatus { } node.Status[j].MemoryAllocated += task.MemoryGPU res.Status[i].MemoryTotal = task.MemoryGPU - /* being used, means share */ - res.Status[i].MemoryUsed = 100 } } } @@ -917,7 +915,7 @@ func (pool *ResourcePool) doAcquireResource(job Job) []NodeStatus { node.Status[j].MemoryAllocated += task.MemoryGPU res.Status[i].MemoryTotal = task.MemoryGPU /* being fully used, means ahead */ - res.Status[i].MemoryUsed = task.MemoryGPU + res.Status[i].MemoryUsed = res.Status[i].MemoryTotal } } }