File tree Expand file tree Collapse file tree
Libraries/oneMKL/monte_carlo_european_opt/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313#include < vector>
1414#include < sycl/sycl.hpp>
1515
16- #ifndef DATA_TYPE
17- #define DATA_TYPE double
18- #endif
19-
2016#ifndef ITEMS_PER_WORK_ITEM
2117#define ITEMS_PER_WORK_ITEM 4
2218#endif
2521#define VEC_SIZE 8
2622#endif
2723
28- using DataType = DATA_TYPE;
29-
3024// Should be > 1
3125constexpr int num_options = 384000 ;
3226// Should be > 16
3327constexpr int path_length = 262144 ;
3428// Test iterations
3529constexpr int num_iterations = 5 ;
3630
37- constexpr DataType risk_free = 0 .06f ;
38- constexpr DataType volatility = 0 .10f ;
31+ constexpr float risk_free = 0 .06f ;
32+ constexpr float volatility = 0 .10f ;
3933
40- constexpr DataType RLog2E = -risk_free * M_LOG2E;
41- constexpr DataType MuLog2E = M_LOG2E * (risk_free - 0.5 * volatility * volatility);
42- constexpr DataType VLog2E = M_LOG2E * volatility;
34+ constexpr float RLog2E = -risk_free * M_LOG2E;
35+ constexpr float MuLog2E = M_LOG2E * (risk_free - 0.5 * volatility * volatility);
36+ constexpr float VLog2E = M_LOG2E * volatility;
4337
4438template <typename MonteCarlo_vector>
4539void check (const MonteCarlo_vector& h_CallResult, const MonteCarlo_vector& h_CallConfidence,
4640const MonteCarlo_vector& h_StockPrice, const MonteCarlo_vector& h_OptionStrike, const MonteCarlo_vector& h_OptionYears)
4741{
42+ using DataType = typename MonteCarlo_vector::value_type;
4843 std::vector<DataType> h_CallResultRef (num_options);
4944
5045 auto BlackScholesRefImpl = [](
You can’t perform that action at this time.
0 commit comments