@@ -66,55 +66,6 @@ func (h *SidecarHandler) CreateHandler(w http.ResponseWriter, r *http.Request) {
6666
6767 containerName := podNamespace + "-" + podUID + "-" + container .Name
6868
69- var isGpuRequested bool = false
70- var additionalGpuArgs []string
71-
72- if val , ok := container .Resources .Limits ["nvidia.com/gpu" ]; ok {
73-
74- numGpusRequested := val .Value ()
75-
76- log .G (h .Ctx ).Infof ("Number of GPU requested: %d" , numGpusRequested )
77-
78- // if the container is requesting 0 GPU, skip the GPU assignment
79- if numGpusRequested == 0 {
80- log .G (h .Ctx ).Info ("Container " + containerName + " is not requesting a GPU" )
81-
82- } else {
83-
84- log .G (h .Ctx ).Info ("Container " + containerName + " is requesting " + val .String () + " GPU" )
85-
86- isGpuRequested = true
87-
88- numGpusRequestedInt := int (numGpusRequested )
89- _ , err := h .GpuManager .GetAvailableGPUs (numGpusRequestedInt )
90-
91- if err != nil {
92- HandleErrorAndRemoveData (h , w , statusCode , "Some errors occurred while creating container. Check Docker Sidecar's logs" , err , & data )
93- return
94- }
95-
96- gpuSpecs , err := h .GpuManager .GetAndAssignAvailableGPUs (numGpusRequestedInt , containerName )
97- if err != nil {
98- HandleErrorAndRemoveData (h , w , statusCode , "Some errors occurred while creating container. Check Docker Sidecar's logs" , err , & data )
99- return
100- }
101-
102- var gpuUUIDs string = ""
103- for _ , gpuSpec := range gpuSpecs {
104- if gpuSpec .UUID == gpuSpecs [len (gpuSpecs )- 1 ].UUID {
105- gpuUUIDs += strconv .Itoa (gpuSpec .Index )
106- } else {
107- gpuUUIDs += strconv .Itoa (gpuSpec .Index ) + ","
108- }
109- }
110-
111- additionalGpuArgs = append (additionalGpuArgs , "--runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=" + gpuUUIDs )
112- }
113-
114- } else {
115- log .G (h .Ctx ).Info ("Container " + containerName + " is not requesting a GPU" )
116- }
117-
11869 log .G (h .Ctx ).Info ("-- Preparing environment variables for " + containerName )
11970
12071 var envVars string = ""
@@ -156,10 +107,6 @@ func (h *SidecarHandler) CreateHandler(w http.ResponseWriter, r *http.Request) {
156107
157108 cmd = append (cmd , envVars )
158109
159- if isGpuRequested {
160- cmd = append (cmd , additionalGpuArgs ... )
161- }
162-
163110 var additionalPortArgs []string
164111 for _ , port := range container .Ports {
165112 if port .HostPort != 0 {
0 commit comments