-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathoptions.h
58 lines (46 loc) · 1.81 KB
/
options.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* Copyright (c) 2013-2015, Colfax International. All Right Reserved.
This file, labs/4/4.11-MPI-load-balancing-asian-options/options.h,
is a part of Supplementary Code for Practical Exercises for the handbook
"Parallel Programming and Optimization with Intel Xeon Phi Coprocessors",
2nd Edition -- 2015, Colfax International,
ISBN 9780988523401 (paper), 9780988523425 (PDF), 9780988523432 (Kindle).
Redistribution or commercial usage without written permission
from Colfax International is prohibited.
Contact information can be found at http://colfax-intl.com/ */
#ifndef __OPTIONS_H__
#define __OPTIONS_H__
// Constants for MPI communication
const int reportingRank = 0;
const int msgReportLength = 8;
const int msgReportTag = 1;
const int msgSchedLength = 8;
const int msgSchedTag = 2;
const int msgNameTag = 3;
#define hostNameLen 128
typedef char HostNameType[128];
struct OptionType {
float S; // Starting price
float K; // Strike price
float r; // Price drift
float v; // Price volatility
float T; // Option expiration time
int numIntervals; // Number of intervals for averaging
int numPaths; // Number of Monte Carlo paths for pricing
};
struct PayoffType {
float payoff_geom_put; // Payoff of "put" option with geometric average
float payoff_arithm_put; // Payoff of "put" option with arithmetic average
float payoff_geom_call; // Payoff of "put" option with geometric average
float payoff_arithm_call; // Payoff of "call" option with arithmetic a
};
void ComputeOptionPayoffs(const OptionType & option, PayoffType& payoff);
void ComputeOnAllNodes(const int nOptions,
const OptionType* const option,
PayoffType* payoff,
const int mpiWorldSize,
int* rankTypes,
const int myRank,
double & comp_time,
int & optioncount
);
#endif