Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using single GPU with multiple containers #123

Open
ndesh26 opened this issue Sep 23, 2019 · 11 comments
Open

Using single GPU with multiple containers #123

ndesh26 opened this issue Sep 23, 2019 · 11 comments

Comments

@ndesh26
Copy link

ndesh26 commented Sep 23, 2019

I was able to find some unofficial support for this in case of the Nvidia plugin. Is there similar support for this plugin?

I'm interested in this feature and would be willing to implement it. I want to know if there are other people who would be interested in such a feature. And also if the maintainers of this repo would like to add such a feature.

@thomas-riccardi
Copy link

Porting gpushare-device-plugin (and gpushare-scheduler-extender if it needs adaptation) to GKE would be much useful to us!
(This is the next step after our simple GPU sharing fork of container-engine-accelerators).

@danisla
Copy link
Contributor

danisla commented Sep 27, 2019

There is a simple way to do GPU sharing on GKE by creating symlinks on the host filesystem to the /dev/nvidia0 device. The plugin will pickup these new devices and register them with the node. There is no advanced scheduling, but it does let you attach the same GPU to multiple containers.

Here is an example I use in a daemonset to add the symlinks to the node after the NVIDIA driver has been installed:

# Create symlinks to NVIDIA device to support GPU sharing.
NVIDIA_0_SHARE=16

OLD_DEV=/dev/nvidia0
for i in $(seq 1 $(($NVIDIA_0_SHARE - 1))); do
  NEW_DEV=/dev/nvidia${i}
  echo "Linking $OLD_DEV -> $NEW_DEV"
  ln -sf $OLD_DEV $NEW_DEV
done

@ndesh26
Copy link
Author

ndesh26 commented Sep 30, 2019

@danisla That's a nice, simple solution for a use case with basic scheduling.

@HenriTEL
Copy link

HenriTEL commented Oct 4, 2019

Another trick would be to make your node RAM match the GPU memory.
Assuming your pods restrict their GPU memory limit themself you can schedule using resources.requests.memory.

@ide8
Copy link

ide8 commented Oct 15, 2019

@danisla, could you please clarify where exactly this bash script should be applied?
It doesn't work in case when I run it strictly on the worker node.

@danisla
Copy link
Contributor

danisla commented Oct 15, 2019

@ide8 here is a DaemonSet that I apply to create the symlinks on new nodes.

@ide8
Copy link

ide8 commented Oct 16, 2019

@danisla , thank you but seems that it doesn't work with EKS
Trying to figure it out

@ndesh26
Copy link
Author

ndesh26 commented Oct 16, 2019

@HenriTEL That would work when we just have a single node. But in case of multiple nodes having GPUs with different memories, it will become increasingly difficult to ensure proper scheduling and that we are not overcommitting our resources.

@ALL I will try to create a PoC for it since there are enough people interested in this. I will create a pull here when I'm done.

@ide8
Copy link

ide8 commented Oct 16, 2019

@ndesh26 , in our case it doesn't work even with a single node, with and without nvidia device plugin, but that's maybe specific to EKS.

@ndesh26
Copy link
Author

ndesh26 commented Oct 17, 2019

@ide8 I was able to successfully run @danisla's solution on our system, your problem might be specific to EKS.

@HenriTEL
Copy link

HenriTEL commented Oct 17, 2019

@ide8 Note that the nvidia-device-plugin deployed by gke does not use nvidia-docker, it mounts devices in the containers directly.
I apply this DaemonSet to install nvidia-docker and set nvidia as default runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants