Skip to content

Commit db98a32

Browse files
pcaspersjenkins
authored andcommitted
QPR-12462 add warnings to st trade builder when AD (ext device) is disabled although it is configured in the pe config
1 parent cd95650 commit db98a32

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

OREData/ored/portfolio/builders/scriptedtrade.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,19 @@ ScriptedTradeEngineBuilder::engine(const std::string& id, const ScriptedTrade& s
325325
generateAdditionalResults, includePastCashflows_);
326326
} else if (modelCG_) {
327327
auto rt = globalParameters_.find("RunType");
328-
bool useCachedSensis = useAd_ && (rt != globalParameters_.end() && rt->second == "SensitivityDelta");
328+
std::string runType = rt != globalParameters_.end() ? rt->second : "<<no run type set>>";
329+
bool useCachedSensis = useAd_ && (runType == "SensitivityDelta");
329330
bool useExternalDev = useExternalComputeDevice_ && !generateAdditionalResults && !useCachedSensis;
331+
if (useAd_ && !useCachedSensis) {
332+
WLOG("Will not apply AD although useAD is configured, because runType ("
333+
<< runType << ") does not match SensitivitiyDelta");
334+
}
335+
if (useExternalComputeDevice_ && !useExternalDev) {
336+
WLOG("Will not use exxternal compute deivce although useExternalComputeDevice is configured, because we "
337+
"are either applying AD ("
338+
<< std::boolalpha << useCachedSensis << ") or we are generating add results ("
339+
<< generateAdditionalResults << "), both of which do not support external devices at the moment.");
340+
}
330341
engine = QuantLib::ext::make_shared<ScriptedInstrumentPricingEngineCG>(
331342
script.npv(), script.results(), modelCG_, ast_, context, mcParams_, script.code(), interactive_,
332343
generateAdditionalResults, includePastCashflows_, useCachedSensis, useExternalDev,

0 commit comments

Comments
 (0)