40#include "../../expressions/lhsExpressionInterface.hpp"
42#include "../../tapes/interfaces/fullTapeInterface.hpp"
43#include "../../tapes/misc/vectorAccessInterface.hpp"
44#include "../../traits/tapeTraits.hpp"
45#include "../data/externalFunctionUserData.hpp"
46#include "externalFunctionHelper.hpp"
50extern int enzyme_const;
52template<
typename... Args>
53void __enzyme_autodiff(
void*, Args...);
55template<
typename... Args>
56void __enzyme_fwddiff(
void*, Args...);
83 template<
typename T_Type>
92 using Real =
typename Type::Real;
117 template<PrimalFunc func>
124 template<PrimalFunc func>
126 for (
size_t i = 0; i < m; i += 1) {
130 for (
size_t i = 0; i < n; i += 1) {
138 template<PrimalFunc func>
139 static void enzymeDiff_b(Real
const* x, Real* x_b,
size_t m, Real
const*
y, Real
const* y_b,
size_t n,
152 template<PrimalFunc func>
153 static void enzymeDiff_d(Real
const* x, Real
const* x_d,
size_t m, Real*
y, Real* y_d,
size_t n,
154 ExternalFunctionUserData* d) {
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:96
#define CODI_T(...)
Abbreviation for CODI_TEMPLATE.
Definition macros.hpp:116
CoDiPack - Code Differentiation Package.
Definition codi.hpp:94
typename Type::Real Real
See LhsExpressionInterface.
Definition enzymeExternalFunctionHelper.hpp:92
typename Type::Tape Tape
See LhsExpressionInterface.
Definition enzymeExternalFunctionHelper.hpp:96
T_Type Type
See ExternalFunctionHelper.
Definition enzymeExternalFunctionHelper.hpp:88
typename Base::PrimalFunc PrimalFunc
See ExternalFunctionHelper.
Definition enzymeExternalFunctionHelper.hpp:98
typename Type::Identifier Identifier
See LhsExpressionInterface.
Definition enzymeExternalFunctionHelper.hpp:93
ExternalFunctionHelper< Type > Base
Base class abbreviation.
Definition enzymeExternalFunctionHelper.hpp:90
void callAndAddToTape()
Definition enzymeExternalFunctionHelper.hpp:118
EnzymeExternalFunctionHelper()
Constructor.
Definition enzymeExternalFunctionHelper.hpp:103
void callAndAddToTape(Type const *x, size_t m, Type *y, size_t n)
Adds all inputs in x and outputs in y to the external function and then calls callAndAddToTape().
Definition enzymeExternalFunctionHelper.hpp:125
inlinevoid addInput(Type const &input)
Definition externalFunctionHelper.hpp:455
ExternalFunctionHelper(bool primalFuncUsesADType=false)
Constructor.
Definition externalFunctionHelper.hpp:406
void(*)(Real const *x, size_t m, Real *y, size_t n, ExternalFunctionUserData *d) PrimalFunc
Definition externalFunctionHelper.hpp:128
inlinevoid callPrimalFunc(PrimalFunc func)
Definition externalFunctionHelper.hpp:543
inlinevoid callPrimalFuncWithADType(FuncObj &func, Args &&... args)
Definition externalFunctionHelper.hpp:517
std::vector< Real > y
Shared vector of output variables.
Definition externalFunctionHelper.hpp:401
inlinevoid addOutput(Type &output)
Definition externalFunctionHelper.hpp:496
inlinevoid addToTape(ReverseFunc reverseFunc, ForwardFunc forwardFunc=nullptr, PrimalFunc primalFunc=nullptr)
Definition externalFunctionHelper.hpp:581
Ease of access structure for user-provided data on the tape for external functions....
Definition externalFunctionUserData.hpp:59
Full tape interface that supports all features of CoDiPack.
Definition fullTapeInterface.hpp:84
Base class for all CoDiPack lvalue expression.
Definition lhsExpressionInterface.hpp:63