[Gmsh] Optimising binary .msh format

Christophe Geuzaine cgeuzaine at ulg.ac.be
Thu May 7 23:00:15 CEST 2015


> On 07 May 2015, at 13:02, Michael Lange <michael.lange at imperial.ac.uk> wrote:
> 
> Hi,
> 
> I am trying to optimise the performance of the current file reader for binary .msh files in PETSc by utilising the element grouping described in the binary format (see http://www.geuz.org/gmsh/doc/texinfo/#MSH-binary-file-format). However, using a recent version of Gmsh (version 2.9.3, with options: -3 -bin), the generated .msh files contain a header + binary entry pair for each element in the mesh, instead of two groups of same-type elements (volume and surface). This unfortunately prevents me from using efficient bulk reads to speed up file I/O and hinders performance when reading large meshes on certain HPC architectures.
> 
> Is there any way to enable this type of element grouping in the binary mesh file generation? Am I missing an option by any chance, or does this require significant code changes?

Hi Michael - Indeed, the .msh format is designed for better performance by dumping groups of elements, but the current implementation in Gmsh outputs elements one at a time. Have you tried the .med (HDF5-based) format? The current implementation is pretty fast:

> time gmsh 6millionTets_binary.msh -
Info    : Running 'gmsh 6millionTets_binary.msh -' [Gmsh 2.9.4, 1 node, max. 1 thread]
Info    : Started on Thu May  7 22:58:24 2015
Info    : Reading '6millionTets_binary.msh'...
Info    : Mesh is in binary format
Info    : 1030301 vertices
Info    : Vertex numbering is dense                              
Info    : 6121200 elements
Info    : Done reading '6millionTets_binary.msh'                    
Info    : Stopped on Thu May  7 22:58:29 2015

real	0m5.844s
user	0m5.566s
sys	0m0.272s


> time gmsh 6millionTets_binary.med -
Info    : Running 'gmsh 6millionTets_binary.med -' [Gmsh 2.9.4, 1 node, max. 1 thread]
Info    : Started on Thu May  7 22:58:33 2015
Info    : Reading '6millionTets_binary.med'...
Info    : Reading MED file V3.0.6 using MED library V3.0.6
Info    : Reading 3-D unstructured mesh <<6millionTets_binary>>
Info    : Done reading '6millionTets_binary.med'
Info    : Stopped on Thu May  7 22:58:37 2015

real	0m3.474s
user	0m3.170s
sys	0m0.301s






> 
> Thanks,
> 
> Michael Lange
> 
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh

-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine