49 double xi[3], xj[3], pa[4], f[3], delr[3];
136int main(
int argc,
char* argv[]) {
145 Teuchos::CommandLineProcessor clp;
146 clp.setDocString(
"This program tests the speed of various forward mode AD implementations for a single multiplication operation");
148 clp.setOption(
"nloop", &nloop,
"Number of loops");
151 Teuchos::CommandLineProcessor::EParseCommandLineReturn
152 parseReturn= clp.parse(argc, argv);
153 if(parseReturn != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL)
156 std::cout.setf(std::ios::scientific);
157 std::cout.precision(
p);
158 std::cout <<
"Times (sec) nloop = " << nloop <<
": " << std::endl;
161 for (
int i=0;
i<3;
i++) {
169 std::cout <<
"Analytic: " << std::setw(w) << ta << std::endl;
171 t = do_time< FAD::TFad<3,double> >(nloop);
172 std::cout <<
"TFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
174 t = do_time< FAD::Fad<double> >(nloop);
175 std::cout <<
"Fad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
177 t = do_time< Sacado::Fad::SFad<double,3> >(nloop);
178 std::cout <<
"SFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
180 t = do_time< Sacado::Fad::SLFad<double,3> >(nloop);
181 std::cout <<
"SLFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
183 t = do_time< Sacado::Fad::DFad<double> >(nloop);
184 std::cout <<
"DFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
186 t = do_time< Sacado::ELRFad::SFad<double,3> >(nloop);
187 std::cout <<
"ELRSFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
189 t = do_time< Sacado::ELRFad::SLFad<double,3> >(nloop);
190 std::cout <<
"ELRSLFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
192 t = do_time< Sacado::ELRFad::DFad<double> >(nloop);
193 std::cout <<
"ELRDFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
195 t = do_time< Sacado::CacheFad::DFad<double> >(nloop);
196 std::cout <<
"CacheFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
198 t = do_time< Sacado::Fad::DVFad<double> >(nloop);
199 std::cout <<
"DVFad: " << std::setw(w) << t <<
"\t" << std::setw(w) << t/ta << std::endl;
202 catch (std::exception& e) {
203 std::cout << e.what() << std::endl;
206 catch (
const char *s) {
207 std::cout << s << std::endl;
211 std::cout <<
"Caught unknown exception!" << std::endl;