Cloud Computing

Dive into Deep Learning · §39.3

Cloud Computing: GPU Rental Tiers, Cost per Completed Result, and Spot Resilience
hyperscalers vs. specialists vs. marketplaces · cost per result · NVLink vs. PCIe · spot restarts · egress fees · disposable VMs

When a Project Outgrows Local and Hosted Runtimes

Motivation

  • Three walls that force cloud rental: (1) Training exceeds 12-hour hosted sessions/quotas; (2) full fine-tunes or long contexts need 80\text{--}96\text{ GB} HBM; (3) multi-GPU scaling needs 450\text{--}900\text{ GB/s} NVLink.
  • Two durable cloud rules: Select instances by total cost per completed result (never hourly sticker price alone), and treat every rented VM as disposable.

Three Tiers of Cloud Accelerator Providers

The Rental Market

GPU rental providers differ less in the silicon itself than in the surrounding managed services, pricing dispersion, and operational trust boundary:

  • Hyperscalers (AWS, GCP, Azure): Full enterprise cloud (IAM, VPCs, compliance, managed storage, GCP TPUs at \sim\$1.20/\text{hr} for v5e); highest on-demand GPU prices and quota approvals.
  • GPU Specialists (Lambda, Nebius, Voltage Park, CoreWeave): Fast multi-GPU interconnect and prebuilt ML images with self-serve launch (\sim\$2\text{--}6/\text{hr} per H100).
  • Marketplaces (Vast.ai, RunPod): Aggregate datacenter and community hosts, including consumer RTX 4090s (\sim\$0.30\text{--}0.89/\text{hr}) and H100s from \sim\$1.80/\text{hr}.

Trust Boundaries, Compliance, and Host Isolation

Security Architecture

  • Community marketplace hosts: Third-party operators have physical and hypervisor root access; disk encryption cannot hide keys or weights that must sit in cleartext RAM/VRAM during execution.
  • Vetted datacenters & hyperscalers: Use vetted tiers and short-lived scoped tokens for proprietary weights, and require a signed legal BAA (plus VPC/KMS controls) before uploading regulated data (HIPAA).

Dated On-Demand GPU Price Snapshot (Nov 2026)

Market Spread

  • 3\times\text{--}5\times price dispersion for identical silicon: An 80 GB H100 rents for \$1.80\text{--}3.99/\text{hr} on marketplaces, \$1.99\text{--}4.50/\text{hr} on GPU specialists, and \$6.88\text{--}11.00/\text{hr} on hyperscalers.
  • Entry 24 GB tier: Marketplace RTX 4090s (\$0.30\text{--}0.89/\text{hr}) and hyperscaler L4s (\$0.71\text{--}0.80/\text{hr}) cover single-GPU fine-tuning and evaluation at minimal invoice cost.

Why Multi-GPU Interconnects Are Not Priced Linearly

Interconnect Arithmetic

b_{\text{balance}} = \frac{2(W-1)}{W} \cdot \frac{F \cdot \beta_{\text{link}}}{3} \quad (N\text{ cancels})

  • NVLink (450\text{ GB/s}) vs. PCIe 5.0 (64\text{ GB/s}) on 8\times\text{H100}: At 395.6\text{ TFLOP/s} sustained, communication equals compute at b_{\text{balance}} \approx 513 tok/GPU on NVLink vs. 3{,}606 tok/GPU on PCIe (W = 8).
  • Impact at b = 4{,}096 tok/GPU: NVLink adds only \sim 13\% overhead, whereas PCIe adds 88\% overhead unless amortized by gradient accumulation.

Total Cost per Completed Result vs. Hourly Price

Experiment Economics

\text{Cost} = (T_{\text{wall}} + T_{\text{setup}})p_{\text{gpu}} + C_{\text{store}} + C_{\text{egress}} + (T_{\text{setup}} + f T_{\text{wall}})p_{\text{eng}}

  • Direct cloud invoice: Includes execution wall time T_{\text{wall}}, setup hours T_{\text{setup}}, persistent storage C_{\text{store}} (billed even while stopped), and outbound egress C_{\text{egress}}.
  • Engineer time (p_{\text{eng}}): Setup/debugging rounds plus fractional waiting attention f \cdot T_{\text{wall}} often outweigh the raw GPU invoice.

