How to parallelise numerical integration (ode45)?
显示 更早的评论
I would like to apply ode45 to a matrix with 2 lines and 10000 rows. In the matrix each row contains two elements which are the initial values of two coupled equations and there are 10000 pairs of different initial values for 10000 independent numerical calculations. At this moment I can only use loops to execute ode45 for 10000 times, which is really slow. Anybody can tell me how to cleverly parallelise this process? Many thanks in advance!
回答(1 个)
Jan
2017-3-24
1 个投票
Start with optimizing the code. If e.g. the function to be integrated contains discontinuities or a lot of expensive functions to calculate constants, it is the best strategy, to improve this.
Do you have the parallel processing toolbox? Then use a PARFOR to start the integration on multiple cores. Alternatively you can start several Matlab sessions and process only parts of the 10'000 pairs of initial values. See also:
- https://www.mathworks.com/matlabcentral/fileexchange/50797-jpar-parallelizing-matlab-calculations-on-multicores-and-in-clusters-without-file-communication
- https://www.mathworks.com/matlabcentral/fileexchange/44077-batch-job
- https://www.mathworks.com/matlabcentral/fileexchange/13775-multicore-parallel-processing-on-multiple-cores
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!