Repository navigation
Major performance problem encountered with PyMAPDL #4818
|
Hello, I am experiencing a significant performance issue with PyMAPDL and would like to start this discussion to better understand the origin of the problem. I am using the following code to perform a series of calculations: with mapdl.non_interactive: In this setup, I deliberately do not export any results so that I can measure the pure solve time, without including I/O overhead. For that reason, I use the following OUTRES commands: outres_cmd = r""" Despite this, I still observe a large discrepancy between the computation times in PyMAPDL and in native MAPDL, by a factor of about 3–4. When I analyze the timing, I obtain: Elapsed time for the solve: 398.459 s I also want to emphasize that I am using a user-defined material model in both PyMAPDL and MAPDL, so the overhead associated with the user material should, in principle, be similar in both cases. Could you please help me understand the possible causes of this performance difference? Regards, |
Replies: 2 comments 5 replies
|
Normally PyMAPDL takes a bit more time because of the delays in sending/receiving the commands over the gRPC channel. Having said that, I see no particular reason for this difference in runtime in the code you mention. It will help if you can provide a script with actual code we can test on our side and assess the possible issues. Feel free to attach the code in this discussion. |
|
The performance difference was caused by the overhead of generating output files for each command (/OUT,anstmp) and transferring those files back to PyMAPDL. Although the command itself is short, MAPDL produces a significant amount of console output when solving models that require multiple iterations. This output is written to the To avoid this cost, the mapdl.solve(mute=True)This approach is much faster because only the command itself is sent, while the potentially large solver output is ignored. However, there is an important tradeoff: when Possible improvements:
|


The performance difference was caused by the overhead of generating output files for each command (/OUT,anstmp) and transferring those files back to PyMAPDL.
Although the command itself is short, MAPDL produces a significant amount of console output when solving models that require multiple iterations. This output is written to the
anstmpfile, which can become fairly large. Transferring this file back to PyMAPDL adds enough overhead to noticeably increase the execution time.To avoid this cost, the
/SOLVEoutput can be suppressed:This approach is much faster because only the command itself is sent, while the potentially large solver output is ignored.
However, the…