Skip to content

Commit

Permalink
Add support for GPUs in CONTAINER_ENV=docker mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed May 7, 2024
1 parent 1e7eff1 commit 5b6f202
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions pman/dockermgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import List, Optional, AnyStr

from docker import DockerClient
from docker.types import DeviceRequest
from docker.models.containers import Container

from pman.abstractmgr import (AbstractManager, Image, JobName, ResourcesDict,
Expand Down Expand Up @@ -36,8 +37,6 @@ def schedule_job(self, image: Image, command: List[str], name: JobName,
'got number_of_workers=' + str(resources_dict['number_of_workers']),
status_code=400
)
if resources_dict['gpu_limit'] != 0:
raise ManagerException('Compute environment does not support GPUs yet.')

volumes = {
'volumes': {
Expand All @@ -53,6 +52,11 @@ def schedule_job(self, image: Image, command: List[str], name: JobName,
limits['nano_cpus'] = int(resources_dict['cpu_limit'] * 1e6)
limits['mem_reservation'] = resources_dict['memory_limit'] * 1024 * 1024

if resources_dict['gpu_limit'] > 0:
limits['device_requests'] = [
DeviceRequest(count=resources_dict['gpu_limit'], capabilities=[['gpu']])
]

user_spec = {}
if uid is not None:
user_spec['user'] = uid
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Flask==2.3.3
Flask-RESTful==0.3.10
docker==6.1.3
docker==7.0.0
openshift==0.13.2
kubernetes==27.2.0
python-keystoneclient==4.2.0
Expand Down

0 comments on commit 5b6f202

Please sign in to comment.