Quick Start Guide
This guide will help you get started with Serverless GPU API quickly.
Basic Usage
Here’s a simple example of how to use Serverless GPU API:
from serverless_gpu.launcher import distributed
from serverless_gpu.compute import GPUType
@distributed(gpus=8, gpu_type=GPUType.H100, remote=True)
def my_function(**kwargs):
# Your code here
pass
my_function.distributed(x=5)
For parameter sweeps, here’s another example:
from serverless_gpu import distributed
@distributed(
gpus=2,
gpu_type='a10',
remote=True, # Uses remote gpus, not the gpus that are attached to your notebook
run_async=True, # Enables multiple async workloads at once
)
def my_training_function(learning_rate: float):
# TRAINING CODE HERE
# Launch multiple async executions
calls = []
for lr in [1e-3, 1e-4, 1e-5]
# Launches the training code in my_training_function with different learning rates!
calls.append(my_training_function.distributed(lr))
# Wait for completion
wait(calls)
# Your distributed computation code here
# Serverless GPU API will handle the multi-GPU orchestration
Next Steps
Read the Overview to understand Serverless GPU API’s architecture
Check out the API Reference for detailed API documentation
Explore other examples in the repository