Portfolio Optimization Powered by NVIDIA cuOpt

Disclaimer
This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use.
Overview
This portfolio optimization developer example addresses the financial industry's trade-off between computational speed and model complexity. By leveraging NVIDIA accelerated computing — NVIDIA cuOpt for GPU-accelerated portfolio solves, and RAPIDS cuML for GPU scenario generation — this solution transforms robust analysis (e.g., Mean-CVaR, large-scale simulations) from slow batch processing into a fast, iterative workflow for dynamic decision-making.
Accelerated Architecture
The end-to-end pipeline connects market data ingestion to optimal strategy backtesting using the NVIDIA CUDA ecosystem:
1. Data Science & Scenario Generation
- Technology: CUDA-X Data Science — RAPIDS cuML for GPU KDE scenario generation
- Function: Accelerates data preprocessing and the learning/sampling of return distributions.
- Performance: Achieves speedups of up to 100x when generating scenarios.
2. Mean-CVaR Optimization
- Technology: NVIDIA cuOpt open-source solvers.
- Function: Efficiently solves complex, scenario-based Mean-CVaR portfolio optimization problems.
- Performance: Consistently outperforms state-of-the-art CPU-based solvers, with up to 160x speedups in large-scale problems.
3. Strategy Backtesting & Refinement
- Technology: CUDA-X Data Science and HPC SDK.
- Function: Rigorously tests the trading strategies and provides insights into strategy fine-tuning.
Key Takeaways
- Speed-ups: Up to 160x faster optimization and 100x faster scenario generation.
- Risk Modeling: Enables the use of Conditional Value-at-Risk (CVaR) at production speed.
- Iterative Workflow: Supports dynamic, fast, and data-driven optimization cycles.
Get Started
System Requirements
Recommended Requirements for Best Performance
- System Architecture:
- GPU:
- NVIDIA H100 SXM (compute capability >= 9.0) and above
- CPU:
- System Memory:
- NVMe SSD Storage:
- CUDA:
- NVIDIA Drivers:
- Latest NVIDIA drivers (580.65.06+)
- OS:
- Linux distributions with glibc>=2.28 (released in August 2018):
- Arch Linux (minimum version 2018-08-02)
- Debian (minimum version 10.0)
- Fedora (minimum version 29)
- Linux Mint (minimum version 20)
- Rocky Linux / Alma Linux / RHEL (minimum version 8)
The above configuration will provide optimal performance for large-scale optimization problems.
Installation on PyTorch Container
To install dependencies on the NVIDIA PyTorch container:
# Start the container. Publish 8888 for Jupyter and 8501 for Streamlit.
docker run --gpus all -it --rm \
-v ./:/workspace/host \
--ipc=host \
-p 8888:8888 \
-p 8501:8501 \
nvcr.io/nvidia/pytorch:25.10-py3
# Clone the repository
git clone https://github.com/NVIDIA-AI-Blueprints/portfolio-optimization.git
cd portfolio-optimization
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# To add $HOME/.local/bin to your PATH, either restart your shell or run:
source $HOME/.local/bin/env # (sh, bash, zsh)
# source $HOME/.local/bin/env.fish # (fish)
# Install with CUDA-specific dependencies, plus the Jupyter kernel tooling
uv sync --extra cuda13 --group notebooks # full CUDA 13 stack currently tracks cuOpt/cuML 26.04
# On CUDA 12 hosts, use the full cuOpt/cuML 26.06 stack:
# uv sync --extra cuda12 --group notebooks
# For direct SOCP testing on CUDA 13 with cuOpt 26.06:
# uv sync --extra cuda13-socp --group notebooks
# Optional: Install development tools (ruff, pytest, pre-commit)
uv sync --extra cuda13 --group notebooks --group dev