GithubHelp home page GithubHelp logo

Comments (2)

ninnghazad avatar ninnghazad commented on June 14, 2024
some diff
diff --git a/anuga/parallel/distribute_mesh.py b/anuga/parallel/distribute_mesh.py
index 88497575..29a5b1bb 100644
--- a/anuga/parallel/distribute_mesh.py
+++ b/anuga/parallel/distribute_mesh.py
@@ -122,7 +122,9 @@ def reorder_new(quantities, epart_order, proc_sum):
 #path.append('..' + sep + 'pymetis')
 
 try:
-    from anuga.pymetis.metis_ext import partMeshNodal
+#    from anuga.pymetis.metis_ext import partMeshNodal
+    import pymetis
+    from sets import Set
 except ImportError:
     print "***************************************************"
     print "         Metis is probably not compiled."
@@ -160,26 +162,34 @@ def pmesh_divide_metis_helper(domain, n_procs):
     
     n_tri = len(domain.triangles)
     if n_procs != 1: #Because metis chokes on it...
-        n_vert = domain.get_number_of_nodes()
-        t_list = domain.triangles.copy()
-        t_list = num.reshape(t_list, (-1,))
-    
-        # The 1 here is for triangular mesh elements.
-        # FIXME: Should update to Metis 5
-        edgecut, epart, npart = partMeshNodal(n_tri, n_vert, t_list, 1, n_procs)
-        # print edgecut
-        # print npart
-        #print epart
-        del edgecut
-        del npart
+    #    n_vert = domain.get_number_of_nodes()
+    #    t_list2 = domain.triangles.copy()
+    #    t_list = num.reshape(t_list2, (-1,))
+
+       # build adjacency list
+       # neighbours uses negative integer-indices to denote boudary edges.
+       # pymetis totally cant handle that, so we have to delete these.
+       neigh = domain.neighbours.tolist()
+       for i in xrange(len(neigh)):
+               if neigh[i][2] < 0:
+                       del neigh[i][2]
+               if neigh[i][1] < 0:
+                       del neigh[i][1]
+               if neigh[i][0] < 0:
+                       del neigh[i][0]
+
+       cutcount,partvert = pymetis.part_graph(n_procs,neigh)
+
+       #print "cutcount: ",cutcount
+       #print "partvert: ",len(partvert)
+       epart = partvert
 
         # Sometimes (usu. on x86_64), partMeshNodal returns an array of zero
         # dimensional arrays. Correct this.
+        # TODO: Not sure if this can still happen with metis 5
         if type(epart[0]) == num.ndarray:
             epart_new = num.zeros(len(epart), num.int)
             epart_new[:] = epart[:][0]
-#            for i in xrange(len(epart)):
-#                epart_new[i] = epart[i][0]
             epart = epart_new
             del epart_new

so this seems to work for me. using latest pymetis from python2.7's pip. just builds adjacency lists from domain-data and feeds that to pymetis. did a few meshes and worked even with ~120mio triangles. whereas old pymetis would crumble somewhere between 50mio and 60mio. per-cpu-blobs look ok when visually checking.

from anuga_core.

ninnghazad avatar ninnghazad commented on June 14, 2024

See #153

from anuga_core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.