make setup.py check for AVX support
User description
Check before installing pyopenms that the processor has AVX support rather than throwing eldritch error messages at runtime.
Description
Address https://github.com/OpenMS/OpenMS/issues/7333 by failing at install time if the CPU doesn't support AVX. AVX has been standard for (physical) processors since the early 2010's so this is most likely to affect virtualization envs where changing the VM options solves the issue.
Checklist
- [x] Make sure that you are listed in the AUTHORS file
- [ ] Add relevant changes and new features to the CHANGELOG file
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] New and existing unit tests pass locally with my changes
- [x] Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)
How can I get additional information on failed tests during CI
Click to expand
If your PR is failing you can check out- The details of the action statuses at the end of the PR or the "Checks" tab.
- http://cdash.openms.de/index.php?project=OpenMS and look for your PR. Use the "Show filters" capability on the top right to search for your PR number. If you click in the column that lists the failed tests you will get detailed error messages.
Advanced commands (admins / reviewer only)
Click to expand
/reformat(experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.- setting the label "NoJenkins" will skip tests for this PR on jenkins (saves resources e.g., on edits that do not affect tests)
- commenting with
rebuild jenkinswill retrigger Jenkins-based CI builds
:warning: Note: Once you opened a PR try to minimize the number of pushes to it as every push will trigger CI (automated builds and test) and is rather heavy on our infrastructure (e.g., if several pushes per day are performed).
PR Type
enhancement, dependencies
Description
- Introduced a function
check_avx_supportto verify if the CPU supports the AVX instruction set, preventing runtime errors. - Integrated the AVX support check into the setup process to fail early if the CPU does not support AVX.
- Added 'py-cpuinfo' as a required dependency to facilitate the AVX support check.
Changes walkthrough 📝
| Relevant files | |||
|---|---|---|---|
| Enhancement |
|
💡 PR-Agent usage: Comment
/help "your question"on any pull request to receive relevant information
PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
| ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪ |
| 🧪 No relevant tests |
| 🔒 No security concerns identified |
| ⚡ Recommended focus areas for review Dependency Management Error Handling |
PR Code Suggestions ✨
Explore these optional code suggestions:
| Category | Suggestion | Score |
| Possible bug |
✅ Prevent potential crashes by adding error handling for missing 'flags' key in CPU infoSuggestion Impact:The commit added error handling for the case where the 'flags' key might be missing in the CPU info dictionary, which aligns with the suggestion to prevent potential crashes.code diff:
Add error handling for potential KeyError when accessing 'flags' in the CPU info
Suggestion importance[1-10]: 9Why: Adding error handling for a potential KeyError is crucial to prevent the script from crashing, making this a high-impact suggestion for ensuring robustness and reliability. | 9 |
| Enhancement |
Enhance the CPU feature checks to include AVX2 alongside AVXConsider checking for AVX2 alongside AVX, as AVX2 is a more advanced and commonly
Suggestion importance[1-10]: 8Why: Checking for AVX2 in addition to AVX is a significant enhancement, as AVX2 is a more advanced and commonly used instruction set, ensuring broader compatibility and performance. | 8 |
| Best practice |
✅ Improve error handling by replacing
| 7 |
| Maintainability |
Improve code organization and clarity by importing
| 5 |
do we also need to check for avx2?
I don't think so. The minimum x86-64 microarchitecture level that supports avx also supports avx2 (x86-64-v3).
On Thursday, October 10, 2024, Timo Sachsenberg @.***> wrote:
do we also need to check for avx2?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.< https://ci3.googleusercontent.com/meips/ADKq_NbJTNJM_LaSq_FHVVxc-_L7PAYU5TlKQvKYH0TXh6fXMsNRgqRZVQKZ_9rCBvzRx_V0bofPApBXIlg0ouBmtQWfAqSyYvp90CSm0DLlPnq0C5U9lI2NvKDR17o-752hzJ13eiIaZfYZZ3f3uhwWTsk5EL9HHcMwtA3FFi4qrOcHm585wh2Bav22_EwyTXtACrhs6HEq2Q8NOosk8hH9kVZmh3S7aV8zt2Z1P70KfkEqaq6g85_CVHg=s0-d-e1-ft#https://github.com/notifications/beacon/AABD3CZO63NJ2IL7CTYVNDLZ22BKXA5CNFSM6AAAAABPULAEMKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUPLPSJW.gif>Message ID: @.***>
Good idea but let's try with a complete wheel on someone else's computer before merging.
Getting this to work consistantly across platforms looks like it's going to require moving the pyopenms building to a pyproject.toml which is out of scope for this specific issue I've opened an issue on this https://github.com/OpenMS/OpenMS/issues/7675 and am closing this PR