Multiprocessing doesn't really parallelize the process. #155
Replies: 1 comment
-
You should question whether the "serialized" run you hint at actually only uses one CPU core. You can't sensibly measure "speed-up" unless you control that factor.
Now, to what extent that is true, I don't know. Maybe it should say that "the speed-up would not necessarily scale linearly with the number of cores". It really depends on your model. If Comsol's internal parallelization strategy works perfectly (i.e., scales linearly with the number of cores) for your model, then you'd just break even. But that's your use case, not everyone else's. Which is why this section of the "demonstration" chapter exists. It's also why I converted this "issue" to a "discussion", as it's not an "issue with the software" (MPh). You use multi-processing if it works for you. You have that option. It's a Python thing. MPh does not do multi-processing for you. Nor does it make any promises as to its effectiveness. If you already see "perfect speed-up" for your model, using one Comsol client only (across however many available cores), then multi-processing cannot possibly help. It will still "parallelize the process", so to speak, but only parallelize what's already been parallelized. |
Beta Was this translation helpful? Give feedback.
-
I am trying to use Python multiprocessing to parallelized the 8 comsol run simultaneously. I followed the exact instruction from the document page, however the time needed to finish case is almost 8 x single run, which is the similar time as serialized runs. Any thought?
Beta Was this translation helpful? Give feedback.
All reactions