Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Environment:Sdv dev SDV GPU CUDA Support

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Synthetic_Data
Last Updated 2026-02-14 19:00 GMT

Overview

Optional NVIDIA GPU with CUDA and PyTorch for accelerating GAN-based synthesizers (CTGANSynthesizer, CopulaGAN, PARSynthesizer).

Description

This environment extends the base Python runtime with GPU acceleration support. SDV's GAN-based synthesizers (CTGANSynthesizer, CopulaGAN) and the PAR sequential synthesizer use PyTorch under the hood (via the `ctgan` and `deepecho` packages). When a CUDA-capable GPU is available and `enable_gpu=True` is set, training is offloaded to the GPU. This is optional — all SDV synthesizers work on CPU by default. The GPU environment requires PyTorch with CUDA support and an NVIDIA GPU with sufficient VRAM.

Usage

Use this environment when training GAN-based synthesizers (CTGANSynthesizer, CopulaGAN) or the PARSynthesizer on large datasets where GPU acceleration provides meaningful speedup. Set `enable_gpu=True` (or the deprecated `cuda=True`) in the synthesizer constructor.

System Requirements

Category Requirement Notes
OS Linux, Windows (with CUDA drivers) Linux recommended for GPU training
Hardware NVIDIA GPU with CUDA support VRAM depends on dataset size
Drivers NVIDIA CUDA drivers Compatible with installed PyTorch version
Python >= 3.9, < 3.15 Same as base Python runtime

Dependencies

System Packages

  • NVIDIA CUDA Toolkit — Version compatible with installed PyTorch
  • NVIDIA GPU drivers — Latest stable recommended

Python Packages

  • All packages from the Python_Runtime environment
  • `torch` — With CUDA support (installed separately; version must match CUDA toolkit)
  • `ctgan` >= 0.11.1 — Provides `get_enable_gpu_value()` utility for GPU parameter resolution

Credentials

No additional credentials required beyond the base Python_Runtime environment.

Quick Install

# Install SDV
pip install sdv

# Install PyTorch with CUDA support (example for CUDA 12.1)
pip install torch --index-url https://download.pytorch.org/whl/cu121

# Verify GPU availability
python -c "import torch; print(torch.cuda.is_available())"

Code Evidence

GPU parameter in CTGANSynthesizer from `sdv/single_table/ctgan.py:213`:

self.enable_gpu = get_enable_gpu_value(enable_gpu, cuda)

CUDA device deserialization error handling from `sdv/single_table/base.py:747-759`:

except RuntimeError as e:
    err_msg = (
        'Attempting to deserialize object on a CUDA device but '
        'torch.cuda.is_available() is False. If you are running on a CPU-only machine,'
        " please use torch.load with map_location=torch.device('cpu') "
        'to map your storages to the CPU.'
    )
    if str(e) == err_msg:
        raise SamplingError(
            'This synthesizer was created on a machine with GPU but the current '
            'machine is CPU-only. This feature is currently unsupported. We recommend'
            ' sampling on the same GPU-enabled machine.'
        )

Deprecated `cuda` parameter resolution from `sdv/single_table/base.py:312-316`:

def _resolve_gpu_parameters(self, parameters):
    if parameters.get('cuda') is not None and parameters.get('enable_gpu') is None:
        parameters.pop('enable_gpu', None)
    elif 'cuda' in parameters:
        del parameters['cuda']

Common Errors

Error Message Cause Solution
`SamplingError: This synthesizer was created on a machine with GPU but the current machine is CPU-only.` Loading a GPU-trained synthesizer on a CPU-only machine Load and sample on a GPU-enabled machine, or retrain on CPU
`RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False.` PyTorch cannot find CUDA device Install CUDA-compatible PyTorch or use CPU machine
`ModuleNotFoundError: No module named 'torch'` PyTorch not installed `pip install torch` with appropriate CUDA index URL

Compatibility Notes

  • CPU fallback: All synthesizers default to CPU. GPU is opt-in via `enable_gpu=True`.
  • Deprecated parameter: The `cuda` parameter is deprecated in favor of `enable_gpu`. Both still work but `enable_gpu` takes precedence.
  • Cross-device loading: Synthesizers trained on GPU cannot be loaded on CPU-only machines. This is a known limitation.
  • PARSynthesizer: The PAR model (via deepecho) also supports `cuda=True` for GPU training of sequential models.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment