GPU Capacity Unavailable: What Businesses Can Use
In this article
When GPU capacity is unavailable, businesses can use CPU-based cloud instances, specialized AI accelerators (like TPUs or FPGAs), or optimize their workloads to run on existing hardware with techniques like model quantization and batching. The right choice depends on the specific workload, latency needs, and budget.
Why GPU Shortages Happen
GPUs are in high demand for AI training, machine learning inference, and graphics rendering. Supply chain issues, cryptocurrency mining, and the explosion of large language models have all contributed to periodic shortages. Cloud providers often allocate GPU instances on a first-come, first-served basis, and during peak times, you may find that the GPU instance type you need is unavailable in your region. This can halt your development pipeline or slow down production services.
CPU-Only Alternatives
Many workloads can run on CPUs, albeit slower. For inference (running a trained model), CPUs can be perfectly adequate, especially for smaller models or when latency isn't critical. For training, CPU-only training is possible but often impractically slow for large models. However, for smaller models or fine-tuning, CPU clusters can work. Cloud providers offer high-core-count CPU instances that can handle batch processing. Techniques like model quantization (reducing the precision of weights) and pruning (removing less important connections) can make models run efficiently on CPUs. For example, a small BERT model can run inference on a modern CPU in under a second.
Specialized AI Accelerators
Google Cloud offers Tensor Processing Units (TPUs), which are custom ASICs designed for machine learning. TPUs are often faster than GPUs for certain workloads, especially large transformer models. AWS offers Inferentia chips for inference, and Trainium for training. These are purpose-built for AI and can be more cost-effective than GPUs. FPGAs (Field-Programmable Gate Arrays) are another option, though they require more specialized programming. These alternatives are not drop-in replacements—you may need to adjust your code to use them, but they can be a reliable fallback when GPUs are scarce.
Cloud Provider Options and Spot Instances
If your primary cloud provider has no GPU capacity, consider multi-cloud strategies. AWS, Azure, and Google Cloud all offer GPU instances, but availability varies. Also, consider spot instances (or preemptible VMs on Google Cloud). These are spare compute capacities offered at a discount, but they can be terminated with little notice. For non-critical batch jobs, spot GPU instances can be a great way to get capacity when on-demand instances are unavailable. Another option is to use serverless GPU offerings like AWS Lambda with GPU (recently announced) or services like Banana, RunPod, or Replicate, which abstract away the infrastructure and provide GPU-backed endpoints on demand.
Optimizing Your Workload
Before seeking alternatives, optimize your existing code. Batch inference—processing multiple inputs at once—can dramatically improve throughput. Use efficient libraries like ONNX Runtime or TensorRT to speed up inference. For training, consider mixed precision training (using FP16) to reduce memory and compute requirements. Also, consider model distillation—training a smaller model to mimic a larger one—to reduce the compute needed. These optimizations can make your workload fit on smaller, more available GPU instances or even run on CPUs.
How to Choose the Right Alternative
Start by identifying the bottleneck: is it training or inference? For training, TPUs are a strong alternative if you use TensorFlow or JAX. For inference, CPU or Inferentia may suffice. Consider the following factors:
- Latency: If you need real-time responses, CPUs may be too slow; consider accelerators or optimized inference servers.
- Cost: CPU instances are cheaper per hour but may take more hours. Calculate total cost of ownership.
- Compatibility: Check if your framework supports the alternative hardware. PyTorch supports TPUs via torch-xla, but not all operations are supported.
- Scalability: Can you scale horizontally with CPU instances? Some workloads parallelize well.
Run a small benchmark with your actual workload to see which alternative meets your requirements.
Common Problems and Misconceptions
A common misconception is that GPUs are always faster than CPUs. For small models or single predictions, CPUs can be just as fast because they have higher clock speeds and no data transfer overhead. Another issue is that moving to a different accelerator requires code changes—it's not always a simple swap. Also, spot instances can be interrupted, so you need checkpointing and retry logic. Finally, don't assume that cloud providers have infinite capacity; they often have quotas, and you may need to request an increase.
Cost Considerations
CPU instances are generally cheaper per hour than GPU instances. For example, a 64-core CPU instance might cost less than a single V100 GPU instance. However, if your workload takes 10 times longer on CPU, the cost may be higher. TPUs are billed per second and can be very cost-effective for large training runs. Spot instances can save 60-90% but with the risk of termination. Always monitor your usage and set budgets to avoid unexpected charges.
Safety and Reliability
When using spot instances, implement robust checkpointing to save progress frequently. For production workloads, use managed services that handle failover. Ensure you have proper retry logic for transient errors. Also, be aware that some accelerators have specific software requirements—like specific driver versions—so test thoroughly before deploying.
Frequently Asked Questions
Can I run machine learning models on a regular CPU?
Yes, you can run inference on a CPU, and for small models it may be fast enough. Training is possible but slow for large models. Use quantization and efficient libraries to improve performance.
What is a TPU and how is it different from a GPU?
A TPU is a custom chip designed by Google specifically for machine learning. It excels at matrix operations common in neural networks. GPUs are more general-purpose and support a wider range of frameworks and operations.
Are spot instances reliable for production?
Spot instances can be terminated at any time, so they are not ideal for production without a fallback plan. Use them for batch jobs or development. For production, consider on-demand or reserved instances.
How do I know if my workload can run on a CPU?
Test it. Run a sample of your inference requests on a CPU instance and measure latency. If it meets your requirements, you can use CPUs. For training, try a small subset of your data to estimate time.
Can I use multiple CPUs to speed up training?
Yes, distributed training on multiple CPUs is possible, but it has communication overhead. It works best for models that can be parallelized, but it's rarely as efficient as a single GPU.
What is quantization and how does it help?
Quantization reduces the precision of model weights (e.g., from 32-bit floats to 8-bit integers). This reduces memory and compute requirements, making models run faster on CPUs and other hardware, with a slight loss in accuracy.