-
Notifications
You must be signed in to change notification settings - Fork 19
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
224 add openmp acceleration #225
Conversation
…e specifically function interateGrid3D_omp() in Grid.h)
…in ProbeParticle.cpp and relaxedScan3D_omp() in HighLevel.py )
@ProkopHapala please merge the main branch into the current one, to make sure the tests are passing. Also, please enable the pre-commit. |
I' tried, but not sure what is going on, why all tests are skipped?
|
When a PR is merged we say "The current branch is merged into the main branch". To get the current branch up-to-date with $ git checkout 224-add-openmp-acceleration
$ git merge main This is what I meant.
What you did is fine, but this only works for the files that were modified in the current commit. As far as I can see your current commit has no changes. The way to apply pre-commit at this point is to run it for the whole repository: $ pre-commit run --all-files And then commit the updates files. |
OK, I did. It is doing this horrible thing. Can we prevent it? (adding lines in between definition of ctypes binding of function and its arguments)
|
As far as I can tell the ways to prevent things are still the same:
In that particular case, the best thing IMO is to move everything inside the python function: def getSlaterDensity(Rs, cRAs):
# void getSlaterDensity( int natoms_, double * Ratoms_, double * cRAs ){
lib.getSlaterDensity.argtypes = [c_int, array2d, array2d]
lib.getSlaterDensity.restype = None
natom = len(Rs)
lib.getSlaterDensity(natom, Rs, cRAs) |
ad
|
@ProkopHapala The fix is on the main branch. If you merge the main branch into this branch, the tests should pass. @yakutovicha was mentioning about this above:
|
…3d in relaxedScan3D_omp was not implemented)
Yes, I did it. Still the tests are failing for some reason (which seems unrelated to my changes in this branch) |
I don't see the fix on this branch. This line is still the old one: ppafm/.github/workflows/ci.yml Line 24 in 916f3af
whereas on the main branch it's this: ppafm/.github/workflows/ci.yml Line 24 in 9f009ae
Try the merge again. Maybe you just forgot to push. |
Or maybe you have an old version of the main branch. I think you need to first checkout and pull the main branch before merging it to this branch. |
yeh, I think this was the problem |
Now it works fine. Thanks @NikoOinonen Before we merge it with main branch it would be good to have some option to switch off the OpenMP.
in HighLevel.py |
I went ahead and fixed it to work also on Windows. |
Is this necessary? As far as I can tell, you can control the number of threads with the |
perhaps it is not necessary. I'm just not completely sure if
|
Another thing: when using OpenMP paralelization, even on CPU the most time-consuming part become
|
At least on my systems, I did not have to install anything extra, but it could be that I have it from some previously installed software. At least for compilation, it's only required for developers, so I would not worry. But maybe the there is some runtime library that is also required on the system? Is it possible to just check at runtime and then fall back on the non-OMP implementation if it's not available?
.npy is good for speed, but not for visualizing the intermediate results, which could be more important as the default. We have the OpenCL anyways for those who really care about speed.
Could this be also parallelized? IO should not be a bottleneck. |
@ProkopHapala - Please add the documentation to wiki, then it is free to go from my point of view. |
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.
@ProkopHapala The code is good, just make sure to add the documentation as well when you merge.
OK, I did Here |
for more information, see https://pre-commit.ci
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #225 +/- ##
==========================================
- Coverage 46.93% 46.46% -0.48%
==========================================
Files 35 35
Lines 5147 5178 +31
==========================================
- Hits 2416 2406 -10
- Misses 2731 2772 +41
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
forgot to comment old non-OpenMP relaxedScan3D() call
for more information, see https://pre-commit.ci
I have went through the Wiki text, and added a sentence about setting the number of cores. |
@yakutovicha What does this mean ? Some checks were not successful |
Literally what it says - you added a few lines that are not executed during tests, so the coverage has decreased in comparison to the |
You can go ahead and merge the PR. We will later configure |
I guess I've just set the threshold to 2%, @ProkopHapala could you try to push something small here? Hopefully, this should pass now. |
It's passing on the main branch so should be fine now. |
Closes #224
-fopenmp
in makefile and#include <omp.h>
does not couase some problems on other platforms ?