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

check_11 "SumsOfSquares" fails on i386 #1579

Open
d-torrance opened this issue Nov 4, 2020 · 6 comments
Open

check_11 "SumsOfSquares" fails on i386 #1579

d-torrance opened this issue Nov 4, 2020 · 6 comments
Labels
build issue platform specific issues involving compiling M2, generating examples, or running tests

Comments

@d-torrance
Copy link
Member

On a build of the master branch on a Debian unstable i386 chroot:

i2 : check_11 "SumsOfSquares"
-* running test 11 of package SumsOfSquares in file:
   ../../Macaulay2/packages/SumsOfSquares.m2:1376:1:
   rerun with: check_11 "SumsOfSquares" *-
 -- making test results
 ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512;  cd /tmp/M2-2519019-0/31-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/root/M2/M2/BUILD/doug/usr-dist/i686-Linux-Debian-unknown/bin/M2-binary" --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("SumsOfSquares", Reload => true, FileName => "/root/M2/M2/Macaulay2/packages/SumsOfSquares.m2")' <"/tmp/M2-2519019-0/30.m2" >>"/tmp/M2-2519019-0/30.tmp" 2>&1
/tmp/M2-2519019-0/30.tmp:0:1: (output file) error: Macaulay2 exited with status code 1
/tmp/M2-2519019-0/30.m2:0:1: (input file)
M2: *** Error 1
stdio:2:6:(3): error: test #11 of package SumsOfSquares failed

i3 : get "/tmp/M2-2519019-0/30.tmp"

o3 = -- -*- M2-comint -*- hash: 245165013
     --warning: file doc.css not installed yet in package Style
     --warning: file katex not installed yet in package Style

     i1 : --/root/M2/M2/Macaulay2/packages/SumsOfSquares.m2:1376: location of test code
           --lowerBound
              debug needsPackage "SumsOfSquares"

     i2 :     results := checkLowerBound("CSDP")
     -- warning: experimental computation over inexact field begun
     --          results not reliable (one warning given per session)

     o2 = {true, false, true, true, true, true, true}

     o2 : List

     i3 :     assert all(results,t->t=!=false);
     stdio:5:5:(3): error: assertion failed

Note that we're using the Debian coinor-csdp package.

@mahrud mahrud added build issue platform specific issues involving compiling M2, generating examples, or running tests and removed build issue platform specific issues involving compiling M2, generating examples, or running tests labels Nov 22, 2020
@mahrud mahrud added the build issue platform specific issues involving compiling M2, generating examples, or running tests label Nov 19, 2021
@d-torrance
Copy link
Member Author

The same test is failing on Fedora rawhide:

i1 : debug needsPackage "SumsOfSquares";
 -- warning: symbol "Verbosity" in Core.Dictionary is shadowed by a symbol in SemidefiniteProgramming.Dictionary
 --   use the synonym Core$Verbosity

i2 : checkLowerBound "CSDP"
-- warning: experimental computation over inexact field begun
--          results not reliable (one warning given per session)
stdio:2:1:(3): error: can't promote number to ring

From what I can gather, the error is happening here:

d := f - bound + (h*mult - transpose mon * Q * mon)_(0,0);

In this case, f is a polynomial over QQ and bound is an RR, and subtracting them raises the error.

@mahrud
Copy link
Member

mahrud commented Aug 11, 2024

This csdp update?

@d-torrance
Copy link
Member Author

I think so -- Fedora switched to packaging a git snapshot a few months ago (https://src.fedoraproject.org/rpms/csdp/c/5e697065b0adcecc9963f57ea20315fd0538ed69?branch=rawhide). So maybe the csdp output has changed a bit?

@d-torrance
Copy link
Member Author

Fixed in #3444

@d-torrance
Copy link
Member Author

Re-opening -- the original issue (which was unrelated to the new csdp package on Fedora) just popped up again on a GitHub build:

-- -*- M2-comint -*- hash: 856345161

i1 :  --lowerBound
         debug needsPackage "SumsOfSquares"

i2 :     results := checkLowerBound("CSDP")
-- warning: experimental computation over inexact field begun
--          results not reliable (one warning given per session)

o2 = {true, false, true, true, true, true, true}

o2 : List

i3 :     assert all(results,t->t=!=false);
stdio:4:10:(3): error: assertion failed

@d-torrance
Copy link
Member Author

I think I found the underlying issue with this bug. The matrix that we construct and send to CSDP depends on the order of monomials in a list that is constructed using a set, so the order is based on the hash codes of these monomials at runtime and isn't deterministic.

In fact, if we randomly shuffle the list, then the check fails about one fifth of the time:

--- a/M2/Macaulay2/packages/SumsOfSquares.m2
+++ b/M2/Macaulay2/packages/SumsOfSquares.m2
@@ -475,7 +475,7 @@ createSOSModel(Matrix,Matrix) := o -> (F,v) -> (
     -- monomials in vvT
     vvT := entries(v* transpose v);
     mons := g -> set first entries monomials g;
-    K1 := toList \\ sum \\ mons \ flatten vvT;
+    K1 := random(toList \\ sum \\ mons \ flatten vvT);
 
     -- monomials in F and not in vvT
     lmf := sum \\ mons \ flatten entries F;
i1 : debug needsPackage "SumsOfSquares"

i2 : tally apply(100, i -> all checkLowerBound "CSDP")
-- warning: experimental computation over inexact field begun
--          results not reliable (one warning given per session)

o2 = Tally{false => 19}
           true => 81

o2 : Tally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build issue platform specific issues involving compiling M2, generating examples, or running tests
Projects
None yet
Development

No branches or pull requests

2 participants