justinram11 / serverless-aws-batch

MIT License
26 stars 26 forks source link

Enable GPUs #10

Closed dtosato closed 4 years ago

dtosato commented 4 years ago

How can I enable the usage of GPUs? Can I write into the serverless.yml something like

...
ContainerProperties:
   Memory: 2048
   Vgpus: 1
...

or it is just necessary to specify the correct instance type, like p3.2xlarge?

justinram11 commented 4 years ago

Hey @dtosato ,

Thanks for checking out the project! I've never actually tried that before so I'm not 100% sure, but the plugin is basically just copying the CloudFormation ContainerProperties into the cloudformation stack the serverless framework creates.

So I'd think that you'd need to define the GPU in the ResourceRequirements property, something like (not tested):

ContainerProperties:
  ResourceRequirements:
    - Type: GPU
      Value: 1

I'm not sure if you need a specific instance type to be able to assign a GPU resource, but you may also need to select a valid instance type (such as p3.2xlarge ).

Please report back if you get it working! I'd love to add it as an example