Migrating the MonteCarloMultiGPU from CUDA* to SYCL*

ID 标签 766335
已更新 7/6/2023
版本 Latest
公共

author-image

作者

Overview

The MonteCarloMultiGPU sample evaluates the fair call price for a given set of European stock options using the Monte Carlo approach. Monte Carlo simulation is one of the most important algorithms in quantitative finance. This sample uses a single CPU Thread to control multiple GPUs. The original CUDA* source code is migrated to SYCL for portability across GPUs from multiple vendors.

 

Area

Description

What you will learn

How to migrate and map SYCL RNG philox4x32x10<1> equivalent of cuRAND API's.

Time to complete

15 minutes

Category Code Optimization

 

Key Implementation Details

This sample demonstrates the migration of the following prominent CUDA feature:

  • Random Number Generator

Calls to cuRAND function APIs are being translates to equivalent Intel® oneAPI Math Kernel Library (oneMKL) function calls.

The MonteCarloOneBlockPerOption() kernel is the main computation kernel. It calculates the integral over all paths using a single thread block per option.

The rngSetupStates() kernel initializes the random number generator states for each thread.

The initMonteCarloGPU() function allocates memory on the GPU, sets up the random number generator states, and initializes other variables.

The closeMonteCarloGPU() function computes statistics and deallocates memory on the GPU.

Finally, the MonteCarloGPU() function performs the main computations by copying data to the GPU, launching the computation kernel, and copying the results back to the host.

 

Original CUDA source files: MonteCarloMultiGPU.

Migrated SYCL source files including step by step instructions: guided_MonteCarloMultiGPU_SYCLmigration.

 

References