-
Notifications
You must be signed in to change notification settings - Fork 12
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
Parallelize nwl #122
Parallelize nwl #122
Conversation
diff = np.linalg.norm(pt - fw_pt) | ||
|
||
return diff | ||
|
||
|
||
def find_coords(vmec, wall_s, phi, pt): | ||
def find_coords(data): |
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.
this function takes a tuple so it plays nicely with concurrent.futures.ProcessPoolExecutor
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.
We'll have to get everyone on the same PEP8 autoformatting to stop thrashing between line length and quotation styles :)
I have autopep8 installed, not sure if others would prefer something else. |
I changed to black since autopep8 wasn't being aggressive enough for the way I write code apparently 🙃. It does a better job of enforcing quotations and whitespace (and stops me from putting closing brackets on the line I'm not supposed to). It did require that I manually specify an 80 character line limit, I think it's default is 88. |
To test that this parallelization is working as expected I ran 10000 particles from a surface source using the main branch, and wrote the resulting matrix to file, then did the same but with this branch, using 9 threads. I then loaded the files to compare the values and found that they were identical. Not a very formal test, but I could make a PR adding testing for nwl_utils then once that's good to go this PR would be tested against that? |
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.
Thanks for sticking with this @Edgar-21
04f656f
to
37c4ce9
Compare
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.
LGTM - thanks @Edgar-21
addresses #120