How to write a parallel computing script for this situation?
Ältere Kommentare anzeigen
I have a program that has been running for more than a week. I have no idea how many additional days it will take. Would anyone please help me write a parallel computing script for it?
It is as simple as this:
z = f(x, y)
The thing is that my x and y have a size of 40 million (row) x 1 (column). Normally, it would be much faster to run them together as column variables, instead of going through them one row at a time.
What would my parfor loop look like?
Many thanks!
4 Kommentare
John D'Errico
am 24 Jul. 2021
There is a strong chance that your code is simply written poorly, that a parallel computing solution is the wrong approach. But that is impossible to know. You would be best served by spending the time to lean to use the profiler tool, to see whereyour code is slow. And to learn ways to improve your code. But this question is not a question about MATLAB, just a bulletin board request, asking for somoen to provide code and general tutoring on how to use a toolbox, without knowing anything about your real problem, or even if it would help.
Walter Roberson
am 17 Mär. 2026 um 18:29
With the information we have been given, we must assume that f depends on all of x and all of y, and that the work cannot be split up by parfor.
If this assumption is wrong, then you need to describe the algorithm in more detail.
Mike Croucher
am 26 Mär. 2026 um 13:30
There is not enough information to give you advice. I would need to see the code to help further.
Antworten (0)
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!