From 8b005569586354772aebd124d5bbaeb5dbd1e53f Mon Sep 17 00:00:00 2001 From: Shilpa Chugh Date: Thu, 13 Mar 2025 15:15:59 +0530 Subject: [PATCH] Move accelerator function to codeflare-common support --- support/accelerator.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 support/accelerator.go diff --git a/support/accelerator.go b/support/accelerator.go new file mode 100644 index 0000000..2fb14a4 --- /dev/null +++ b/support/accelerator.go @@ -0,0 +1,18 @@ +package support + +var ( + AMD = Accelerator{Type: "gpu", ResourceLabel: "amd.com/gpu"} + CPU = Accelerator{Type: "cpu"} + NVIDIA = Accelerator{Type: "gpu", ResourceLabel: "nvidia.com/gpu", PrometheusGpuUtilizationLabel: "DCGM_FI_DEV_GPU_UTIL"} +) + +type Accelerator struct { + Type string + ResourceLabel string + PrometheusGpuUtilizationLabel string +} + +// Method to check if the accelerator is a GPU +func (a Accelerator) isGpu() bool { + return a != CPU +}