-
Notifications
You must be signed in to change notification settings - Fork 3
Numba tutorial #95
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
Numba tutorial #95
Conversation
|
@mayukh33, I've edited the example slightly. We will want to remove the trajectory file and just have users run it themselves if they want to follow along. The diff on this is massive and the file is quite large 😅 |
That makes sense! I will remove that. Do we want to keep the python initialization script? |
|
We can just give the input data file and the LAMMPS file so that users have the minimum amount needed to generate the data needed to do the tutorial. We'll just push a completed tutorial with all cells executed so those who want to see the results without following along have that option too. |
|
Please also make sure this example shows how to use multiprocessing! |
| if __name__ == '__main__': | ||
| num_workers = max(4, multiprocessing.cpu_count()) | ||
| with multiprocessing.Pool(num_workers) as p: | ||
| num_particles = p.map(process_snapshot, traj) | ||
| print(num_particles) |
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.
Is it necessary for this to be wrapped in the if statement?
Also, suggest to only use 2 processors for the num_workers. It's the minimum needed to have multiprocessing behavior.
Last, can you just import multiprocessing in this example, rather than putting it in the default imports? It may be obvious enough, but someone will need to figure out they need to import this.
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.
The if statetment is necessary since it generates an error otherwise and in the multiprocessing documentation it is implemented the same way.
conftest.py
Outdated
| namespace["multiprocessing"] = multiprocessing | ||
| namespace["Pool"] = multiprocessing.Pool |
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.
See comment above, ideally all these changes would be reverted in this file.
No description provided.