Skip to Content.
Sympa Menu

charm - [charm] Charm 6.7.1 MetisLB bug

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

[charm] Charm 6.7.1 MetisLB bug


Chronological Thread 
  • From: Nels John Frazier <nfrazie1 AT uwyo.edu>
  • To: "charm AT cs.illinois.edu" <charm AT cs.illinois.edu>
  • Subject: [charm] Charm 6.7.1 MetisLB bug
  • Date: Mon, 5 Dec 2016 21:11:52 +0000
  • Accept-language: en-US
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:99

Hi,


I was recently compiling charm++ 6.7.1 with Metis on a new machine, and ran across a bug in the MetisLB.C and and TeamLB.C and TeamLB.h files.

It appears that Metis type defs all arguments to its functions as idx_t, which in the Metis library I have is a 64 bit int, but the charm code declares some of its variables as simply int and then passes these pointers to the function.  The gcc compiler (4.8) won't compile, because it cannot convert an int* to a long int *.


Attached is a patch to correctly define the types needed by the Metis functions using the Metis idx_t type def.


Nels Frazier

diff -ruN charm-6.7.1/src/ck-ldb/MetisLB.C charm_patched/src/ck-ldb/MetisLB.C
--- charm-6.7.1/src/ck-ldb/MetisLB.C	2016-04-19 21:33:56.000000000 -0600
+++ charm_patched/src/ck-ldb/MetisLB.C	2016-11-30 14:12:35.638645824 -0700
@@ -34,7 +34,7 @@
   }
 
   // convert ObjGraph to the adjacency structure
-  int numVertices = ogr->vertices.size();	// number of vertices
+  idx_t numVertices = ogr->vertices.size();	// number of vertices
   int numEdges = 0;				// number of edges
 
   double maxLoad = 0.0;
diff -ruN charm-6.7.1/src/ck-ldb/TeamLB.C charm_patched/src/ck-ldb/TeamLB.C
--- charm-6.7.1/src/ck-ldb/TeamLB.C	2016-04-19 21:33:56.000000000 -0600
+++ charm_patched/src/ck-ldb/TeamLB.C	2016-11-30 14:20:18.390666907 -0700
@@ -54,7 +54,7 @@
   }
 
   // convert ObjGraph to the adjacency structure
-  int numVertices = ogr->vertices.size();       // number of vertices
+  idx_t numVertices = ogr->vertices.size();       // number of vertices
   int numEdges = 0;                             // number of edges
 
   double maxLoad = 0.0;
@@ -124,7 +124,7 @@
   METIS_PartGraphRecursive(&numVertices, &ncon, xadj, adjncy, vwgt, vsize,
       adjwgt, &numberTeams, tpwgts, ubvec, options, &edgecut, pemap);
 
-  int *global_pemap = new int[numVertices];
+  idx_t *global_pemap = new idx_t[numVertices];
 
   // partitioning each team
   if(teamSize > 1) {
@@ -136,13 +136,13 @@
     idx_t *team_vsize = NULL;
     real_t *team_tpwgts = NULL;
 
-    int teamEdgecut, node;
+    idx_t teamEdgecut, node;
     int *mapping = new int[numVertices];
     int *invMapping = new int[numVertices];
 
     // traversing the list of teams and load balancing each one
     for(i=0; i<numberTeams; i++) {
-      int teamMembers = 0;	// number of vertices in a team
+      idx_t teamMembers = 0;	// number of vertices in a team
 
       // collecting all the elements of a particular team
       // mapping stores the association of local to global index
diff -ruN charm-6.7.1/src/ck-ldb/TeamLB.h charm_patched/src/ck-ldb/TeamLB.h
--- charm-6.7.1/src/ck-ldb/TeamLB.h	2016-04-19 21:33:56.000000000 -0600
+++ charm_patched/src/ck-ldb/TeamLB.h	2016-11-30 14:16:49.830657405 -0700
@@ -8,6 +8,7 @@
 
 #include "CentralLB.h"
 #include "TeamLB.decl.h"
+#include <metis.h>
 
 void CreateTeamLB();
 BaseLB * AllocateTeamLB();
@@ -21,8 +22,8 @@
     void pup(PUP::er &p) {  }
 
   private:
-    int teamSize;
-    int numberTeams;
+    idx_t teamSize;
+    idx_t numberTeams;
 
     bool QueryBalanceNow(int step) { return true; }
 };



Archive powered by MHonArc 2.6.19.

Top of Page