MCPcopy Create free account
hub / github.com/coin-or/CppAD / main

Function main

example/multi_thread/thread_test.cpp:274–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274int main(int argc, char *argv[])
275{ using CppAD::thread_alloc;
276 bool ok = true;
277 using std::cout;
278 using std::endl;
279
280 // command line usage message
281 const char* usage =
282 "./<program> a11c\n"
283 "./<program> get_started\n"
284 "./<program> team_example\n"
285 "./<program> harmonic test_time max_threads mega_sum\n"
286 "./<program> atomic_two test_time max_threads num_solve\n"
287 "./<program> atomic_three test_time max_threads num_solve\n"
288 "./<program> chkpoint_one test_time max_threads num_solve\n"
289 "./<program> chkpoint_two test_time max_threads num_solve\n"
290 "./<program> multi_newton test_time max_threads \\\n"
291 " num_zero num_sub num_sum use_ad\\\n"
292 "where <program> is example_multi_thread_<threading>\n"
293 "and <threading> is openmp, bthread, pthread, or sthread";
294
295 // command line argument values (assign values to avoid compiler warnings)
296 size_t num_zero=0, num_sub=0, num_sum=0;
297 bool use_ad=true;
298
299 // put the date and time in the output file
300 std::time_t rawtime;
301 std::time( &rawtime );
302 const char* gmt = std::asctime( std::gmtime( &rawtime ) );
303 size_t len = size_t( std::strlen(gmt) );
304 cout << "gmtime = '";
305 for(size_t i = 0; i < len; i++)
306 if( gmt[i] != '\n' ) cout << gmt[i];
307 cout << "';" << endl;
308
309 // CppAD version number
310 cout << "cppad_version = '" << CPPAD_PACKAGE_STRING << "';" << endl;
311
312 // put the team name in the output file
313 cout << "thread_system = '" << team_name() << "';" << endl;
314
315 // print command line as valid matlab/octave
316 cout << "command = '" << argv[0];
317 for(int i = 1; i < argc; i++)
318 cout << " " << argv[i];
319 cout << "';" << endl;
320
321 ok = false;
322 const char* test_name = "";
323 if( argc > 1 )
324 test_name = *++argv;
325 bool run_a11c = std::strcmp(test_name, "a11c") == 0;
326 bool run_get_started = std::strcmp(test_name, "get_started") == 0;
327 bool run_team_example = std::strcmp(test_name, "team_example") == 0;
328 bool run_harmonic = std::strcmp(test_name, "harmonic") == 0;
329 bool run_atomic_two = std::strcmp(test_name, "atomic_two") == 0;
330 bool run_atomic_three = std::strcmp(test_name, "atomic_three") == 0;
331 bool run_chkpoint_one = std::strcmp(test_name, "chkpoint_one") == 0;

Callers

nothing calls this directly

Calls 12

team_exampleFunction · 0.85
arg2doubleFunction · 0.85
arg2size_tFunction · 0.85
harmonic_timeFunction · 0.85
multi_atomic_two_timeFunction · 0.85
multi_atomic_three_timeFunction · 0.85
multi_chkpoint_one_timeFunction · 0.85
multi_chkpoint_two_timeFunction · 0.85
multi_newton_timeFunction · 0.85
team_nameFunction · 0.50
a11cFunction · 0.50
get_startedFunction · 0.50

Tested by

no test coverage detected