From ad37cf5ead5a7269d61e6c0dfa152474139b0dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 14 Mar 2024 14:37:27 +0100 Subject: [PATCH] harmony: Dev env var to override gpu count --- lib/harmony/resources/getGPU.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/harmony/resources/getGPU.go b/lib/harmony/resources/getGPU.go index 3489e7491..62d5c091e 100644 --- a/lib/harmony/resources/getGPU.go +++ b/lib/harmony/resources/getGPU.go @@ -4,12 +4,23 @@ package resources import ( + "os" + "strconv" "strings" ffi "github.com/filecoin-project/filecoin-ffi" ) func getGPUDevices() float64 { // GPU boolean + if nstr := os.Getenv("HARMONY_OVERRIDE_GPUS"); nstr != "" { + n, err := strconv.ParseFloat(nstr, 64) + if err != nil { + logger.Errorf("parsing HARMONY_OVERRIDE_GPUS failed: %+v", err) + } else { + return n + } + } + gpus, err := ffi.GetGPUDevices() logger.Infow("GPUs", "list", gpus) if err != nil {