Skip to content
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

Karatsuba multiplication of matrices: failed test #33212

Open
GMS103 opened this issue Jan 21, 2022 · 7 comments
Open

Karatsuba multiplication of matrices: failed test #33212

GMS103 opened this issue Jan 21, 2022 · 7 comments

Comments

@GMS103
Copy link
Member

GMS103 commented Jan 21, 2022

This is for SageMath version 9.5.rc3 built on two M1 Macs, one with macOS 11.6.2 (Big Sur) and the other with macOS 12.1 (Monterey).

One test in

src/sage/matrix/matrix_gf2e_dense.pyx

seems to fail consistently, namely

sage: K.<a> = GF(2^n)
sage: A = random_matrix(K, 50, 50)
sage: B = random_matrix(K, 50, 50)
sage: A._multiply_karatsuba(B) == A._multiply_classical(B)

as soon as n > 2.
In fact, A and B appear to be completely different.

I do not know how to deal with this, but I am available to test.

CC: @malb

Component: linear algebra

Issue created by migration from https://trac.sagemath.org/ticket/33212

@GMS103 GMS103 added this to the sage-9.6 milestone Jan 21, 2022
@GMS103

This comment has been minimized.

@malb
Copy link
Member

malb commented Jan 22, 2022

comment:3

Works on my x64 Linux. I assume the underlying reason is that M4RIE relies on some undefined behaviour that works "as expected" on x86-ish architectures? Can you compile M4RIE with all warnings on and then run the tests? Maybe it's already triggered there?

@GMS103
Copy link
Member Author

GMS103 commented Jan 22, 2022

comment:4

I have been able to compile M4RI and M4RIE (the former is needed for the latter).

However, all checks fail for M4RIE.

See

https://bitbucket.org/malb/m4ri/issues/83/trying-to-compile-on-apple-m1

and

https://bitbucket.org/malb/m4rie/issues/23/trying-to-compile-on-apple-m1

HTH

@malb
Copy link
Member

malb commented Jan 24, 2022

comment:5

So it seems to be an issue with M4RIE but not sure how to debug this. I've asked on sage-devel if others can reproduce it (I assume the answer is "yes", but still).

@GMS103
Copy link
Member Author

GMS103 commented Mar 20, 2022

comment:6

M4RIE works correctly on an Apple Silicon M1 Mac under macOS 12.3 (Monterey) with Xcode 13.3 (see https://bitbucket.org/malb/m4rie/issues/23/trying-to-compile-on-apple-m1): the test in this ticket succeeds.

The bad news is that Xcode 13.3 is not available for macOS 11.6.5 (Monterey), the last available version being Xcode 13.2.1, which fails as indicated above.

@malb
Copy link
Member

malb commented Mar 26, 2022

comment:7

Thanks for tracking this down. We can compile with a lower optimisation level on those machines with a buggy compiler?

@GMS103
Copy link
Member Author

GMS103 commented Mar 26, 2022

comment:8

It should be possible, but I do not know how to do it when making SageMath.

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

No branches or pull requests

3 participants