Risk Analyst: GPU Accelerated Financial Risk Analytics
Risk Analyst is a high-performance quantitative finance engine that demonstrates how modern C++20 and CUDA can accelerate computationally expensive Monte Carlo simulations and portfolio risk metric calculations.
Problem Statement
Evaluating financial derivatives and constructing portfolio risk distributions (such as Value at Risk and Expected Shortfall) requires simulating millions of asset price trajectories. Relying on single-threaded CPUs for this task is too slow for real-time pricing and intraday risk management. Because Monte Carlo paths are statistically independent, this workload is an "embarrassingly parallel" problem that scales exceptionally well on massively parallel GPU architectures.
Architecture Overview
The repository is structured around an extensible abstract MonteCarloEngine interface and features clean modularity across:
- Finance: Geometric Brownian Motion, Black-Scholes approximations, and Option Pricing (European Call/Put, Asian Options).
- Statistics: Computations for Mean Return, Variance, Sharpe Ratio, $VaR_{95}$, and $CVaR_{95}$.
- Engines:
CpuSequentialEngine(Baseline Single-Threaded)CpuOpenMPEngine(Multi-Core CPU)CudaEngine(Baseline GPU)CudaEngineOptimized(High-Performance GPU)
The Progression of Optimization
1. CPU Implementation (Sequential & OpenMP)
The CPU engines serve as the source of truth. We use <random> for standard Normal variables and ensure $O(N)$ memory bounds by computing running averages and final prices step-by-step rather than persisting the full $N \times S$ simulation matrix. The OpenMP engine distributes paths among cores and seeds each thread's PRNG locally to prevent thread contention.



95% Confidence Intervals calculated using Standard Error over $N$ simulations.

