CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Installation

Metis for OpenFOAM 2.1.0

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 2 Post By AlmostSurelyRob

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 14, 2012, 03:16
Default Metis for OpenFOAM 2.1.0
  #1
Senior Member
 
Onno
Join Date: Jan 2012
Location: Germany
Posts: 120
Rep Power: 15
Kaskade is on a distinguished road
Hello,

the official support for metis has been dropped for license issues. Has someone been able to install and use metis on their own? My attempts so far have been fruitless.

Greetings
Kaskade
Kaskade is offline   Reply With Quote

Old   June 5, 2012, 17:17
Default
  #2
Senior Member
 
Robert Sawko
Join Date: Mar 2009
Posts: 117
Rep Power: 22
AlmostSurelyRob will become famous soon enough
Yes, you need to download metis from this site
http://people.sc.fsu.edu/~jburkardt/c_src/metis/metis.html

and GKLib. GKLib was a bit more tricky to find but I have found it for example here:
http://code.google.com/p/graphlabapi...0a9d384317c3bf
You can checkout the whole repository if you have mercurial installed.

Now it's the question of compiling these things. Set up your include paths correctly. For GKLib I had to add
Code:
DMALLOCINC = -I../libmetis/
in the supplied Makefile. libmetis was the position of libmetis.

Metis compiled seamlessly in my case using script although you must add -fPIC to the gcc command.

Finally go to
Code:
$FOAM_SRC/parallel/decompose/metisDecomp
change Make/option file to point to your metis library location and run
Code:
wmake libso
Let me know if you have any problems with that. I can send you the necessary files.


EDIT: ALSO! I removed the -I pointing to the dummy library. I guess that might be important. :-)
JinBiao and mgg like this.

Last edited by AlmostSurelyRob; June 5, 2012 at 17:34.
AlmostSurelyRob is offline   Reply With Quote

Old   June 23, 2012, 05:31
Default
  #3
Senior Member
 
Onno
Join Date: Jan 2012
Location: Germany
Posts: 120
Rep Power: 15
Kaskade is on a distinguished road
Thanks, I'll try it some time. My current case is pretty symmetric, so simple does the trick.
Kaskade is offline   Reply With Quote

Old   April 9, 2013, 06:39
Default
  #4
Member
 
pere
Join Date: Mar 2011
Location: barcelona
Posts: 46
Rep Power: 15
pere is on a distinguished road
Hi everybody,

I'm trying to compile metisDecomp, I'm getting this error while I'm doing wmake libso:

metisDecomp.C: In member function ‘Foam::label Foam::metisDecomp::decompose(const Foam::List<int>&, const Foam::List<int>&, const Foam::scalarField&, Foam::List<int>&)’:
metisDecomp.C:237: error: ‘METIS_WPartGraphRecursive’ was not declared in this scope
metisDecomp.C:254: error: cannot convert ‘int*’ to ‘real_t*’ for argument ‘9’ to ‘int METIS_PartGraphRecursive(idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, real_t*, real_t*, idx_t*, idx_t*, idx_t*)’
metisDecomp.C:275: error: ‘METIS_WPartGraphKway’ was not declared in this scope
metisDecomp.C:292: error: cannot convert ‘int*’ to ‘real_t*’ for argument ‘9’ to ‘int METIS_PartGraphKway(idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, real_t*, real_t*, idx_t*, idx_t*, idx_t*)’
make: *** [Make/linux64GccDPOpt/metisDecomp.o] Error 1

I've linked to libmetis.so.... perhaps any include that is not found?
pere is offline   Reply With Quote

Old   April 9, 2013, 11:20
Default
  #5
Senior Member
 
Onno
Join Date: Jan 2012
Location: Germany
Posts: 120
Rep Power: 15
Kaskade is on a distinguished road
I've compared scotch and metis for some of my old meshes. For some metis was a little faster (decomposing and/or simulation), for some scotch. You are probably wasting more time getting metis to run, than you would ever save by using it.
Kaskade is offline   Reply With Quote

Old   April 9, 2013, 11:40
Default
  #6
Member
 
pere
Join Date: Mar 2011
Location: barcelona
Posts: 46
Rep Power: 15
pere is on a distinguished road
Hi Kaskade,

I'm compiling OpenFoam from the source code so I need the same time to compile it with scotch or metis. Thanks for your reply.
pere is offline   Reply With Quote

Old   April 9, 2013, 16:30
Default
  #7
Member
 
Dan Kokron
Join Date: Dec 2012
Posts: 33
Rep Power: 13
dkokron is on a distinguished road
Mods to get 2.2.x to compile with METIS from parmetis-4.0.2.

Make sure you test the results!!