Modeling Experiment Cost Across GPU Tiers

Executable Cost Model

Compare a marketplace RTX 4090 (\$0.40/\text{hr}), A100 80 GB (\$1.20/\text{hr}), and H100 (\$2.50/\text{hr}) on a job that takes 8 hours on the 4090:

  • Invoice alone: The 4090 wins (\$5.40 vs. \$8.60 and \$9.92) because its 6.25\times lower hourly price beats the H100’s 3\times speedup.
  • With 0.5 hr setup at \$60/\text{hr}: Total costs converge to \$35.40 vs. \$38.60 vs. \$39.92—a fixed setup cost shifts all three equally, leaving the gap under \$5.
('RTX 4090', np.float64(8.0), np.float64(5.4), np.float64(35.4))
('A100 80GB', np.float64(5.0), np.float64(8.6), np.float64(38.6))
('H100', np.float64(2.7), np.float64(9.92), np.float64(39.92))

Modeling Experiment Cost Across GPU Tiers (Code)

Executable Cost Model

import numpy as np

gpu = ["RTX 4090", "A100 80GB", "H100"]
gpu_per_hour = np.array([0.40, 1.20, 2.50])   # marketplace, November 2026
relative_speed = np.array([1.0, 1.6, 3.0])    # measure for your workload!
setup_hours = np.array([0.5, 0.5, 0.5])
storage_and_egress = np.array([2.0, 2.0, 2.0])
engineer_per_hour = 60.0

wall_hours = 8.0 / relative_speed
invoice = (wall_hours + setup_hours) * gpu_per_hour + storage_and_egress
complete = invoice + setup_hours * engineer_per_hour
for row in zip(gpu, np.round(wall_hours, 1), np.round(invoice, 2),
               np.round(complete, 2)):
    print(row)

When a Pricier GPU Is Cheaper Overall

Break-Even Analysis

  • 1. One extra 30-min debug round (\$30+): Pushes an 8-hour RTX 4090 run from \$35.40 above \$65, making the 2.67-hour H100 (\$39.92) far cheaper.
  • 2. The 7-minute attention threshold (f \approx 1.4\%): Because the H100 saves 5.33\text{ hours} of wall time for only \$4.52 more on the invoice, if waiting on the 8-hour run consumes even 6.8\text{ minutes} of engineer attention at \$60/\text{hr}, the H100 wins.

Spot and Interruptible Capacity Economics

Preemptible Compute

\mathbb{E}[T_{\text{wall}}] = \left(e^{T/M} - 1\right)(M + R)

  • Exponential blowup without checkpoints: If an 8\text{ h} run restarts from scratch after Poisson interruptions (M = 4\text{ h}, R = 0.25\text{ h}), expected wall time reaches 27.2\text{ h}—costing 1.70\times more than on-demand even at a 50\% spot discount.
  • Never run uncheckpointed jobs or live interactive sessions on spot VMs.

How Checkpointing Makes Spot Capacity Profitable

Resilient Spot Runs

When a training script saves a durable checkpoint of duration \delta every \tau^* = \sqrt{2\delta M} hours, each interruption loses at most \tau^* of progress rather than the entire run:

  • Segment wall-time expectation: Each segment of length \tau^* + \delta finishes in expected wall time: \mathbb{E}[T_{\text{seg}}] = \left(e^{(\tau^* + \delta)/M} - 1\right)(M + R)
  • Because (\tau^* + \delta) / M \ll 1, the exponential blowup disappears (e^x - 1 \approx x + x^2/2).
  • Concrete impact (T = 8\text{ h}, \delta = 2\text{ min}, R = 15\text{ min}):
    • Even when interruptions strike every M = 4\text{ hours} on average, checkpointing every \tau^* \approx 31\text{ minutes} keeps total overhead small enough that spot instances remain cheaper than on-demand for any price ratio q \lesssim 0.80.

The Hidden Bill: Data Egress and Idle Storage

