Skip to content

Commit c857966

Browse files
authored
Update montecarlo.hpp
1 parent 0032d4b commit c857966

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

Libraries/oneMKL/monte_carlo_european_opt/src/montecarlo.hpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
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
@@ -25,26 +21,25 @@
2521
#define VEC_SIZE 8
2622
#endif
2723

28-
using DataType = DATA_TYPE;
29-
3024
//Should be > 1
3125
constexpr int num_options = 384000;
3226
//Should be > 16
3327
constexpr int path_length = 262144;
3428
//Test iterations
3529
constexpr 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

4438
template<typename MonteCarlo_vector>
4539
void check(const MonteCarlo_vector& h_CallResult, const MonteCarlo_vector& h_CallConfidence,
4640
const 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 = [](

0 commit comments

Comments
 (0)