GPU support for Juju on GCE



as it seems it is currently not possible to let Juju automatically allocate machines on GCE with a GPU attached. Only way I see is to either allocate the machine manually and then add via ssh to a model or alter the machine after it was allocated by Juju.

Do I miss anything or is automatic allocation of instances with GPUs attached not automatically possible on GCE?




It’s possible (probable?) that we haven’t added the metadata to our instance types GCE. GPU instances should be selectable via a constraint.

Will look into this today :slight_smile:


Thanks @timClicks

AFAIK there are no concrete instance types on GCE with GPUs. You have add a GPU to one of the existing instance types. You can create instance templates which bundle a common instance type and a GPU for quick deployment but I haven’t found a way to let Juju use an instance template.


Looks like I was somewhat optimistic. From the “GPU workers” doc:

Adding GPU workers with GCP

Google supports GPUs slightly differently to most clouds. There are no GPUs included in any of the default instance templates, and therefore they have to be added manually.

To begin, add a new machine with Juju. Include any desired constraints for memory,cores,etc :

juju add-machine --constraints cores=2

The command will return, telling you the number of the machine that was created - keep a note of this number.

Next you will need to use the gcloud tool or the GCP console to stop the instance, edit its configuration and then restart the machine.

Once it is up and running, you can then add it as a worker:

juju add-unit kubernetes-worker --to 10

…replacing ‘10’ in the above with the number of the machine you created.