Storage & Network Costs

  • The egress fee shock (\sim\$0.09/\text{GB}): Downloading a 140\text{ GB} checkpoint once a day for 30 days (4.2\text{ TB}) costs \approx\$370 in egress fees—more than renting a marketplace RTX 4090 24/7 for the entire month.
  • Three defensive rules: Co-locate compute and object storage in the same cloud region, use zero-egress storage (e.g., R2 / RunPod) for cross-cloud workflows, and delete unattached NVMe volumes immediately.

First-Minute Verification and Smoke Testing

Instance Onboarding

  • Boot & shell check: Start inside tmux new -s train, run nvidia-smi and df -h, and verify framework CUDA visibility before starting long jobs.
  • 60-second automated smoke test: Verify (1) free GPU VRAM, (2) writable checkpoint mount (catches read-only disks before hour 1), (3) 1 forward/backward step + bitwise checkpoint round-trip, and (4) data loader batch/s > GPU step/s.

Disposable Compute, Durable Artifacts

Operational Lifecycle

Separate the lifetime of your research from the lifetime of any single virtual machine:

  • Provision & clone: Boot from a standard DL image, connect via SSH tunnel, and git clone your repository.
  • Sync checkpoints out-of-box: Periodically push checkpoints and logs to durable object storage (S3, GCS, R2) so losing the VM loses at most one checkpoint interval.
  • Teardown & guardrails: Delete the VM, scratch disks, snapshots, and reserved IPs immediately upon completion. Set a billing alert on day one, and keep account GPU quotas tight so a leaked API key cannot spin up 100 GPUs overnight.

Concept Check: Cloud Economics and Reliability

Check Your Understanding

Test your cloud systems reasoning on these three problems:

  1. In memory profiling of BERT fine-tuning across batch sizes, peak active memory follows M(B) = 1.8\text{ GiB} + 0.15\text{ GiB} \cdot B, while the caching allocator’s reserved pool is 10\% higher. What does the 1.8\text{ GiB} intercept represent, and which memory metric determines whether a run OOMs on a 24 GB card?
  2. Without a pre-run smoke test, when would a read-only checkpoint directory (/mnt/ckpt) surface during an 8-hour training run that saves every hour? What about a slow network disk that feeds 2 batches/s to a GPU capable of 10 steps/s?
  3. Excluding engineer time, what relative_speed would the H100 (\$2.50/\text{hr}) need in #cloud-instances-cost-model to match the RTX 4090 (\$0.40/\text{hr}) on the cloud invoice alone?

Concept Check: Cloud Economics and Reliability (cont.)

Check Your Understanding

Answers:

  1. The 1.8\text{ GiB} intercept is the batch-independent memory (parameters, gradients, optimizer states, and CUDA context). The allocator reserved/peak allocated memory against physical VRAM decides OOMs.
  2. The read-only directory crashes 1 hour into the run at the first save (wasting an hour of compute). The slow data loader never raises an error—it silently starves the GPU at 20\% utilization for 5\times the cost.
  3. Matching the 4090’s \$5.40 invoice (\$3.40 of GPU compute after \$2.00 storage/egress) requires (8.0 / s + 0.5) \times 2.50 = 3.40 \implies 8.0 / s = 0.86 \implies relative_speed \approx 9.3\times.

Summary: Cloud Accelerator Engineering

Key Takeaways

Decision Area Naive Approach Systems-Grade Practice
Provider tier selection Always pick the lowest \$/\text{hr} listing Match tier to trust boundary: marketplaces for public data, specialists/hyperscalers for private/regulated data
Multi-GPU node selection Rent 8\times\text{H100} on PCIe at the same price as NVLink Verify interconnect bandwidth (450\text{ GB/s} NVLink vs. 64\text{ GB/s} PCIe) against per-step token batch b
Cost comparison Compare hourly GPU rental price p_{\text{gpu}} Compare cost per completed result including wall time, setup/debug rounds, storage, egress, and engineer time
Spot / interruptible VMs Run long jobs or interactive sessions without checkpoints Use spot only with automated checkpointing (\tau^* = \sqrt{2\delta M}) and tested restore scripts
Data & checkpoint transfers Repeatedly download 100+ GB checkpoints across clouds Co-locate compute and storage in one region or use zero-egress providers
Instance lifecycle Store code and only checkpoints on the VM’s local disk Treat VMs as disposable: Git for code, tmux + smoke test on boot, sync to object storage, delete all resources