Cusom reaction function takes a long time

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Cusom reaction function takes a long time

Submitted Questions
For my project, actually I coupled a complicated reaction function to Featool, and it will take long time for calculating reaction rates at every point.

Could you please let me know if the FEAtool parallel function can also speed up the external functions that are coupled to FEATool? That is, the reaction rates at every point can be calculated simultaneously in the new version and these rates have to be calculated sequentially in the previous version?

Actually I tried running this external function in parallel, but there are too many parameters involved which caused data racing. If you new version can support the external functions in parallel, that will be great, and then it will give me a strong motivation to run FEATool in clusters to significantly save time. Now the major bottleneck for running FEATool in our project is the time. After coupling our reaction rate function to Featool, it will take 2 days for one simulation. However, if we just use a simple reaction formula that can be run directly in FEAtool, it will only take several minutes.

Reply | Threaded
Open this post in threaded view
|

Re: Cusom reaction function takes a long time

Precise Simulation
Administrator
Submitted Questions wrote
Could you please let me know if the FEAtool parallel function can also speed up the external functions that are coupled to FEATool? That is, the reaction rates at every point can be calculated simultaneously in the new version and these rates have to be calculated sequentially in the previous version?
Unfortunately the new parallel functionality in FEATool v1.14 only applies to the external solvers FEniCS, OpenFOAM, and SU2. MATLAB and the built-in solver is unfortunately designed in a "old style" blocking single threaded design so is very difficult to parallelize.

It sounds like your custom function takes a long time to compute in which case it might be possible to speed up. I would recommend to use the "profile" functionality to check exactly what takes time and prioritize optimizing that first:

https://www.mathworks.com/help/matlab/ref/profile.html

Moreover, depending on how your custom function looks like you might be able to cache some parts of the computations using the "persistent" functionality:

https://www.mathworks.com/help/matlab/ref/persistent.html

That said, if you are doing several parametric runs you can also run many simulations in parallel using the techniques described here:

https://www.featool.com/tutorial/2017/06/07/running-parallel-matlab-fem-and-multiphysics-simulations
Reply | Threaded
Open this post in threaded view
|

Re: Cusom reaction function takes a long time

randress
Precise Simulation wrote
That said, if you are doing several parametric runs you can also run many simulations in parallel using the techniques described here:
https://www.featool.com/tutorial/2017/06/07/running-parallel-matlab-fem-and-multiphysics-simulations
Wow! Thanks for including this in the discussion.  Another thing that I have missed.  

I have done some parametric runs using the "for loop" method, but now I am looking forward to installing WSL (not sure whether or not 1 or 2 would be best but looks like you can switch back and forth) and Ubuntu and making use of the additional cores on my new system.

Kind regards,
Randal