-
Notifications
You must be signed in to change notification settings - Fork 339
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
ParticleTracker refactor: Bring in particle_integrators.py #953
ParticleTracker refactor: Bring in particle_integrators.py #953
Conversation
|
This pull request has been mentioned on PlasmaPy Community Discourse Forum. There might be relevant details there: |
Codecov Report
@@ Coverage Diff @@
## master #953 +/- ##
==========================================
- Coverage 96.29% 95.89% -0.40%
==========================================
Files 62 63 +1
Lines 5715 5748 +33
==========================================
+ Hits 5503 5512 +9
- Misses 212 236 +24
Continue to review full report at Codecov.
|
This PR would also address a couple of the points raised in issue #936 |
Merging this now would break Python 3.9 support, because that version broke Numba (numba/numba#6345) and we won't get that fixed until RC 2021. For now, it is probably the best call to make Numba optional, so people can still install PlasmaPy on 3.9, and conditionally xfail the test on 3.9, so we can get this PR moving. Does that sound reasonable? |
Could you possibly have a try:
import numba
_range = numba.prange
except ImportError:
warn(
"If running Python < 3.9 consider installing numba. This will allow parallel "
"computing and speed up ParticleTracker"
)
_range = np.arange
def foo(*args):
# use _range for the loops so the function is automatically a numba or
# non-numba version
...
if "numba" in globals:
foo = numba.njit()(foo) Then we might be able to use environment markers so |
It's still a for loop. If we do "optional Numba" here, the performance will suffer greatly over the current implementation. |
I get that. The idea is that, with the environmental markers we can make |
I went without numba for now. I figure we can wait until Q1 2021 and introduce less complexity then. In the meantime, I went with refactoring the numpy version out of the class, and lo and behold, I fixed the ExB drift direction bug. I've got the numba version backed up, but for now, this should be good. |
This pull request has been mentioned on PlasmaPy Community Discourse Forum. There might be relevant details there: |
This reverts commit b8e39c5. I don't know how that happened.
Co-authored-by: Nick Murphy <[email protected]>
As per https://nbsphinx.readthedocs.io/en/0.8.0/version-history.html to remove warnings
This reverts commit df76759.
Should be good to go! |
@namurphy here's the promised reminder :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this refactoring, so thank you! My final suggestions are pretty minor and mostly aren't even necessary. I think it's ready to be merged whenever you're ready to.
Co-authored-by: Nick Murphy <[email protected]>
Co-authored-by: Nick Murphy <[email protected]>
This is to further limit the number of warnings emitted during the doc build.
This is (finally!) a follow-up to the closed #675. It brings in a separated implementation of the Boris algorithm, which I was hoping would solve the issue raised in https://plasmapy.discourse.group/t/e-cross-b-drift/; we're not there yet, but this is a change in the right direction and should be easier to review.
7f20252 is marked [REVERT], but I haven't yet found a way to combine astropy.units with parallel numba, and in my previious tests the parallelization did not bring huge speedups, so it's fine to keep it that way for now.
This separate implementation will also make #895 easier.