8000 BUG: Ugly fix for Apple's cblas_sgemv segfault by sturlamolden · Pull Request #5223 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Ugly fix for Apple's cblas_sgemv segfault #5223

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

Merged
merged 1 commit into from
Oct 26, 2014
Merged

BUG: Ugly fix for Apple's cblas_sgemv segfault #5223

merged 1 commit into from
Oct 26, 2014

Conversation

sturlamolden
Copy link
Contributor

SGEMV in Accelerate framework will segfault on MacOS X version 10.9
(aka Mavericks) if arrays are not aligned to 32 byte boundaries
and the CPU supports AVX instructions. This can produce segfaults
in numpy.dot if we use numpy.float32 as dtype. This patch overshadows
the symbols cblas_sgemv, sgemv_ and sgemv exported by Accelerate
to produce the correct behavior. The MacOS X version and CPU specs
are checked on module import. If Mavericks and AVX are detected
the call to SGEMV is emulated with a call to SGEMM if the arrays
are not 32 byte aligned. If the exported symbols cannot be
overshadowed on module import, a fatal error is produced and the
process aborts. All the fixes are in a self-contained C file
and do not alter the _dotblas C code. The patch is not applied
unless NumPy is configured to link with Apple's Accelerate
framework.

@sturlamolden
Copy link
Contributor Author

Refering to previous Issue and PR:
#4007
#5205

SGEMV in Accelerate framework will segfault on MacOS X version 10.9
(aka Mavericks) if arrays are not aligned to 32 byte boundaries
and the CPU supports AVX instructions. This can produce segfaults
in numpy.dot if we use numpy.float32 as dtype. This patch overshadows
the symbols cblas_sgemv, sgemv_ and sgemv exported by Accelerate
to produce the correct behavior. The MacOS X version and CPU specs
are checked on module import. If Mavericks and AVX are detected
the call to SGEMV is emulated with a call to SGEMM if the arrays
are not 32 byte aligned. If the exported symbols cannot be
overshadowed on module import, a fatal error is produced and the
process aborts. All the fixes are in a self-contained C file
and do not alter the _dotblas C code. The patch is not applied
unless NumPy is configured to link with Apple's Accelerate
framework.
@sturlamolden
Copy link
Contributor Author

Ping @charris @juliantaylor @njsmith just to make sure you see this.

@charris
Copy link
Member
charris commented Oct 24, 2014

I'm listening ;) This is for Julian now.

@charris
Copy link
Member
charris commented Oct 26, 2014

@juliantaylor Are you going to put this in?

@juliantaylor
Copy link
Contributor

alright

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

Successfully merging this pull request may close these issues.

3 participants
0