Parallelization in MAPDL #623
Replies: 1 comment
-
Solution isn't to use multiprocessing. MAPDL is limited by the fact that the head process is single threaded, so any preprocessing commands will be run sequentially. Running two processes in parallel will potentially result in garbled output. Same with post-processing. The trick here is to use Examplefrom ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl()
def klines():
mapdl.clear()
mapdl.prep7()
for i in range(1, 500):
mapdl.k('', i, 0, 0)
def klines_non_interactive():
with mapdl.non_interactive:
mapdl.clear()
mapdl.prep7()
for i in range(1, 501):
mapdl.k('', i, 0, 0) Timings>>> timeit klines()
207 ms ± 4.05 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
>>> timeit klines_non_interactive()
52.9 ms ± 81.2 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) Additional thoughtsI'd really prefer to have a lower level interface to the keypoints so we could just pass a large batch of them as an array. I doubt that's a feature we're going to focus on, but if enough users are still using PREP7 commands within MAPDL, we can shift focus to that. |
Beta Was this translation helpful? Give feedback.
-
Posting an email received:
Beta Was this translation helpful? Give feedback.
All reactions