[petsc-dev] slow loading of mesh in dmplex

Stephan Kramer s.kramer at imperial.ac.uk
Fri Jul 29 05:53:12 CDT 2016

Dear petsc devs

After some profiling of the loading of a large gmsh mesh in dmplex 
(which seemed to take forever), I found that it was spending 99% of its 
time in IsGetIndices_Stride in the following calltree

DMPlexCreateGmshFromFile -> DMPlexGetFullJoin -> DMLabelGetStratumBounds 
-> ISGetIndices -> ISGetIndices_Stride

where it seems to work out the bounds of each stratum by explicitly 
computing all indices of a strided index set to then only take its first 
and last entry, and this is done for each facet in the mesh a couple of 

With the attached patch I managed to reduce the load time of a mesh from 
4 hours to 22 seconds! I'm not a 100% sure if the patch is correct in 
all circumstances: I presume the assumption was that the index set is 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dmplex.patch
Type: text/x-patch
Size: 1038 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160729/d8aec1af/attachment.bin>

More information about the petsc-dev mailing list