Compiler returned -1 when std::vector<double> is involved #2119
Open
Description
Start to try Enzyme in Enzyme explorer. I found it does not compile when a runtime size container is involved, e.g. std::vector, as in the following example,
double dprod(const std::vector& v) {
double r = 1;
for (int i = 0; i < v.size(); i++) {
r *= v[i];
}
return r;
}
double g(double x) {
std::vector v;
v.push_back(x);
v.push_back(x*x);
return dprod(v);
}
int main() {
double x = 3;
double d_x = __enzyme_autodiff((void*)g, enzyme_out, x);
printf("d_x = %g\n", d_x);
}
This is critical for us, because we need to use Eigen::MatrixXd and Eigen::VectorXd with their sizes determined at runtime. Their elements are functions of some physical design variables.
Thanks for your help!
Metadata
Assignees
Labels
No labels