121int main(
int argc,
char* argv[]) {
130 Teuchos::CommandLineProcessor clp;
131 clp.setDocString(
"This program tests the speed of various forward mode AD implementations for a single multiplication operation");
133 clp.setOption(
"nderiv", &nderiv,
"Number of derivative components");
135 clp.setOption(
"nloop", &nloop,
"Number of loops");
138 Teuchos::CommandLineProcessor::EParseCommandLineReturn
139 parseReturn= clp.parse(argc, argv);
140 if(parseReturn != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL)
143 std::cout.setf(std::ios::scientific);
144 std::cout.precision(p);
145 std::cout <<
"Times (sec) for nderiv = " << nderiv
146 <<
" nloop = " << nloop <<
": " << std::endl;
149 std::cout <<
"Analytic: " << std::setw(w) << ta << std::endl;
152 std::cout <<
"SimpleFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
155 std::cout <<
"TFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
158 std::cout <<
"Fad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
161 std::cout <<
"SFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
164 std::cout <<
"SLFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
167 std::cout <<
"DFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
170 std::cout <<
"ELRSFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
173 std::cout <<
"ELRSLFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
176 std::cout <<
"ELRDFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
179 std::cout <<
"CacheFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
182 std::cout <<
"DVFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
185 catch (std::exception& e) {
186 std::cout << e.what() << std::endl;
189 catch (
const char *s) {
190 std::cout << s << std::endl;
194 std::cout <<
"Caught unknown exception!" << std::endl;
void func1_and_deriv(int n, double x1, double x2, double *x1dot, double *x2dot, double &y, double *ydot)