-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
Do not require AVX when building with SAGE_FAT_BINARY #32434
Comments
comment:1
Thanks for opening this ticket. What files need changing? Ran Probably a subset of these files:
|
This comment has been minimized.
This comment has been minimized.
comment:2
Warning: we shouldn't add anything to IMO a better long-term solution is to ensure that all of our SPKGs respect the user's |
comment:3
Would this change in def check_flags(self):
"""
Sanity check the compiler flags used to build the extensions
"""
forbidden = None
if os.environ.get("SAGE_FAT_BINARY") == "yes":
# When building with SAGE_FAT_BINARY=yes, we should not
# enable CPU features which do not exist on every CPU.
# Such flags usually come from other libraries adding the
# flags to the pkgconfig configuration. So if you hit these
# errors, the problem is most likely with some external
# library and not with Sage.
import re
- forbidden = re.compile(r"-march=|-mpcu=|-msse3|-msse4|-mpopcnt|-mavx")
+ forbidden = re.compile(r"-march=|-mpcu=|-msse3|-msse4|-mpopcnt"
+ r"|-mavx|-mavx2|-mbmi2")
if forbidden is not None:
errors = 0
for ext in self.extensions:
flags = ext.extra_compile_args
for flag in flags:
if forbidden.match(flag):
log.error("%s uses forbidden flag '%s'", ext.name, flag)
errors += 1
if errors:
raise RuntimeError("forbidden flags used") |
comment:4
Replying to @slel:
I think it strips those flags when building the sage library (which is the right thing to do in any case), but probably doesn't solve the issue in the original bug report because it's most likely coming from some SPKG and not the sage library itself. OpenBLAS is a prime suspect, since 0.3.13 will use certain machine-specific instructions when no On sage-support, Nathan said that the mac app has to set |
comment:5
bump to 9.6 |
comment:7
I would just like this ticket to get prioritized more highly. It does impact users and is probably easy to fix. That's all. |
comment:8
Won't happen without people who need SAGE_FAT_BINARY doing the work and setting up tests. |
comment:9
It occurs to me that suggestions like use "CFLAGS to -mno-avx -mno-avx2 -mno-bmi2" aren't really in the spirit of "SAGE_FAT_BINARY". They are in the spirit of "make a binary that is very slow but works on a maximum amount of hardware". Maybe we can't have it both ways, but simply disabling AVX, etc. is probably going to result in a much slower Sage binary. |
comment:10
See #32363 "Rename configure option --enable-fat-binary to --enable-portable-binary" |
comment:11
openblas has |
comment:12
Short of compiler/linker support for such a thing, I'd think the best that a binary vendor could do is to make several builds with separate |
comment:13
Said vendor could also throw in a "debug" build while at it. |
comment:14
Replying to @orlitzky:
I can't say anything about that, but I confirm that Samuel's suggestion fixes an at least related issue that I had on the device I described in this sage-devel post (output of
Here my observation:
So, my opinion is that we should do this fix since it is surely an improvement. If it really would not help for the original issue then that could be a follow up ticket (or the other way around). |
Branch: u/soehms/adapt_fat_binary_32434 |
comment:16
According to my previous comment I push a branch containing Samuel's suggestion. New commits:
|
Reviewer: Sebastian Oehms, ... |
Author: Samuel Lelievre |
Commit: |
Changed author from Samuel Lelievre to Samuel Lelièvre |
comment:18
Another affected CPU: see #33671 comment:243 |
Changed reviewer from Sebastian Oehms, ... to Sebastian Oehms, ... |
comment:19
Note that the module that is modified here, Also, even with |
comment:21
FWIW: I made another try on the device I described in comment14 after installing LinuxMint 21 (vanessa) which is build on Ubuntu 22.04 (jammy). I did that on a fresh git clone of Sage 9.8.beta3 merged with the branch of the ticket. On a first step, I wanted to test with Furthermore I tried two binary installations of stable 9.7. Using the docker image Apart from the latter fact it seems that the issue has been fixed for my device. I have no idea what could have caused that: The upgrade of the OS or changes in Sage? |
Setting
CFLAGS to -mno-avx -mno-avx2 -mno-bmi2
should help the produced binaries work on older processors.Move from sagemath/binary-pkg#31
CC: @culler @dimpase @embray @kiwifb @kliem @orlitzky @mkoeppe @slel @kwankyu
Component: build
Author: Samuel Lelièvre
Branch/Commit: u/soehms/adapt_fat_binary_32434 @
3c61bf2
Reviewer: Sebastian Oehms, ...
Issue created by migration from https://trac.sagemath.org/ticket/32434
The text was updated successfully, but these errors were encountered: