Repository navigation
Conversation
…th PyTorch on Lambda Managed Instances
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
aws-python-gpu-managed-instances, the first Lambda Managed Instances example. A Python function multiplies two matrices with PyTorch on a fractional NVIDIA L4 (g6finstances,capacityProvider.gpu.memory: 3) and returns the GPU's name.Lesson: run a function on a GPU with the Framework, using a container image, a capacity provider with GPU instance types, and
capacityProvider.gpu.Left out:
The README's Next steps link the docs for each.
resources: a VPC with two public subnets and a security group. Capacity providers need a VPC, and the Framework doesn't create one; public subnets avoid a NAT gateway's hourly charge. The README says why and how to use an existing VPC.No
testblock: a live test needs the EC2 quota "Running On-Demand G and VT instances" (default 0 vCPUs) in the test accounts and takes about 20 minutes, so the example has no Verified badge.Merge after the release
The example needs
capacityProvider.gpu, added by serverless/serverless#14155, which is merged and ships in the release after 4.46.0. Merge this once that release is out and the example has been deployed and invoked once on it. Before merging, check that the README's minimum version (4.47.0) matches the release.Evidence
All in an AWS account in us-east-1, with the CLI built from source:
node scripts/check-examples.mjs aws-python-gpu-managed-instances: 0 errors.npm test: 311 passed.Followed the README from a copy, with a unique stage:
"device": "NVIDIA L4-3Q"and"result": 4096;The README's output blocks are from this run.
Afterwards, no CloudFormation stack, ECR repository, capacity provider or
/aws/lambda/aws-python-gpu*log group remained.That run used a build from before the key's final name: it was then called
accelerator, and was renamed togpuin feat(aws): support GPU instances on Lambda Managed Instances serverless#14155 before release. The rename changes the key's name only; the compiled template is the same, which the Framework's unit tests cover. The run on the release build, before merge, covers the final name.Not run:
test-example.mjsand a negative control, because the example has notestblock. No fresh-agent pass either: Try it is a single command between deploy and remove.Generated by Claude Code