Skip to content

Commit

Permalink
Merge branch 'ore_master_into_ore-github' into 'master'
Browse files Browse the repository at this point in the history
ore release 1.8.0.12

Closes QPR-12520, QPR-12398, QPR-12242, QPR-12498, QPR-12482, QPR-12376, QPR-12386, QPR-12433, QPR-12419, QPR-12286, QPR-12275, and QPR-12349

See merge request qs/ore-github!54
  • Loading branch information
pcaspers committed May 24, 2024
2 parents dc722d3 + 345afd1 commit 03da410
Show file tree
Hide file tree
Showing 2,303 changed files with 199,019 additions and 76,609 deletions.
6 changes: 3 additions & 3 deletions App/ore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include <orea/app/oreapp.hpp>

#include <ored/utilities/initbuilders.hpp>
#include <orea/app/initbuilders.hpp>

#include <qle/version.hpp>

Expand Down Expand Up @@ -71,12 +71,12 @@ int main(int argc, char** argv) {
return -1;
}

ore::data::initBuilders();
ore::analytics::initBuilders();

string inputFile(argv[1]);

try {
auto params = boost::make_shared<Parameters>();
auto params = QuantLib::ext::make_shared<Parameters>();
params->fromFile(inputFile);
OREApp ore(params, true);
ore.run();
Expand Down
2 changes: 1 addition & 1 deletion Docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ DEBIAN_TAG=11.7
# it's recommended to include CMAKE_BUILD_TYPE and BOOST_VARIANT in QL_TAG, ORE_TAG, BOOST_TAG
# to distinguish a release build from a debug build

QL_TAG=1.31.1_0fd143ce3
QL_TAG=1.31.1_f8955cf0
ORE_TAG=latest

# debug or release
Expand Down
5 changes: 5 additions & 0 deletions Docs/AMC/amc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ \section*{Document Change History}
\hline
na & 25 February 2019 & Peter Caspers & initial version\\
na & 23 October 2023 & Peter Caspers & add parameter RegressorModel\\
na & 4 April 2024 & Peter Caspers & add parameter RegressionVarianceCutoff\\
\hline
\end{supertabular}
\end{center}
Expand Down Expand Up @@ -247,6 +248,7 @@ \subsection{Pricing Engine Configuration}\label{sec:pricing_engine_config}
<Parameter name="SobolDirectionIntegers">JoeKuoD7</Parameter>
<Parameter name="MinObsDate">true</Parameter>
<Parameter name="RegressorModel">Simple</Parameter>
<Parameter name="RegressionVarianceCutoff">1E-5</Parameter>
</EngineParameters>
</Product>
\end{minted}
Expand Down Expand Up @@ -286,6 +288,9 @@ \subsection{Pricing Engine Configuration}\label{sec:pricing_engine_config}
addition, past FX states that are relevant for future cashflows are included. For example, for a FX resettable
cashflow the FX state observed on the FX reset date is included.
\end{itemize}
\item \verb+RegressionVarianceCutoff+: Optional. If given, a coordinate transform and (possibly) a factor reduction is
applied to the regressors, such that $1-\epsilon$ of the total variance of regressors is kept, where $\epsilon$ the
given parameter. This helps dealing with collinearity and also reducing the dimnensionality of the regression model.
\end{enumerate}
\begin{table}[hbt]
Expand Down
63 changes: 41 additions & 22 deletions Docs/ComputeEnvironment/computeenvironment.tex
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ \section*{Document History}
Date & Author & Comment \\
\hline
19 June 2023 & Acadia & initial release\\
15 April 2024 & Acadia & refactor context settings, add supportsDoublePrecision()\\
\hline
\end{supertabular}
\end{flushleft}
Expand Down Expand Up @@ -222,7 +223,7 @@ \subsection{Implementation of the ComputeFramework interface}\label{implComputeF
Notice that the same device can appear under several frameworks, e.g. a GPU could be accessed both via an OpenCL
driver or via a CUDA driver.
\item \verb+getContext()+ should return a raw pointer to a \verb+ComputeContext+ implementation for a given device label
or throw an erro if the device label is not valid. See \ref{implComputeContext} for more details.
or throw an error if the device label is not valid. See \ref{implComputeContext} for more details.
\item \verb+Destructor+ The destructor of \verb+ComputeFramework+ is virtual and has an empty default implementation. It
can be override in implementations to free ressources. For example, the \verb+OpenClFramework+ implementation stores
raw pointers for each compute contexts that need to be deleted on destruction of the \verb+OpenClFramework+ instance.
Expand Down Expand Up @@ -251,9 +252,19 @@ \subsection{Implementation of the ComputeContext interface}\label{implComputeCon
previous calculation. In this case only the input variables and random variates (see below) need to be set to
retrieve the results of the calculation calling \verb+finalizeCalculation()+. If \verb+id+ is \verb+0+ on the other
hand, a new calculation \verb+id+ will be generated and returned.
\item \verb+version+: The version of a calculation.
\item \verb+debug+: A flag indicating whether debug information on the number of performed operations and timings for
data copying, kernel building and calculations should be collected.
\item \verb+version+: The version of a calculation. This is a freely choosable integer, which is only used to identify
different versions. Usually the first version of a calculation will be $0$, then next $1$, etc.
\item \verb+Settings+: A struct summarizing settings for the compute environment:
\begin{itemize}
\item debug: a flag indicating whether debug information on the number of performed operations and timings for
data copying, kernel building and calculations should be collected. Defaults to false.
\item useDoublePrecision: a flag indicating whether double precision should be used for calculations. Defaults to
false.
\item rngSequenceType: the sequence type for random number generation. One of MersenneTwister,
MersenneTwisterAntithetic, Sobol, Burley2020Sobol, SobolBrownianBridge, Burley2020SobolBrownianBridge
\item seed: the seed for the random number generator
\item regressionOrder: the regression order to be used within regression models
\end{itemize}
\end{itemize}
The output parameter is a pair consisting of
\begin{itemize}
Expand All @@ -268,19 +279,19 @@ \subsection{Implementation of the ComputeContext interface}\label{implComputeCon
\begin{itemize}
\item \verb+dim+ the dimension (typically the number of assets in a MC simulation)
\item \verb+steps+ the number of steps (typically the number of time steps in a MC simulation)
\item \verb+seed+ the seed of the random number generation, equal seeds must generate identical variates, different
seeds might or might not generate different variates
\end{itemize}
The output parameter is a vector of a vector of ids for the generated variates. The inner vector loops of the steps,
the outer vector over the dimensions.
\item \verb+applyOperation()+: apply an operation to a list of arguments and return the id of the result. The list of
operations is described in \ref{randomVariableOpCodes}
\item \verb+freeVariable()+: indicate that the variable with the given id will no longer be referenced in subsequent
calculations. The variable id can be reused as a new variable.
\item \verb+declareOutputVariable()+: declare a variable with given id as part of the output vector
\item \verb+declareOutputVariable()+: declare a variable with given id as part of the output vector.
\item \verb+finalizeCalculation()+: execute the calculation and populate the given vector of vector of floats with the
result. The inner vector is given as a raw pointer and must have the size of the calculation. The outer vector matches
the output variables in the order they were declared before.
\item \verb+deviceInfo()+: provide key-value pairs that describes the device, only used for information purposes
\item \verb+supportsDoublePreicions()+: should return true if doule precision is supported, otherwise false
\item \verb+debugInfo()+: provide info on the number of elementary operations and timings on data copying, program build
and calculations. This info is collected if a new calculation is started with flag debug set to true
\end{itemize}
Expand All @@ -289,12 +300,17 @@ \subsection{Implementation of the ComputeContext interface}\label{implComputeCon

\begin{enumerate}
\item \verb+initiateCalculation()+: once
\item \verb+createInputVariable()+: never, once, or several times
\item \verb+createInputVariates()+: never, once, or several times
\item \verb+applyOperation()+: only called if the current calculation is not replayed from a previous calculation, then can be called never, once, or several times
\item \verb+freeVariable()+: only called if the current calculation is not replayed, then can be called never, once, or several times
\item \verb+declareOutputVariable()+: only called if the current calculation is not replayed, then can be called never, once, or several times
\item \verb+finalizeCalculation()+: never or once
\item \verb+createInputVariable()+: never, once, or several times, if a calc is replayed, the same number and type of
input variables must be created (just with possibly different values)
\item \verb+createInputVariates()+: called if the current calculation is not replayed from a previous calculation, then
can be called never, once or several times
\item \verb+applyOperation()+: only called if the current calculation is not replayed from a previous calculation, then
can be called never, once, or several times
\item \verb+freeVariable()+: only called if the current calculation is not replayed, then can be called never, once, or
several times
\item \verb+declareOutputVariable()+: only called if the current calculation is not replayed, then can be called never,
once, or several times
\item \verb+finalizeCalculation()+: once
\end{enumerate}

\subsection{Random Variable Op Codes}\label{randomVariableOpCodes}
Expand Down Expand Up @@ -373,7 +389,7 @@ \subsection{Initiation of a calculation}
\begin{minted}[fontsize=\footnotesize]{xml}
std::tie(externalCalculationId_, newExternalCalc) =
ComputeEnvironment::instance().context()
.initiateCalculation(model_->size(), externalCalculationId_, cgVersion_);
.initiateCalculation(model_->size(), externalCalculationId_, cgVersion_, settings);
\end{minted}

providing
Expand All @@ -384,6 +400,8 @@ \subsection{Initiation of a calculation}
to get a new id and for subsequent calculations of the same trade this id is reused
\item \verb+cgVersion_+: a version number (initially zero). The version is incremented whenever a repricing requires a
different sequence of operations to be performed, which is the case when the evaluation date changes
\item \verb+settings+: the settings to be used, see \ref{implComputeFramework} for details. Notice that for a replayed
calculation the settings must match the ones from the initial calculation.
\end{itemize}

and retrieving the external calc id and a flag indicating whether the calculation requires a resubmission of an
Expand Down Expand Up @@ -417,16 +435,17 @@ \subsection{Populating the input variables}

\subsection{Populating the input variates}

The next step is the creating of random variates
The next step is the creating of random variates (if this is a new calculation and not replayed):

\begin{minted}[fontsize=\footnotesize]{xml}
auto gen = ComputeEnvironment::instance().context()
.createInputVariates(rv.size(),
rv.front().size(),
42);
for (Size k = 0; k < rv.size(); ++k) {
for (Size j = 0; j < rv.front().size(); ++j)
valuesExternal[rv[k][j]] = ExternalRandomVariable(gen[k][j]);
if (useExternalComputeFramework_ && newExternalCalc) {
auto gen =
ComputeEnvironment::instance().context().
createInputVariates(rv.size(), rv.front().size());
for (Size k = 0; k < rv.size(); ++k) {
for (Size j = 0; j < rv.front().size(); ++j)
valuesExternal[rv[k][j]] = ExternalRandomVariable(gen[k][j]);
}
}
\end{minted}

Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added Docs/Design/data/notebook.pdf
Binary file not shown.
Binary file added Docs/Design/data/process.pdf
Binary file not shown.
Binary file added Docs/Design/data/restore.pdf
Binary file not shown.
Binary file added Docs/Design/data/restore.pptx
Binary file not shown.
Binary file added Docs/Design/data/services.pdf
Binary file not shown.
Loading

0 comments on commit 03da410

Please sign in to comment.