Code:
git diff src/parallel/decompose/Allwmake
diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake
index 5cea1fb..581b877 100755
--- a/src/parallel/decompose/Allwmake
+++ b/src/parallel/decompose/Allwmake
@@ -62,6 +62,7 @@ else
     echo
 fi
 
+wmake $makeType metisDecomp
 wmake $makeType decompositionMethods
 
 wmake $makeType decompose
Code:
git diff src/parallel/decompose/metisDecomp/Make/options
diff --git a/src/parallel/decompose/metisDecomp/Make/options b/src/parallel/decompose/metisDecomp/Make/options
index a6a0f14..b046053 100644
--- a/src/parallel/decompose/metisDecomp/Make/options
+++ b/src/parallel/decompose/metisDecomp/Make/options
@@ -1,7 +1,6 @@
 EXE_INC = \
-    -I$(WM_THIRD_PARTY_DIR)/metis-5.0pre2/include \
-    -I../../dummyThirdParty/metisDecomp  /* location of dummy metis.h */ \
+    -I/home/dkokron/play/ParMETIS/parmetis-4.0.2/install/include \
     -I../decompositionMethods/lnInclude
 
 LIB_LIBS = \
-    -L$(FOAM_EXT_LIBBIN) -lmetis -lGKlib
+    -L$(FOAM_EXT_LIBBIN) -lmetis
Code:
git diff src/parallel/decompose/metisDecomp/metisDecomp.C
diff --git a/src/parallel/decompose/metisDecomp/metisDecomp.C b/src/parallel/decompose/metisDecomp/metisDecomp.C
index e1614a8..2530e61 100644
--- a/src/parallel/decompose/metisDecomp/metisDecomp.C
+++ b/src/parallel/decompose/metisDecomp/metisDecomp.C
@@ -202,6 +202,7 @@ Foam::label Foam::metisDecomp::decompose
 
     // Vertex weight info
     int wgtFlag = 0;
+    int ncon = 1;
     int* vwgtPtr = NULL;
     int* adjwgtPtr = NULL;
 
@@ -220,18 +221,19 @@ Foam::label Foam::metisDecomp::decompose
     {
         if (processorWeights.size())
         {
-            METIS_WPartGraphRecursive
+            METIS_PartGraphRecursive
             (
                 &numCells,         // num vertices in graph
+                &ncon,             // number of balancing constraints. It should be at least 1.
                 const_cast<List<int>&>(xadj).begin(),   // indexing into adjncy
                 const_cast<List<int>&>(adjncy).begin(), // neighbour info
                 vwgtPtr,           // vertexweights
+                NULL,
                 adjwgtPtr,         // no edgeweights
-                &wgtFlag,
-                &numFlag,
                 &nProcs,
-                processorWeights.begin(),
-                options.begin(),
+                NULL,              // NULL indicates graph should be equally divided among the partitions
+                NULL,              // load imbalance tolerance for each constraint; NULL -> 1.001
+                NULL,              // options array
                 &edgeCut,
                 finalDecomp.begin()
             );
@@ -241,14 +243,16 @@ Foam::label Foam::metisDecomp::decompose
             METIS_PartGraphRecursive
             (
                 &numCells,         // num vertices in graph
+                &ncon,             // number of balancing constraints. It should be at least 1.
                 const_cast<List<int>&>(xadj).begin(),   // indexing into adjncy
                 const_cast<List<int>&>(adjncy).begin(), // neighbour info
                 vwgtPtr,           // vertexweights
+                NULL,
                 adjwgtPtr,         // no edgeweights
-                &wgtFlag,
-                &numFlag,
                 &nProcs,
-                options.begin(),
+                NULL,              // NULL indicates graph should be equally divided among the partitions
+                NULL,              // load imbalance tolerance for each constraint; NULL -> 1.001
+                NULL,              // options array
                 &edgeCut,
                 finalDecomp.begin()
             );
@@ -258,18 +262,19 @@ Foam::label Foam::metisDecomp::decompose
     {
         if (processorWeights.size())
         {
-            METIS_WPartGraphKway
+            METIS_PartGraphKway
             (
                 &numCells,         // num vertices in graph
+                &ncon,             // number of balancing constraints. It should be at least 1.
                 const_cast<List<int>&>(xadj).begin(),   // indexing into adjncy
                 const_cast<List<int>&>(adjncy).begin(), // neighbour info
                 vwgtPtr,           // vertexweights
+                NULL,
                 adjwgtPtr,         // no edgeweights
-                &wgtFlag,
-                &numFlag,
                 &nProcs,
-                processorWeights.begin(),
-                options.begin(),
+                NULL,              // NULL indicates graph should be equally divided among the partitions
+                NULL,              // load imbalance tolerance for each constraint; NULL -> 1.001
+                NULL,              // options array
                 &edgeCut,
                 finalDecomp.begin()
             );
@@ -279,14 +284,16 @@ Foam::label Foam::metisDecomp::decompose
             METIS_PartGraphKway
             (
                 &numCells,         // num vertices in graph
+                &ncon,             // number of balancing constraints. It should be at least 1.
                 const_cast<List<int>&>(xadj).begin(),   // indexing into adjncy
                 const_cast<List<int>&>(adjncy).begin(), // neighbour info
                 vwgtPtr,           // vertexweights
+                NULL,
                 adjwgtPtr,         // no edgeweights
-                &wgtFlag,
-                &numFlag,
                 &nProcs,
-                options.begin(),
+                NULL,              // NULL indicates graph should be equally divided among the partitions
+                NULL,              // load imbalance tolerance for each constraint; NULL -> 1.001
+                NULL,              // options array
                 &edgeCut,
                 finalDecomp.begin()
             );
@@ -328,7 +335,16 @@ Foam::labelList Foam::metisDecomp::decompose
     }
 
     CompactListList<label> cellCells;
-    calcCellCells(mesh, identity(mesh.nCells()), mesh.nCells(), cellCells);
+    calcCellCells
+    (
+        mesh,
+        identity(mesh.nCells()),
+        mesh.nCells(),
+        true,
+        cellCells
+    );
+
+    // DSK replace after switching to 2.2.x calcCellCells(mesh, identity(mesh.nCells()), mesh.nCells(), cellCells);
 
     // Decompose using default weights
     labelList decomp;
@@ -362,7 +378,15 @@ Foam::labelList Foam::metisDecomp::decompose
     //   xadj(celli) : start of information in adjncy for celli
 
     CompactListList<label> cellCells;
-    calcCellCells(mesh, agglom, agglomPoints.size(), cellCells);
+    calcCellCells
+    (
+        mesh,
+        agglom,
+        agglomPoints.size(),
+        true,
+        cellCells
+    );
+    // DSK replace after switching to 2.2.x calcCellCells(mesh, agglom, agglomPoints.size(), cellCells);
 
     // Decompose using default weights
     labelList finalDecomp;
dkokron is offline   Reply With Quote

Old   April 10, 2013, 05:09
Default
  #8
Member
 
pere
Join Date: Mar 2011
Location: barcelona
Posts: 46
Rep Power: 15
pere is on a distinguished road
Thanks I will try it!
pere is offline   Reply With Quote

Old   May 31, 2014, 01:20
Default Hi pere ,did you solve this problem?
  #9
New Member
 
Ruby Qian
Join Date: Aug 2013
Location: Nanjing,Jiangsu,PRC
Posts: 13
Rep Power: 12
ruby_nuaa is on a distinguished road
Quote:
Originally Posted by pere View Post
Hi everybody,

I'm trying to compile metisDecomp, I'm getting this error while I'm doing wmake libso:

metisDecomp.C: In member function ‘Foam::label Foam::metisDecomp::decompose(const Foam::List<int>&, const Foam::List<int>&, const Foam::scalarField&, Foam::List<int>&)’:
metisDecomp.C:237: error: ‘METIS_WPartGraphRecursive’ was not declared in this scope
metisDecomp.C:254: error: cannot convert ‘int*’ to ‘real_t*’ for argument ‘9’ to ‘int METIS_PartGraphRecursive(idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, real_t*, real_t*, idx_t*, idx_t*, idx_t*)’
metisDecomp.C:275: error: ‘METIS_WPartGraphKway’ was not declared in this scope
metisDecomp.C:292: error: cannot convert ‘int*’ to ‘real_t*’ for argument ‘9’ to ‘int METIS_PartGraphKway(idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, idx_t*, real_t*, real_t*, idx_t*, idx_t*, idx_t*)’
make: *** [Make/linux64GccDPOpt/metisDecomp.o] Error 1

I've linked to libmetis.so.... perhaps any include that is not found?
Hi Pere, I have the same issue here. did you solve this?
ruby_nuaa is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
metis decompose OpenFoam 2.0.0 sebastianweiper OpenFOAM Installation 11 December 29, 2020 11:59
How to partition EDGES by using METIS Lupocci Main CFD Forum 0 August 18, 2010 17:43
Problem with Partitioners (METIS) Partition ANSYS Meshing & Geometry 1 January 1, 2010 13:53
Node numbering at interface in MeTiS. mehul FLUENT 0 December 19, 2006 10:22
Node numbering at interface in MeTiS. mehul Main CFD Forum 0 December 19, 2006 10:21


All times are GMT -4. The time now is 00:50.