← Back to team overview

dolfin team mailing list archive

[noreply@xxxxxxxxxxxxx: [Branch ~dolfin-core/dolfin/main] Rev 4495: Add parameter to select mesh partitioner (SCOTCH/ParMETIS).]

 

Nice.

--
Anders
--- Begin Message ---
------------------------------------------------------------
revno: 4495
committer: Garth N. Wells <gnw20@xxxxxxxxx>
branch nick: dolfin-all
timestamp: Fri 2010-02-12 13:32:09 +0000
message:
  Add parameter to select mesh partitioner (SCOTCH/ParMETIS).
modified:
  demo/pde/elasticity/cpp/main.cpp
  demo/pde/poisson/cpp/main.cpp
  dolfin/graph/SCOTCH.cpp
  dolfin/la/DefaultFactory.cpp
  dolfin/mesh/MeshPartitioning.cpp
  dolfin/parameter/GlobalParameters.h


--
lp:dolfin
https://code.launchpad.net/~dolfin-core/dolfin/main

Your team DOLFIN Core Team is subscribed to branch lp:dolfin.
To unsubscribe from this branch go to https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription.
=== modified file 'demo/pde/elasticity/cpp/main.cpp'
--- demo/pde/elasticity/cpp/main.cpp	2010-02-12 13:01:20 +0000
+++ demo/pde/elasticity/cpp/main.cpp	2010-02-12 13:32:09 +0000
@@ -113,12 +113,11 @@
   Elasticity::LinearForm L(V);
   L.f = f;
   VariationalProblem problem(a, L, bcs);
-  //problem.parameters["symmetric"] = true;
+  problem.parameters["symmetric"] = true;
 
   // Solve PDE (using direct solver)
   Function u(V);
-  //problem.parameters["linear_solver"] = "direct";
-  problem.parameters["linear_solver"] = "iterative";
+  problem.parameters["linear_solver"] = "direct";
   problem.solve(u);
 
   cout << "Norm " << u.vector().norm("l2") << endl;

=== modified file 'demo/pde/poisson/cpp/main.cpp'
--- demo/pde/poisson/cpp/main.cpp	2010-02-12 13:01:20 +0000
+++ demo/pde/poisson/cpp/main.cpp	2010-02-12 13:32:09 +0000
@@ -53,10 +53,12 @@
 
 int main()
 {
+  //parameters["mesh_partitioner"] = "ParMETIS";
+  parameters["mesh_partitioner"] = "SCOTCH";
+
   // Create mesh and function space
-  UnitSquare mesh(32, 32);
-  //Mesh mesh("../../../../data/meshes/dolfin-2.xml.gz");  
-  //mesh.order();
+  //UnitSquare mesh(32, 32);
+  Mesh mesh("../../../../data/meshes/unstruct-trimesh-2.xml.gz");  
   Poisson::FunctionSpace V(mesh);
 
   // Define boundary condition

=== modified file 'dolfin/graph/SCOTCH.cpp'
--- dolfin/graph/SCOTCH.cpp	2010-02-12 13:01:20 +0000
+++ dolfin/graph/SCOTCH.cpp	2010-02-12 13:32:09 +0000
@@ -474,7 +474,11 @@
   // Copy partiton data
   cell_partition.resize(vertlocnbr);
   for (uint i = 0; i < cell_partition.size(); ++i)
+  {
+    if ( cell_partition[i] < 0 || cell_partition[i] >= (uint) npart )
+      error("Problem with SCOTCH partition.");
     cell_partition[i] = partloctab[i];
+  }
 }
 //-----------------------------------------------------------------------------
 #else

=== modified file 'dolfin/la/DefaultFactory.cpp'
--- dolfin/la/DefaultFactory.cpp	2009-09-21 18:15:02 +0000
+++ dolfin/la/DefaultFactory.cpp	2010-02-12 13:32:09 +0000
@@ -38,11 +38,11 @@
 LinearAlgebraFactory& DefaultFactory::factory() const
 {
   // Fallback
-  std::string default_backend = "uBLAS";
+  const std::string default_backend = "uBLAS";
   typedef uBLASFactory<> DefaultFactory;
 
   // Get backend from parameter system
-  std::string backend = parameters["linear_algebra_backend"];
+  const std::string backend = parameters["linear_algebra_backend"];
 
   // Choose backend
   if (backend == "uBLAS")

=== modified file 'dolfin/mesh/MeshPartitioning.cpp'
--- dolfin/mesh/MeshPartitioning.cpp	2010-02-11 00:22:27 +0000
+++ dolfin/mesh/MeshPartitioning.cpp	2010-02-12 13:32:09 +0000
@@ -9,6 +9,9 @@
 #include <dolfin/log/log.h>
 #include <dolfin/main/MPI.h>
 #include <dolfin/common/Timer.h>
+#include <dolfin/graph/ParMETIS.h>
+#include <dolfin/graph/SCOTCH.h>
+#include <dolfin/parameter/GlobalParameters.h>
 #include "LocalMeshData.h"
 #include "Point.h"
 #include "Vertex.h"
@@ -18,8 +21,6 @@
 #include "MeshFunction.h"
 #include "MeshPartitioning.h"
 
-#include <dolfin/graph/ParMETIS.h>
-#include <dolfin/graph/SCOTCH.h>
 
 using namespace dolfin;
 
@@ -70,8 +71,13 @@
 {
   // Compute cell partition
   std::vector<uint> cell_partition;
-  //ParMETIS::compute_partition(cell_partition, mesh_data);
-  SCOTCH::compute_partition(cell_partition, mesh_data);
+  const std::string partitioner = parameters["mesh_partitioner"];
+  if (partitioner == "SCOTCH")
+    SCOTCH::compute_partition(cell_partition, mesh_data);
+  else if (partitioner == "ParMETIS")
+    ParMETIS::compute_partition(cell_partition, mesh_data);
+  else
+    error("Unknown mesh partition '%s'.", partitioner.c_str());
     
   // Distribute cells
   Timer timer("PARALLEL 2: Distribute mesh (cells and vertices)");

=== modified file 'dolfin/parameter/GlobalParameters.h'
--- dolfin/parameter/GlobalParameters.h	2009-10-28 17:00:27 +0000
+++ dolfin/parameter/GlobalParameters.h	2010-02-12 13:32:09 +0000
@@ -43,18 +43,21 @@
       p.add("optimize", false);                              // All of the above
 
       // Linear algebra ---
-#ifdef HAS_PETSC
+      #ifdef HAS_PETSC
       p.add("linear_algebra_backend", "PETSc");              // Use PETSc if available
-#else
+      #else
       p.add("linear_algebra_backend", "uBLAS");              // Otherwise, use uBLAS
-#endif
+      #endif
 
       // Floating-point precision (only relevant when using GMP) ---
-#ifdef HAS_GMP
+      #ifdef HAS_GMP
       p.add("floating_point_precision", 30);                 // Use higher precision for GMP (can be changed)
-#else
+      #else
       p.add("floating_point_precision", 16);                 // Use double precision when GMP is not available
-#endif
+      #endif
+
+      // Graph partitioner ---
+      p.add("mesh_partitioner", "SCOTCH");              // Use PETSc if available
 
       return p;
     }


--- End Message ---

Attachment: signature.asc
Description: Digital signature