JupyterHub, DockerSpawner, podman and GPU

Hi Community,

i am looking for advice,

i use jupyterhub and dockerspawner to run jupyterlab into redhat podman containers. It works very well without any trouble, thanks for the work guys !!

But now, i want to add GPU Supports, when using podman you have to add "–device nvidia.com/gpu=all " to the podman command to allow container to use the GPU.

How can we add this in the dockerspawner parameters ? because i can’t get it works … the spawner complains about “device” as un unkwon parameters when added as .extra_create_kwargs or extra_host_config, that amke sens it is podman option not docker one.

Anyone here, get this kind of config running ?
Thanks a Lot.
Best

If you use the equivalent Docker config for GPUs does it work?

Can you elaborate on equivalent Docker config?

From my search and code analysis, when using docker as cri we usually used “device request host config docker api field” to sent gpu information with dockerspawner.
But it looks like, when podman is configure though the docker api, it does not manage that field :frowning:

It looks like devices is in the host config section of the Docker API:
https://docker-py.readthedocs.io/en/stable/api.html#docker.api.container.ContainerApiMixin.create_host_config
https://jupyterhub-dockerspawner.readthedocs.io/en/latest/api/index.html#dockerspawner.DockerSpawner.extra_host_config

You are right, but podman does not use it :frowning:

I have add a look to podmanclispawner and podmanspawner, but the source code is old.

podmanclispawner should let you pass additional command line arguments:

Does that work?