Monte Carlo European Options

Follow this procedure to run simple oneMKL Monte Carlo European Options example.

  • Operating system: Ubuntu* 22.04

  • Hardware: Intel® Data Center Max GPUs

  • Software: Intel® oneAPI Base toolkit, Intel® oneAPI HPC toolkit

  • Time to complete: 15 minutes

For more information on the Monte Carlo sample, see Monte Carlo European Options Sample.

  1. Check whether the driver stack is installed.

    $ xpu-smi discovery
    

    The command should return at least one Intel® Data Center GPU Max device.

  2. Check whether the oneAPI toolkit is installed.

    $ apt list intel-basekit intel-hpckit
    

    Expected output:

    Listing... Done
    intel-basekit/all,now 2023.2.0-49384 amd64 [installed]
    intel-hpckit/all,now 2023.2.0-49438 amd64 [installed]
    
  3. If you previously have not configured your environment, install the Ubuntu 22.04 graphics driver. See dgpu-docs for details.

    Note

    Access to Ubuntu repositories, such as https://repositories.intel.com and https://apt.repos.intel.com, is required for installation. If proxy settings involve changes to environment variables such as http_proxy or https_proxy, small modifications are required in the following steps, such as adding -E (preserve environment) to sudo commands.

  4. If you previously have not configured your environment, enable access to the Intel repo serving the oneAPI packages and install the oneAPI Base toolkit and HPC toolkit for Ubuntu 22.04.

    wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
    echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo  tee /etc/apt/sources.list.d/oneAPI.list
    sudo apt update
    
    sudo apt install -y intel-basekit intel-hpckit
    
  5. Build Monte Carlo, which is a oneAPI sample.

    git clone https://github.com/oneapi-src/oneAPI-samples.git
    cd oneAPI-samples/Libraries/oneMKL/monte_carlo_european_opt
    source /opt/intel/oneapi/setvars.sh 
    make
    
  6. Run Monte Carlo.

    ./montecarlo
    

The following example presents a result snapshot from Intel® Data Center GPU Max 1550:

MonteCarlo European Option Pricing in Double precision using MCG59 generator.
Pricing 384000 Options with Path Length = 262144, sycl::vec size = 8, Options Per Work Item = 4 and Iterations = 5
Completed in 3.28767 seconds. Options per second = 467200
Running quality test...
L1_Norm          = 0.000481339
Average RESERVE  = 12.9913
Max Error        = 0.0832411
TEST PASSED!