Commits

Garth Wells committed e965b73 Merge

Merge branch 'garth/fix-benchmarks'

Comments (0)

Files changed (2)

bench/fem/multicore/cpp/main.cpp

 #include "Poisson.h"
 #include "NavierStokes.h"
 
-#define MAX_NUM_THREADS 1
+#define MAX_NUM_THREADS 4
 #define SIZE 32
 #define NUM_REPS 10
 
   {
     boost::shared_ptr<FunctionSpace> _V(new NavierStokes::FunctionSpace(mesh));
 
-    boost::shared_ptr<FunctionSpace> W0(new NavierStokes::Form_a_FunctionSpace_2(mesh));
-    boost::shared_ptr<FunctionSpace> W1(new NavierStokes::Form_a_FunctionSpace_3(mesh));
-    boost::shared_ptr<FunctionSpace> W2(new NavierStokes::Form_a_FunctionSpace_4(mesh));
-    boost::shared_ptr<FunctionSpace> W3(new NavierStokes::Form_a_FunctionSpace_5(mesh));
-    boost::shared_ptr<FunctionSpace> W4(new NavierStokes::Form_a_FunctionSpace_6(mesh));
+    boost::shared_ptr<FunctionSpace>
+      W0(new NavierStokes::Form_a_FunctionSpace_2(mesh));
+    boost::shared_ptr<FunctionSpace>
+      W1(new NavierStokes::Form_a_FunctionSpace_3(mesh));
+    boost::shared_ptr<FunctionSpace>
+      W2(new NavierStokes::Form_a_FunctionSpace_4(mesh));
+    boost::shared_ptr<FunctionSpace>
+      W3(new NavierStokes::Form_a_FunctionSpace_5(mesh));
+    boost::shared_ptr<FunctionSpace>
+      W4(new NavierStokes::Form_a_FunctionSpace_6(mesh));
 
     boost::shared_ptr<Function> w0(new Function(W0));
     boost::shared_ptr<Function> w1(new Function(W1));
 double bench(std::string form, boost::shared_ptr<const Form> a)
 {
   std::size_t num_threads = parameters["num_threads"];
-  info_underline("Benchmarking %s, num_threads = %d", form.c_str(), num_threads);
+  info_underline("Benchmarking %s, num_threads = %d", form.c_str(),
+                 num_threads);
 
   // Create matrix
   Matrix A;
   old_mesh.color("vertex");
   Mesh mesh = old_mesh.renumber_by_color();
 
-  // Disable dof reordering because the NS dof maps are very large
-  parameters["reorder_dofs_serial"] = false;
-
   // Test cases
   std::vector<std::pair<std::string, boost::shared_ptr<const Form> > > forms;
   forms.push_back(std::make_pair("Poisson", PoissonFactory::a(mesh)));
         std::stringstream s;
         s << num_threads << " threads";
         run_timings(s.str(), forms[i].first) = t;
-        speedups(s.str(), forms[i].first) = run_timings.get_value("0 threads", forms[i].first) / t;
+        speedups(s.str(), forms[i].first)
+          = run_timings.get_value("0 threads", forms[i].first)/t;
         if (num_threads == 0)
           speedups(s.str(), "(rel 1 thread " + forms[i].first + ")") = "-";
         else
-          speedups(s.str(),  "(rel 1 thread " + forms[i].first + ")") = run_timings.get_value("1 threads", forms[i].first) / t;
+        {
+          speedups(s.str(),  "(rel 1 thread " + forms[i].first + ")")
+            = run_timings.get_value("1 threads", forms[i].first)/t;
+        }
       }
     }
 

bench/fem/speedup/cpp/solve-poisson.cpp

     info("TIME (first time): %.5g", t);
 
   // Solve linear system (preconditioner assuming same non-zero pattern)
-  solver.parameters("preconditioner")["same_nonzero_pattern"] = true;
+  if (solver.parameters.has_key("preconditioner"))
+      solver.parameters("preconditioner")["same_nonzero_pattern"] = true;
   u.vector()->zero();
   dolfin::MPI::barrier();
   t = time();
     info("TIME (same nonzero pattern): %.5g", t);
 
   // Solve linear system (re-use preconditioner)
-  solver.parameters("preconditioner")["reuse"] = true;
+  if (solver.parameters.has_key("preconditioner"))
+    solver.parameters("preconditioner")["reuse"] = true;
   u.vector()->zero();
   dolfin::MPI::barrier();
   t = time();