Parallel computation Pyansys

squaegeb
squaegeb Member Posts: 7
Name Dropper First Comment
**

Dear all,

I am trying to perform multiple independant static computation in PyAnsys.
So far i use 2 python "for loop" inside which I launch a static analysis.
Such procedure is quite long and not optimal (not parallel computation is done).
Is there a optimal solution?
So far I thought of launching the static procedure before the "for loop" of python. Do you know if it speeds up the process ?
Is using mapdl.run(*do) more efficient ?

Best regards,

Tagged:

Comments

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 295
    25 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    Is this what you are looking for?:
    https://mapdl.docs.pyansys.com/version/0.68/api/_autosummary/ansys.mapdl.core.pool.MapdlPool.html

    If not, could you please give me details about what product(s) you are running and which PyAnsys module(s) you are using?

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 342
    25 Answers 100 Comments 25 Likes First Anniversary
    ✭✭✭✭

    I think you may also want asynchronous threading. You can google resources on the python threading module that can allow you to setup a thread and execute it asynchronously such that you can start an APDL solve but not lock up Python until it is done.
    This is general python info and not isolated to PyAnsys or MAPDL. It can be used for anything you want to run on concurrent asynchronous threads.

  • squaegeb
    squaegeb Member Posts: 7
    Name Dropper First Comment
    **

    Thank you for your answers and I apologize for my late reply. Mapdl pool seems to be a good idea (as well as the python threading).
    I am still facing difficulties though.

    My function is a pyansys static analysis with prescribed displacement.
    The displacement varies--> I have saved a text file with indices: displ_id (displ_1, disp_2, etc).
    Therfore my function looks like
    function(mapdl,id)

    It thus reads my text files (with command *DIM and *TREAD) and then solve the static analysis.

    Launching it without mapdl.pool works
    But if i use mapdl.pool, an error occurs
    "*TREAD cannot open file disp_X"

    Is it possible that the *TREAD command is not compatible with mapdl.pool?
    If so is there a way to circumvent this problem?

    Best

  • squaegeb
    squaegeb Member Posts: 7
    Name Dropper First Comment
    **

    @Landon Mitchell Kanner said:
    Is this what you are looking for?:
    https://mapdl.docs.pyansys.com/version/0.68/api/_autosummary/ansys.mapdl.core.pool.MapdlPool.html

    If not, could you please give me details about what product(s) you are running and which PyAnsys module(s) you are using?

    Thank you for your answers and I apologize for my late reply. Mapdl pool seems to be a good idea (as well as the python threading).
    I am still facing difficulties though.

    My function is a pyansys static analysis with prescribed displacement.
    The displacement varies--> I have saved a text file with indices: displ_id (displ_1, disp_2, etc).
    Therfore my function looks like
    function(mapdl,id)

    It thus reads my text files (with command *DIM and *TREAD) and then solve the static analysis.

    Launching it without mapdl.pool works
    But if i use mapdl.pool, an error occurs
    "*TREAD cannot open file disp_X"

    Is it possible that the *TREAD command is not compatible with mapdl.pool?
    If so is there a way to circumvent this problem?