[Gmsh] Multi threading calls to GModel

Christophe Geuzaine cgeuzaine at uliege.be
Fri Dec 8 21:01:48 CET 2017



> On 7 Dec 2017, at 18:41, Pablo Antolin <pablo.antolin at epfl.ch> wrote:
> 
> Hello everybody,
> 
> I am using Gmsh inside my own code, through the API, to mesh a lot of very small geometries that are independent one from the other. My goal is to produce for every geometry the coarsest mesh possible.
> 
> In order to speedup the process, I've tried to create a single GModel for every geometry and to process them in parallel (using openmp). However, due to certain runtime errors I am getting, it seems that either I am doing something wrong in my code or it is not thread-safe to create multiple instances of the GModel class and to work with them in parallel.

GModel is not yet thread-safe. It might be eventually, but it's best for now to use multi-threading *inside* GModel - you can test by enabling OpenMP support and setting e.g. "-nt 8" on the command line. More comprehensive multi-threading support will arrive after we release the first stable API in Gmsh 4.0.

PS : you should probably not use the internal classes directly. Have a look at the new API instead (see gmsh/api and gmsh/demos/api).

> 
> On the other hand, I've seen that Gmsh offers multithreading parallelization.
> My question is: can I benefit from that?
> If different regions (corresponding to different geometries) are meshed in parallel, my code would speedup; if the parallelism is perform inside the mesh process of every region/geometry, probably the code would remain mostly serial.
> 
> After meshing all the geometries, I check them, looking for possible negative jacobians. For the ones that present negative jacobians I either refined them or use the high-order optimization algorithm. But this process is only executed for the geometries presenting negative jacobians.
> 
> So, my second question is: after meshing the first GModel (hopefully in parallel), can I remove or deactivate some of the regions / elements (present in the first GModel) that are already valid (their jacobians are positive everywhere)? Then, I would refine/optimize only the ones that present negative jacobians.
> 
> 
> Thanks for the support.
> Best regards,
> 
> 
> -- 
> 
> Pablo Antolin
> Researcher
> Chair of Numerical Modelling and Simulation 
> Institute of Mathematics
> Ecole polytechnique fédérale de Lausanne
> 
> 
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh


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

Free software: http://gmsh.info | http://getdp.info | http://onelab.info




More information about the gmsh mailing list