]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Merge pull request #4378 from class4kayaker/fix_initlog
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 8 Jun 2017 15:56:34 +0000 (17:56 +0200)
committerGitHub <noreply@github.com>
Thu, 8 Jun 2017 15:56:34 +0000 (17:56 +0200)
Fix initlog

77 files changed:
1  2 
tests/base/product_type_04.cc
tests/base/product_type_04_symmetric.cc
tests/base/task_09.cc
tests/base/timer.cc
tests/hp/fe_nothing_18.cc
tests/lac/linear_operator_11.cc
tests/lac/vector_type_traits_is_serial_02.cc
tests/mpi/p4est_2d_constraintmatrix_03.cc
tests/mpi/p4est_3d_constraintmatrix_02.cc
tests/mpi/p4est_3d_constraintmatrix_03.cc
tests/mpi/trilinos_ghost_03_linfty.cc
tests/trilinos/11.cc
tests/trilinos/12.cc
tests/trilinos/13.cc
tests/trilinos/14.cc
tests/trilinos/15.cc
tests/trilinos/16.cc
tests/trilinos/17.cc
tests/trilinos/18.cc
tests/trilinos/19.cc
tests/trilinos/20.cc
tests/trilinos/21.cc
tests/trilinos/22.cc
tests/trilinos/23.cc
tests/trilinos/24.cc
tests/trilinos/26.cc
tests/trilinos/27.cc
tests/trilinos/28.cc
tests/trilinos/29.cc
tests/trilinos/30.cc
tests/trilinos/31.cc
tests/trilinos/32.cc
tests/trilinos/33.cc
tests/trilinos/34.cc
tests/trilinos/35.cc
tests/trilinos/36.cc
tests/trilinos/37.cc
tests/trilinos/38.cc
tests/trilinos/39.cc
tests/trilinos/40.cc
tests/trilinos/41.cc
tests/trilinos/42.cc
tests/trilinos/45.cc
tests/trilinos/46.cc
tests/trilinos/49.cc
tests/trilinos/49a.cc
tests/trilinos/49b.cc
tests/trilinos/50.cc
tests/trilinos/51.cc
tests/trilinos/53.cc
tests/trilinos/54.cc
tests/trilinos/55.cc
tests/trilinos/56.cc
tests/trilinos/57.cc
tests/trilinos/58.cc
tests/trilinos/60.cc
tests/trilinos/61.cc
tests/trilinos/block_vector_iterator_01.cc
tests/trilinos/block_vector_iterator_02.cc
tests/trilinos/deal_solver_02.cc
tests/trilinos/deal_solver_06.cc
tests/trilinos/precondition.cc
tests/trilinos/slowness_02.cc
tests/trilinos/sparse_matrix_vector_01.cc
tests/trilinos/sparse_matrix_vector_02.cc
tests/trilinos/sparse_matrix_vector_03.cc
tests/trilinos/sparse_matrix_vector_04.cc
tests/trilinos/sparse_matrix_vector_05.cc
tests/trilinos/sparse_matrix_vector_06.cc
tests/trilinos/sparse_matrix_vector_07.cc
tests/trilinos/vector_assign_01.cc
tests/trilinos/vector_assign_02.cc
tests/trilinos/vector_equality_1.cc
tests/trilinos/vector_equality_2.cc
tests/trilinos/vector_equality_3.cc
tests/trilinos/vector_equality_4.cc
tests/trilinos/vector_swap_01.cc

Simple merge
index fc02a2e4b6b02b138a42c674ac33e5d590b3c9e8,45f5604cd848fb56a9dad91e24a309e88fae0a0d..e6f8ab387cc11fb558371c5ccdd02d0b20cfc6a1
@@@ -55,29 -61,11 +55,28 @@@ void outer (
  
  int main()
  {
-   std::ofstream logfile("output");
-   deallog.attach(logfile);
+   initlog();
    deallog.threshold_double(1.e-10);
  
 -  for (unsigned int i=0; i<MultithreadInfo::n_cores()*2; ++i)
 -    Threads::new_task (outer);
 +  {
 +    const std::size_t n_tasks = MultithreadInfo::n_cores()*2;
 +#ifdef _POSIX_C_SOURCE
 +    // get rid of the environment variable if it exists (this may not be
 +    // possible under MSVC, but the test will still pass; it just won't test
 +    // what we want it to test)
 +    unsetenv("DEAL_II_NUM_THREADS");
 +#endif
 +    // Since this test relies on providing more tasks than there are cores,
 +    // reset the concurrency limit that exists in tests.h:
 +    MultithreadInfo::set_thread_limit(n_tasks);
 +    std::vector<Threads::Task<void>> tasks(n_tasks);
 +    for (std::size_t task_n=0; task_n<n_tasks; ++task_n)
 +      {
 +        // We must save each task, otherwise it will join before the next loop
 +        // iteration
 +        tasks.emplace_back(Threads::new_task(outer));
 +      }
 +  }
  
    deallog << "OK" << std::endl;
  }
index 748bbe4d1c31bb47070289e04469ca9e2d724b94,768f36a61d1962b75c23774cdb4d561c83f6b403..e4d5554c26ba81ab165da8c0b287073d008d66d3
@@@ -39,66 -58,27 +39,65 @@@ void burn (unsigned int n
  
  int main ()
  {
-   std::ofstream logfile("output");
-   deallog.attach(logfile);
+   initlog();
    deallog.threshold_double(1.e-10);
  
 -  Timer t1,t2;
 -  burn (50);
 -  double s01 = t1.stop();
 -  double s02 = t2();
 -  burn (50);
 -  double s11 = t1.stop();
 -  double s12 = t2();
 -  t1.start();
 -  burn (50);
 -  double s21 = t1();
 -  double s22 = t2();
 -  burn (50);
 -  double s31 = t1();
 -  double s32 = t2();
 -
 -  compare (s01,s02,1.);
 -  compare (s11,s12,2.);
 -  compare (s21,s22,3./2.);
 -  compare (s31,s32,4./3.);
 +  Timer t;
 +  burn(50);
 +
 +  double s1 = t();
 +
 +  if (s1 > 0.)
 +    deallog << "OK" << std::endl;
 +  else
 +    deallog << "ERROR - s1 should be nonzero" << std::endl;
 +
 +  burn(50);
 +  t.stop();
 +  double s2 = t();
 +
 +  if (s2 > s1)
 +    deallog << "OK" << std::endl;
 +  else
 +    deallog << "ERROR - s2 should be greater than s1" << std::endl;
 +
 +  burn(50);
 +  double s3 = t();
 +
 +  if (s3 == s2)
 +    deallog << "OK" << std::endl;
 +  else
 +    deallog << "ERROR - s3 should be equal to s2" << std::endl;
 +
 +  t.start();
 +  burn(50);
 +  double s4 = t();
 +
 +  if (s4 > s3)
 +    deallog << "OK" << std::endl;
 +  else
 +    deallog << "ERROR - s4 should be greater than s3" << std::endl;
 +
 +  t.stop();
 +  t.reset();
 +  burn(50);
 +  double s5 = t();
 +
 +  if (s5 == 0.)
 +    deallog << "OK" << std::endl;
 +  else
 +    deallog << "ERROR - s5 should be zero" << std::endl;
 +
 +  t.start();
 +  burn(50);
 +  t.reset();
 +  burn(50);
 +  double s6 = t();
 +
 +  if (s6 == 0.)
 +    deallog << "OK" << std::endl;
 +  else
 +    deallog << "ERROR - s6 should be zero" << std::endl;
 +
  }
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.