-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parallel performance #4
Comments
I have been looking at the parallel logic because I wanted to output the particles that go in and out of each myocyte. I have managed to obtain it but it was rather complicated to collect the data from all walkers. I wanted to modify the number of particles going in and out directly to the object handle class... but I found out that handle classes do not get the changes back to the client after the loop (Use Objects and Handles in parfor-Loops). I have been looking different answers and this one might be useful in the future (if it turns out that remapping is expensive)... I ended up remapping the output similarly to what is done but I will have another try when I have more time |
I would stay away from modifying the input objects just to sneak some additional outputs into them - instead, if you absolutely need time-history data (I'd also recommend against that, though) you can just create an additional output parameter. Since the remapping is far from elegant in its current state, I would actually say that outputs should be stored in a structures_out = repmat(template_struct, [1, number_of_walkers]);
parfor i = 1:number_of_walkers
structures_out(i) = execute(structures_in(i));
end Collecting data is then as easy as |
If I recall correctly, a significant time is spent remapping the output of the parallel computation. This should be profiled to see if it's worth refactoring.
There is also a warning inside the parfor loop regarding
func
. This can be mitigated by introducing an anonymous functionfn = @(i) func(i, varargin{:});
before the loop, but I'm not sure if this is the right way to go...The text was updated successfully, but these errors were encountered: