88 #define fei_file "fei_test.cpp"
97 int argc,
char** argv,
MPI_Comm comm);
100 int argc,
char** argv,
MPI_Comm comm);
109 MPI_Comm& newcomm1, MPI_Group& newgroup1,
110 MPI_Comm& newcomm2, MPI_Group& newgroup2);
116 int main(
int argc,
char** argv) {
123 if (localProc == 0) {
134 if (!testname.empty()) {
137 if (localProc == 0 && errcode == 0) {
147 if (localProc == 0) {
155 catch(std::runtime_error& exc) {
161 int global_err_code = 0;
164 if (localProc == 0) {
169 return(global_err_code);
173 int argc,
char** argv,
182 std::vector<std::string> inputFileNames;
183 if (!filename.empty()) {
184 const char* filename_c_str = filename.c_str();
197 catch(std::runtime_error& exc) {
210 if (localProc == 0) {
212 <<
"*****************************************************************"
213 <<
FEI_ENDL <<
" Running tests with partitioned communicators/groups"
215 <<
"*****************************************************************"
220 MPI_Group newgroup1, newgroup2;
226 newcomm2, newgroup2);
248 catch(std::exception& exc) {
249 FEI_COUT <<
"test_library_plugins: caught exception: "
262 catch(std::exception& exc) {
263 FEI_COUT <<
"test_library_plugins: caught exception: "
276 catch(std::exception& exc) {
277 FEI_COUT <<
"test_library_plugins: caught exception: "
287 int argc,
char** argv,
MPI_Comm comm)
301 bool testname_recognized =
false;
303 if (testname ==
"unit_tests") {
304 testname_recognized =
true;
308 catch(std::runtime_error& exc) {
314 if (testname ==
"poisson_main") {
315 errcode =
poisson_main(argc, argv, comm, numProcs, localProc);
316 testname_recognized =
true;
318 if (testname ==
"poisson3_main") {
319 errcode =
poisson3_main(argc, argv, comm, numProcs, localProc);
320 testname_recognized =
true;
323 if (testname ==
"beam_oldfei_main") {
325 testname_recognized =
true;
327 if (testname ==
"beam_main") {
328 errcode =
beam_main(argc, argv, comm, numProcs, localProc);
329 testname_recognized =
true;
332 if (testname ==
"feiDriver_main") {
334 testname_recognized =
true;
337 if (testname ==
"library_plugins") {
339 testname_recognized =
true;
342 if (testname ==
"benchmarks") {
343 testname_recognized =
true;
344 if (localProc == 0) {
348 catch(std::runtime_error& exc) {
357 if (!testname_recognized && localProc == 0) {
358 FEI_COUT <<
"fei_test: '-test' argument used, but value ("<<testname
359 <<
") not recognized. Valid values are:"<<
FEI_ENDL
377 bool test_failed =
false;
378 if (tst.
runtests() != 0) test_failed =
false;
380 if (test_failed)
throw std::runtime_error(
"unit-test failed");
386 std::vector<fei::SharedPtr<tester> > testers;
412 std::vector<fei::SharedPtr<tester> >::const_iterator
413 testers_iter = testers.begin(),
414 testers_end = testers.end();
416 std::string failed_test_name;
417 bool test_failed =
false;
418 for(; testers_iter != testers_end; ++testers_iter) {
424 failed_test_name = tst->
getName();
430 std::string str1(
"unit-test failed: ");
431 throw std::runtime_error(str1+failed_test_name);
436 const std::string& path,
442 test_fei.
setPath(path.c_str());
452 n_iter = name_numproc_pairs.
begin(),
453 n_end = name_numproc_pairs.
end();
455 for(; n_iter != n_end; ++n_iter) {
456 const char* fileName = (*n_iter).getName().c_str();
457 int numProcsToUse = (*n_iter).getIntValue();
472 int resultCode = test_fei.
runtests();
473 if (resultCode < 0) {
474 throw std::runtime_error(
"nonzero resultCode from test_fei.runtests()");
481 MPI_Comm& newcomm1, MPI_Group& newgroup1,
482 MPI_Comm& newcomm2, MPI_Group& newgroup2)
490 MPI_Comm_rank(comm, &localProc);
491 MPI_Comm_size(comm, &numProcs);
497 std::vector<int> procs(numProcs);
503 int newgroup1_size = 2, newgroup2_size = 2;
506 MPI_Comm_group(comm, &group);
508 MPI_Group_incl(group, newgroup1_size, &procs[0], &newgroup1);
509 MPI_Group_incl(group, newgroup2_size, &procs[0]+midpoint, &newgroup2);
511 MPI_Comm_create(comm, newgroup1, &newcomm1);
512 MPI_Comm_create(comm, newgroup2, &newcomm2);
int GlobalSum(MPI_Comm comm, std::vector< T > &local, std::vector< T > &global)
std::string construct_filename(int argc, char **argv)
void setPath(const std::string &path)
int poisson_main(int argc, char **argv, MPI_Comm comm, int numProcs, int localProc)
void Barrier(MPI_Comm comm)
int beam_oldfei_main(int argc, char **argv, MPI_Comm comm, int numProcs, int localProc)
int execute_named_test(const std::string &testname, int argc, char **argv, MPI_Comm comm)
void execute_fullsystem_tests(MPI_Comm comm, const std::string &path, fei::ParameterSet &name_numproc_pairs)
int poisson3_main(int argc, char **argv, MPI_Comm comm, int numProcs, int localProc)
void setFileName(const char *filename)
int test_library_plugins(MPI_Comm comm)
int beam_main(int argc, char **argv, MPI_Comm comm, int numProcs, int localProc)
void read_input_and_execute_fullsystem_tests(const std::string &filename, int argc, char **argv, MPI_Comm comm)
void read_input_file(const char *filename, MPI_Comm comm, std::vector< std::string > &file_contents)
void broadcast_string(MPI_Comm comm, int root, std::string &strg)
std::ostream & console_out()
void parse_strings(std::vector< std::string > &stdstrings, const char *separator_string, fei::ParameterSet ¶mset)
int split_four_procs_into_two_groups(MPI_Comm comm, MPI_Comm &newcomm1, MPI_Group &newgroup1, MPI_Comm &newcomm2, MPI_Group &newgroup2)
void execute_unit_tests(const std::string &path, MPI_Comm comm)
int feiDriver_main(int argc, char **argv, MPI_Comm comm, int numProcs, int localProc)
int localProc(MPI_Comm comm)
const_iterator end() const
std::string get_arg_value(const char *flag, int argc, char **argv)
const_iterator begin() const
virtual const char * getName()=0
int main(int argc, char **argv)
void execute_benchmarks(MPI_Comm comm)
int numProcs(MPI_Comm comm)