Basic usage
Attach a GPU to your function using thegpu parameter:
GPU types
Modal provides access to various NVIDIA GPU models. You can specify GPU types using simple string syntax:String syntax
The recommended way to configure GPUs is with strings:"GPU_TYPE" for a single GPU or "GPU_TYPE:COUNT" for multiple GPUs.
Available GPU types
T4
NVIDIA T4 Tensor Core GPU - A low-cost data center GPU based on the Turing architecture, providing 16GB of GPU memory.L4
NVIDIA L4 Tensor Core GPU - A mid-tier data center GPU based on the Ada Lovelace architecture, providing 24GB of GPU memory. Includes RTX (ray tracing) support.A10G
NVIDIA A10G Tensor Core GPU - A mid-tier data center GPU based on the Ampere architecture, providing 24GB of memory. Delivers up to 3.3x better ML training performance, 3x better ML inference performance, and 3x better graphics performance compared to T4 GPUs.A100
NVIDIA A100 Tensor Core GPU - The flagship data center GPU of the Ampere architecture. Available in 40GB and 80GB GPU memory configurations.H100
NVIDIA H100 Tensor Core GPU - The flagship data center GPU of the Hopper architecture. Features enhanced support for FP8 precision and a Transformer Engine that provides up to 4x faster training over the prior generation for GPT-3 (175B) models.L40S
NVIDIA L40S GPU - A data center GPU based on the Ada Lovelace architecture with 48GB of on-chip GDDR6 RAM and enhanced support for FP8 precision.Any
Request any available GPU type. Modal will assign whichever GPU is available:Multiple GPUs
For workloads that require multiple GPUs (such as large models that don’t fit on a single GPU), specify the count:Deprecated class-based syntax
An older way to configure GPUs using classes is still supported but deprecated:GPU configuration reference
Supported values
GPU configuration string. Can be:
None- No GPU (default)"GPU_TYPE"- Single GPU of the specified type"GPU_TYPE:COUNT"- Multiple GPUs of the specified type
T4, L4, A10G, A100, A100-40GB, A100-80GB, H100, L40S, ANY