zhangmeng
2019-07-11 fb217f9ffc1b40d49feae8d4683efa5d8c5da1c9
gogpu.go
@@ -23,6 +23,21 @@
   return int(C.get_idle_gpu(C.int(memSize)))
}
// SatisfyGPU satisfy unit "M"
func SatisfyGPU(index, memSize, reserve int) bool {
   info, err := Info()
   if err != nil || info.Count >= index {
      fmt.Println("SatisfyGPU no gpu or index ilegal: ", index, " gpu count : ", info.Count)
      return false
   }
   var M1 int64 = 1024 * 1024
   if info.Info[index].GpuMemoryFree-int64(memSize)*M1 > int64(reserve)*M1 {
      return true
   }
   return false
}
// GPURank sort
type GPURank []GpuUnitInfo