Portfolio Optimization

20 MIN

GPU-Accelerated portfolio optimization using cuOpt and cuML

Basic idea

This playbook demonstrates an end-to-end GPU-accelerated workflow using NVIDIA cuOpt and NVIDIA cuML to solve large-scale portfolio optimization problems, using the Mean-CVaR (Conditional Value-at-Risk) model, in near real-time.

Portfolio Optimization (PO) involves solving high-dimensional, non-linear numerical optimization problems to balance risk and return. Modern portfolios often contain thousands of assets, making traditional CPU-based solvers too slow for advanced workflows. By moving the computational heavy lifting to the GPU, this solution dramatically reduces computation time.

What you'll accomplish

You will implement a pipeline that provides tools for performance evaluation, strategy backtesting, benchmarking, and visualization. The workflow includes:

  • GPU-Accelerated Optimization: Leveraging NVIDIA cuOpt LP/MILP solvers
  • Data-Driven Risk Modeling: Implementing CVaR as a scenario-based risk measure that models tail risks without making assumptions about asset return distributions.
  • Scenario Generation: Using GPU-accelerated Kernel Density Estimation (KDE) via NVIDIA cuML to model return distributions.
  • Real-World Constraint Management: Implementing constraints including concentration limits, leverage constraints, turnover limits, and cardinality constraints.
  • Comprehensive Backtesting: Evaluating portfolio performance with specific tools for testing rebalancing strategies.

What to know before starting

  • Required Skills (you'll get it):

    • Basic with Terminal and Linux command line
    • Basic understanding of Docker containers
    • Basic knowledge of using Jupyter Notebooks and Jupyter Lab
    • Basic Python knowledge
    • Basic knowledge of data science and machine learning concepts
    • Basic knowledge of what the stock market and stocks are
  • Optional Skills (you'll enjoy it):

    • Background in Financial Services, especially in quantatitve finance and portfolio management
    • Moderate knowledge programming algorithms and strategies, in python, using machine learning concepts
  • Terms to know:

    • CVaR vs. Mean-Variance: Unlike traditional mean-variance models, this workflow uses Conditional Value-at-Risk (CVaR) to capture nuances of risk, specifically tail risk or scenario-specific stresses.
    • Linear Programming: CVaR reformulates the risk-return tradeoff as a scenario-based linear program where the problem size scales with the number of scenarios, which is why GPU acceleration is critical.
    • Benchmarking: The pipeline includes built-in tools to streamline the benchmarking process against standard CPU-based libraries to validate performance gains.

Prerequisites

Hardware Requirements:

  • NVIDIA Grace Blackwell GB10 Superchip System (DGX Spark)
  • Minimum 40GB Unified memory free for docker container and GPU accelerated data processing
  • At least 30GB available storage space for docker container and data files
  • High speed internet connection recommended

Software Requirements:

  • NVIDIA DGX OS with working NVIDIA and CUDA drivers
  • Docker
  • Git

Ancillary files

All required assets can be found in the Portfolio Optimization repository. In the running playbook, they will all be found under the playbook folder.

  • cvar_basic.ipynb - Main playbook notebook.
  • /setup/README.md - Quick Start Guide to the Playbook Environment.
  • /setup/start_playbook.sh - Script to start the install of the playbook in a Docker container
  • /setup/setup_playbook.sh - Configures the Docker container before user enters jupyterlab environment
  • /setup/pyproject.toml - used as a lists of libraries that commands in setup_playbook will install into the playbook environment
  • cuDF, cuML, and cuGraph folders - more example notebooks to continue your GPU Accelerated Data Science Journey. These will be part of the Docker Container when you start it.

Time & risk

  • Estimated Time ~20 minutes for first run
    • Total Notebook Processing Time: Approximately 7 minutes for the full pipeline.
  • Risks:
    • Minimal, as this is run in a Docker container.
  • Rollback: Stop the Docker container and remove the cloned repository to fully remove the installation.

  • Last Updated: 01/02/2026

    • First Publication