Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gmsh gmsh
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 304
    • Issues 304
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gmsh
  • gmshgmsh
  • Issues
  • #1436
Closed
Open
Created Jun 25, 2021 by Jonathan Clayton@jrc6069

multi threading on python

when I run a file in Gmsh's GUI I can use all 16 treads available to me from my CPU and the run time for a certain large step file to be meshed with a 2D mesh is 49.25s but when I run the same file using python i can only use one thread and my CPU time is 756.22s. attached below is my python file.

import gmsh
import sys
import threading

gmsh.initialize()
gmsh.option.setNumber("General.NumThreads",16)# for parallel 3D meshing

gmsh.model.occ.synchronize()
print("nt:", gmsh.option.getNumber("General.NumThreads"))
gmsh.model.mesh.MshFileVersion=2.2
gmsh.model.add("test.msh")

#file='test.step'
print("importing geometry")
v = gmsh.model.occ.importShapes(file, format="step")
gmsh.model.occ.synchronize()

gmsh.option.setNumber("Mesh.MeshSizeMin", mmin)
gmsh.option.setNumber("Mesh.MeshSizeMax", mmax)
print("meshing")
gmsh.model.occ.synchronize()

gmsh.model.mesh.generate(2)
print("save file")
gmsh.write("ballpass_mesh.msh2")
print("done")
# Launch the GUI to see the results:
if '-nopopup' not in sys.argv:
    gmsh.fltk.run()

gmsh.finalize()

the code just imports a step file as defined by the user and creates a 2D mesh based on the min and max edge lengths also defined by the user. This mesh is then output as a msh (version 2) file to be read by a MATLAB function later.

Edited Jun 27, 2021 by Christophe Geuzaine
Assignee
Assign to
Time tracking