How to parallelise numerical integration (ode45)?
Show older comments
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!
Answers (1)
Jan
on 24 Mar 2017
1 vote
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
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!