-
Notifications
You must be signed in to change notification settings - Fork 306
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
Implement parallel processing for charged_particle_radiography.Tracker
#1728
Comments
Do you think dask would be a suitable tool for this? |
@MKastek also mentioned |
@namurphy I have little experience with either, but this is a simple parallelization problem so I'm sure many libraries could work. I've used multiprocessing recently, so I know that could work. |
I'll give this a try I think dask would be the superior option since it allows both local and distributed computation with a high level API |
@JaydenR2305 great, thanks for taking a look at it! As you do, keep in mind also issue #1725: whatever parallel solution we will also eventually want to extend to working with multiple grids. Something to think about when choosing an implementation. |
Hello, I've been looking into this issue, and I would like to give it a try as my first contribution. |
@Sobeskes — awesome! @JaydenR2305 — were you still planning to work on this? Many thanks! |
@Sobeskes awesome! Let me know if I can be of assistance. I believe @JaydenR2305 is working on some other projects right now, so you're welcome to take a crack at this if you'd like. Note that there are currently a few other PRs working on this code: #1274 Is almost complete and won't change the Tracker class, although we are moving some code around the package so the location of that function will change #1799 builds on Main and is almost complete #1802 builds on #1799 and will requires more work + a full review before it will be done. This PR does make some improvements to some of the internal workings of Tracker, as well as adding new functionality. I would recommend playing with the parallelization on a fork of #1802: that way you're building on the upgrades to Tracker that I've put in there. |
Hm, this issue has been harder to tackle than I thought! I made a few implementations using different parallelization libraries (threading, concurrent.futures, etc) and was unable to manage to get anything that performed better than the serial implementation. The serial implementation ran the test suite ran in around 30 seconds, but the best performing parallelized implementation I created using the concurrent.futures library took around 70 seconds to run. It might be that the overhead associated with creating different threads is too high, or that I'm not understanding the problem correctly. It seems like the most potential for parallelization occurs with the interpolation of Ex, Bx, etc. |
@Sobeskes interesting - at what level are you parallelizing? I would suggest cutting the list of particles into sub-lists (one per core) at the very beginning and then running them entirely separately on different cores from then on, only recombining in the detector plane. I intentionally chose the test problems to be |
I would definitely recommend trying this with |
Particle tracing in the
charged_particle_radiography.Tracker
class is an embarrassingly parallelizable problem , but the calculations are currently being performed in serial. Execution time is limited by processing the interpolation steps. Implementing parallel processing using the multiprocessing library should allow a ~3-4x speed increase in tracing on laptops and very large increases on computing resources with more cores. This would significantly improve the module and make it feasible to run large batches of simulations for things like training machine learning algorithms.Only the push step of the algorithm needs to be parallelized. The code should probably split particles into groups (#/ processing core) and then push them in parallel, stopping each process independently when the particles have left the grid(s).
There are a few challenges to doing this:
_push
andrun
methods will need to be modified.Note that improvements made here would be easily incorporated into the more general ParticleTracker framework (see #936 and #1096 )
The text was updated successfully, but these errors were encountered: