Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ENH add aligned numpy allocator #29846

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lorentzenchr
Copy link
Member

@lorentzenchr lorentzenchr commented Sep 14, 2024

Reference Issues/PRs

None

What does this implement/fix? Explain your changes.

This PR adds a numpy allocator for aligned memory in order to evaluate the performance impact (mainly on HGBT).

LightGBM uses aligned allocation, see https://github.com/microsoft/LightGBM/blob/41ba9e8f00c89d72e5cb71c964722ce1ed4d8445/include/LightGBM/utils/common.h#L909.

Numpy allocator C-API, see

Any other comments?

While numpy/numpy#27327 works perfectly fine locally, this PR results in a segmentation fault.

Copy link

github-actions bot commented Sep 14, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 7e828d6. Link to the linter CI: here

@ogrisel
Copy link
Member

ogrisel commented Sep 16, 2024

I recently tried to debug a segfault / bus error that only happened on the CI using an ad-hoc PR with specific instrumentation here: #29628

This PR is a bit specific to macOS but it can probably be adapted to debug segfaults on linux. I wonder if it would be worth the extra maintenance complexity to have something similar enabled by default on our CI.

@ogrisel
Copy link
Member

ogrisel commented Sep 16, 2024

While numpy/numpy#27327 works perfectly fine locally

Do you observe any performance impact?

@lorentzenchr
Copy link
Member Author

lorentzenchr commented Sep 16, 2024

@ogrisel The segfault also occurs for linux, see CI results. (For Windows, this PR needs a slight update with C macros). I need this PR to work in order to test the impact on performance.

@jjerphan
Copy link
Member

Do you need help with debugging?

@lorentzenchr
Copy link
Member Author

Do you need help with debugging?

Yes. I have no clue how to debug that segfault.

But note that I don’t know if it’s worthwhile.

@jjerphan
Copy link
Member

If performance and (not just) memory alignment are of interest, we could try and mention using mimalloc and its dynamic override which eases some usages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants