-
Notifications
You must be signed in to change notification settings - Fork 49
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
Migrate Python tests to pytest #265
Conversation
Hello @lgarrison! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2021-12-02 15:50:15 UTC |
@manodeep the Python 2.7 tests have trouble with importing this module structure. And looking ahead to |
Only just got a chance to take a look - not sure I follow what's going on with the test failure - could it just be a missing We should try to support python 2.7 for at least Corrfunc v2.5, and then drop the py2.7 support from Corrfunc v2.6. Would it work to add a deprecation warning in v2.5? |
We should also test for some values of |
This version tests all ISA for the max number of threads (inferred from cores/affinity), and thread counts from 1 to In addition, this does add one test case with |
Looking at the CI failure, looks like |
Working now, I think! |
Still haven't had time to review - will look in the next 24-48 hours at the latest! |
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 did a quick skim of the code - looks pretty good!
Do we need to figure out a way to reduce the runtime?
…ty for npairs; other code review.
Here's a version that refactors the reference check to use column names where possible! And, most importantly, the On the runtime, I'm considering the fact that the ISA sweep already tests the multi-threaded correctness. So what about reducing the thread sweep to two values: |
weights1=w, weight_type='pair_product', | ||
periodic=periodic, boxsize=boxsize, | ||
output_ravg=True, verbose=True, | ||
isa=isa) |
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.
Whitespace issues here - the second line of parameters should probably align with the opening bracket on the first line (or whatever PEP recommends). Similar alignment are there elsewhere - will you please fix if possible.
(We really need to get a linter into our CI/pre-commit)
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.
Yeah, there's a lot of whitespace issues! I clearly need to upgrade to an editor that will flag PEP8 issues on-the-fly. But I think the codebase is littered with whitespace problems, and it's probably more efficient if we do a big PEP8 linting pass on the entire codebase, rather than playing whack-a-mole each time we open a PR. So I may leave this for now, if that's okay.
Everything looks good to me - I made some minor comments, mostly related to whitespace and (likely) pytests wizardry |
Should I go ahead and reduce the thread test cases as proposed above? |
Ahh yes - that should be a good enough nthreads coverage. And as long as the single thread agrees with a few different multiple-thread, we are probably okay (haven't tested that though) |
Great -- single- & multi-threaded both agree with the known answer, so this is a pretty good test I think. I'll merge this and then create a |
* Fix very minor thread race * Add stripped-down test_periodic_lin * Made the test messages/code more user-friendly * Added more comprehensive tests for linear bins * Had commented out the required INTEGRATION_TESTS * Also need to invoke the CI testing * More info on failed bins, and continue to test all bins * Moved declarations around * Fix AVX2/AVX/SSE linear binning bug in theory * add comparison to reference in call_correlation_functions python calls * Migrate Python tests to pytest (#265) * Migrate Python tests to pytest * Backport fastfood weights * Fix CPU count for OSX * Add deprecation warning for Python < 3 * Try to fix Python 2.7 * Test all ISA with max threads, and all nthreads with fastest ISA * Try again to fix Python 2.7 * Refactor reference check to use column names and exact integer equality for npairs; other code review. * Fixed typo in changelog * Add AVX2 to wp test. Change thread sweep config. Other code review. * Fix tests Co-authored-by: Manodeep Sinha <manodeep@gmail.com> * Add test_lin.py to pytests * Fix bin file precision in linear C tests * Fix nthreads * Don't test linear binning on Python 2.7 * Try to support old Numpy * fixing issue in theta AVX linear binning Co-authored-by: Arnaud De-Mattia <adematti@spppcx147.extra.cea.fr> Co-authored-by: Lehman Garrison <lgarrison@flatironinstitute.org> Co-authored-by: Manodeep Sinha <manodeep@gmail.com>
From #258, we had an OpenMP error that only showed up in the Python tests. Therefore we decided to be a bit more organized about the Python tests, and migrate to pytest. The code is pretty compact, and tests all ISA for all main API functions.
These tests all use the same data and configuration as the C tests, and hence we have the external, correct results to compare against.
Once this gets into master, we can merge/rebase master back into linearbinning. I have a corresponding
test_lin.py
that we can put into linearbinning once that happens.