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

Random failure in gf2x testsuite #18882

Closed
vbraun opened this issue Jul 12, 2015 · 47 comments
Closed

Random failure in gf2x testsuite #18882

vbraun opened this issue Jul 12, 2015 · 47 comments

Comments

@vbraun
Copy link
Member

vbraun commented Jul 12, 2015

Randomly (rarely), gf2x fails its tests:

libtool: link: gcc -O0 -g -Wall -W -mpclmul -o .libs/check-addmul check-addmul.o  ../.libs/libgf2x.so -Wl,-rpath -Wl,/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib
make[5]: Leaving directory '/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/var/tmp/sage/build/gf2x-1.1.p1/src/tests'
make  check-TESTS
make[5]: Entering directory '/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/var/tmp/sage/build/gf2x-1.1.p1/src/tests'
1x1 2x2 3x3 4x4 5x5 6x6 7x7 8x8 9x9 20x20 100x20 100x100 failed : '100 100 cca56aa6 76540123' != '100 100 2269c4fa 76540123'
FAIL: do-check-mul.sh

Retrying ends successfully:

libtool: link: gcc -O0 -g -Wall -W -mpclmul -o .libs/check-addmul check-addmul.o  ../.libs/libgf2x.so -Wl,-rpath -Wl,/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib
make[5]: Leaving directory '/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/var/tmp/sage/build/gf2x-1.1.p1/src/tests'
make  check-TESTS
make[5]: Entering directory '/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/var/tmp/sage/build/gf2x-1.1.p1/src/tests'
1x1 2x2 3x3 4x4 5x5 6x6 7x7 8x8 9x9 20x20 100x20 100x100 1000x20 1000x100 1000x1000 5437x20 5437x100 5437x1000 5437x5437 10000x20 10000x100 10000x1000 10000x5437 10000x10000 832040x1346269 785672x1271244 
Checking gf2x_mul_1_n against gf2x_addmul_1_n...ok
PASS: do-check-mul.sh

This is on Linux 64-bit

Upstream: Fixed upstream, but not in a stable release.

CC: @zimmermann6 @tscrim

Component: packages: standard

Author: François Bissey

Branch: a64f2a5

Reviewer: Volker Braun

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

@vbraun vbraun added this to the sage-6.8 milestone Jul 12, 2015
@nexttime
Copy link
Mannequin

nexttime mannequin commented Oct 1, 2015

comment:1

What does "retrying" refer to?

Does it pass if you just rerun the test suite (as opposed to rebuilding and retuning in advance)?

@vbraun
Copy link
Member Author

vbraun commented Oct 1, 2015

comment:2

rebuild; this particular example was on the buildbot.

@jhpalmieri
Copy link
Member

comment:3

This still occurs. It doesn't happen every time, but it happens frequently with OS X, especially on a loaded system, and also sometimes on a less stressed system.

@kiwifb
Copy link
Member

kiwifb commented Apr 21, 2017

comment:4

Seems to be happening every time for me when using #12426. Works all right on linux+clang, just OS X seems to be affected here. I wonder if it is hardware configuration related.

@kiwifb
Copy link
Member

kiwifb commented May 22, 2017

comment:5

OK so with clang I can now reproduce the issue at will on linux (contrary to my last post). After exploring building and testing manually I finally discovered the tuning section of spkg-install

case "$SAGE_TUNE_GF2X" in
    "full")
        echo "Complete tuning of gf2x."
        $MAKE tune-lowlevel && $MAKE tune-toom && $MAKE tune-fft
        if [ $? -ne 0 ]; then
            echo >&2 "Error: Failed to tune gf2x."
            exit 1
        fi
        ;;
    "no")
        echo "Skipping tuning of gf2x."
        echo "You can set SAGE_TUNE_GF2X to yes or full to turn it on."
        ;;
    *)
        echo "Fast tuning of gf2x."
        echo "You can set SAGE_TUNE_GF2X to full to run a complete tuning."
        $MAKE tune-lowlevel && $MAKE tune-toom TOOM_TUNING_LIMIT=100
        if [ $? -ne 0 ]; then
            echo >&2 "Error: Failed to tune gf2x."
            exit 1
        fi
        ;;
esac

When SAGE_TUNE_GF2X is set to no the test suite pass. When set to full, the clang build breaks when doing $MAKE tune-fft which will be a separate issue. So I toyed with what is applied in the "fast tuning". With

  • $MAKE tune-lowlevel testsuite pass
  • $MAKE tune-lowlevel && $MAKE tune-toom TOOM_TUNING_LIMIT=100 testsuite breaks as above
  • $MAKE tune-lowlevel && $MAKE tune-toom breaks as above
    So it looks like in some circumstance the tune-toom tuning leads to a subtle breakage.

@kiwifb
Copy link
Member

kiwifb commented May 22, 2017

comment:6

@ Paul does the testsuite failure above , which is linked to the use of tune-toom, ring any bells? I see some "recent" commit about toom on the git server of inria.

@kiwifb
Copy link
Member

kiwifb commented May 23, 2017

comment:7

git master for gf2x doesn't seem to exhibit the problem. tune-toom is much faster but I haven't completed testing with tune-fft yet. That tuning is long.

@kiwifb
Copy link
Member

kiwifb commented May 23, 2017

comment:8

OK git master passes its testsuite in all configurations - including the ones where it is failing in 1.1.

@zimmermann6
Copy link

comment:9

Replying to @kiwifb:

git master for gf2x doesn't seem to exhibit the problem. tune-toom is much faster but I haven't completed testing with tune-fft yet. That tuning is long.

maybe we should make a new release, since we have fixed several bugs in 1.1.
When tune-toom fails, please can you send me (privately) the result of tune-lowlevel?

@kiwifb
Copy link
Member

kiwifb commented May 23, 2017

comment:10

Replying to @zimmermann6:

Replying to @kiwifb:

git master for gf2x doesn't seem to exhibit the problem. tune-toom is much faster but I haven't completed testing with tune-fft yet. That tuning is long.

maybe we should make a new release, since we have fixed several bugs in 1.1.
When tune-toom fails, please can you send me (privately) the result of tune-lowlevel?

I can reproduce all that tomorrow and send it to you privately I guess. On my system I can generate the failure with clang (but the failure is not specific to clang since this was spotted before anyone was toying with it) but things work with gcc so I could even give you a good set of toom tuning and a bad one.

@zimmermann6
Copy link

comment:11

my guess is that with clang the basic routines chosen by tune-lowlevel are different from those chosen by gcc, and tune-toom hits a bug in one of those routines, which was fixed in the development version.

@kiwifb
Copy link
Member

kiwifb commented May 24, 2017

comment:12

Paul found where the error is in the current code and provided the fix. I'll provide a patch against 1.1 shortly.

@kiwifb
Copy link
Member

kiwifb commented May 24, 2017

Upstream: Fixed upstream, but not in a stable release.

@kiwifb
Copy link
Member

kiwifb commented May 24, 2017

Commit: a64f2a5

@kiwifb
Copy link
Member

kiwifb commented May 24, 2017

Author: François Bissey

@kiwifb
Copy link
Member

kiwifb commented May 24, 2017

Branch: u/fbissey/gf2x_test

@kiwifb
Copy link
Member

kiwifb commented May 24, 2017

comment:13

Ready for review and I am making this a blocker since it means by default some install are getting a bug - even if we haven't seen a consequence so far apart from that test failure (note that on system where this failure is apparent, the ntl testsuite will also fail).


New commits:

a64f2a5fix bug in tuned code which caused testsuite to fail with some compilers and hardware

@kiwifb kiwifb modified the milestones: sage-6.8, sage-8.0 May 24, 2017
@vbraun
Copy link
Member Author

vbraun commented May 31, 2017

Reviewer: Volker Braun

@vbraun
Copy link
Member Author

vbraun commented Jun 3, 2017

comment:15

On http://build.sagemath.org/#/builders/23/builds/1/steps/5/logs/gf2x

cd src; make tune-toom
make[4]: Entering directory '/home/buildbot/slave/sage_git/build/local/var/tmp/sage/build/gf2x-1.1.p2/src/src'
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../gf2x  -I.. -I..   -O2 -g  -Wall -W -mpclmul -MT tunetoom.o -MD -MP -MF .deps/tunetoom.Tpo -c -o tunetoom.o tunetoom.c
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../gf2x  -I.. -I..   -O2 -g  -Wall -W -mpclmul -MT tuning-common.o -MD -MP -MF .deps/tuning-common.Tpo -c -o tuning-common.o tuning-common.c
mv -f .deps/tuning-common.Tpo .deps/tuning-common.Po
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../gf2x  -I.. -I..   -O2 -g  -Wall -W -mpclmul -MT update-thresholds.o -MD -MP -MF .deps/update-thresholds.Tpo -c -o update-thresholds.o update-thresholds.c
mv -f .deps/tunetoom.Tpo .deps/tunetoom.Po
mv -f .deps/update-thresholds.Tpo .deps/update-thresholds.Po
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../gf2x  -I.. -I..   -O2 -g  -Wall -W -mpclmul -MT replace.o -MD -MP -MF .deps/replace.Tpo -c -o replace.o replace.c
/bin/bash ../libtool --tag=CC   --mode=link gcc -std=gnu99  -O2 -g  -Wall -W -mpclmul  -L/home/buildbot/slave/sage_git/build/local/lib -Wl,-rpath,/home/buildbot/slave/sage_git/build/local/lib  -o tunetoom tunetoom.o tuning-common.o libtiming.la ../libgf2x.la 
libtool: link: gcc -std=gnu99 -O2 -g -Wall -W -mpclmul -Wl,-rpath -Wl,/home/buildbot/slave/sage_git/build/local/lib -o .libs/tunetoom tunetoom.o tuning-common.o  -L/home/buildbot/slave/sage_git/build/local/lib ./.libs/libtiming.a ../.libs/libgf2x.so -Wl,-rpath -Wl,/home/buildbot/slave/sage_git/build/local/lib
mv -f .deps/replace.Tpo .deps/replace.Po
/bin/bash ../libtool --tag=CC   --mode=link gcc -std=gnu99  -O2 -g  -Wall -W -mpclmul  -L/home/buildbot/slave/sage_git/build/local/lib -Wl,-rpath,/home/buildbot/slave/sage_git/build/local/lib  -o update-thresholds update-thresholds.o replace.o  
./tunetoom -s 1.05 100 -o tunetoom.res
10 libtool: link: gcc -std=gnu99 -O2 -g -Wall -W -mpclmul -Wl,-rpath -Wl,/home/buildbot/slave/sage_git/build/local/lib -o update-thresholds update-thresholds.o replace.o  -L/home/buildbot/slave/sage_git/build/local/lib
TC2:7.10e-08 TC3:0.00e+00 TC3W:3.05e-07 TC4:0.00e+00 best:7.10e-08 TC2
11 TC2:9.35e-08 TC3:0.00e+00 TC3W:1.86e-07 TC4:0.00e+00 best:9.35e-08 TC2
12 TC2:8.87e-08 TC3:0.00e+00 TC3W:1.75e-07 TC4:0.00e+00 best:8.87e-08 TC2
13 TC2:9.97e-08 TC3:0.00e+00 TC3W:2.12e-07 TC4:0.00e+00 best:9.97e-08 TC2
14 TC2:1.08e-07 TC3:0.00e+00 TC3W:2.14e-07 TC4:0.00e+00 best:1.08e-07 TC2
15 TC2:1.45e-07 TC3:0.00e+00 TC3W:2.21e-07 TC4:0.00e+00 best:1.45e-07 TC2
16 TC2:1.71e-07 TC3:0.00e+00 TC3W:2.60e-07 TC4:0.00e+00 best:1.71e-07 TC2
17 TC2:1.54e-07 TC3:3.30e-07 TC3W:2.94e-07 TC4:0.00e+00 best:1.54e-07 TC2
18 TC2:1.55e-07 TC3:3.26e-07 TC3W:3.13e-07 TC4:0.00e+00 best:1.55e-07 TC2
19 TC2:2.14e-07 TC3:3.93e-07 TC3W:2.75e-07 TC4:0.00e+00 best:2.14e-07 TC2
20 TC2:2.38e-07 TC3:3.85e-07 TC3W:4.41e-07 TC4:0.00e+00 best:2.38e-07 TC2
21 TC2:2.98e-07 TC3:5.04e-07 TC3W:3.03e-07 TC4:0.00e+00 best:2.98e-07 TC2
22 TC2:2.80e-07 TC3:5.23e-07 TC3W:3.24e-07 TC4:0.00e+00 best:2.80e-07 TC2
23 TC2:3.74e-07 TC3:6.14e-07 TC3W:3.78e-07 TC4:0.00e+00 best:3.74e-07 TC2
24 TC2:2.99e-07 TC3:6.52e-07 TC3W:4.04e-07 TC4:0.00e+00 best:2.99e-07 TC2
25 TC2:4.20e-07 TC3:5.15e-07 TC3W:5.15e-07 TC4:0.00e+00 best:4.20e-07 TC2
26 TC2:3.34e-07 TC3:5.26e-07 TC3W:4.20e-07 TC4:0.00e+00 best:3.34e-07 TC2
27 TC2:3.38e-07 TC3:5.23e-07 TC3W:4.46e-07 TC4:0.00e+00 best:3.38e-07 TC2
28 TC2:3.41e-07 TC3:6.52e-07 TC3W:5.04e-07 TC4:0.00e+00 best:3.41e-07 TC2
29 TC2:4.01e-07 TC3:7.13e-07 TC3W:6.48e-07 TC4:0.00e+00 best:4.01e-07 TC2
30 TC2:4.31e-07 TC3:6.75e-07 TC3W:5.72e-07 TC4:9.61e-07 best:4.31e-07 TC2
31 TC2:4.60e-07 TC3:7.51e-07 TC3W:5.53e-07 TC4:9.61e-07 best:4.60e-07 TC2
32 TC2:4.77e-07 TC3:1.09e-06 TC3W:5.76e-07 TC4:1.11e-06 best:4.77e-07 TC2
33 TC2:5.30e-07 TC3:9.42e-07 TC3W:8.01e-07 TC4:1.08e-06 best:5.30e-07 TC2
34 TC2:6.60e-07 TC3:9.08e-07 TC3W:8.32e-07 TC4:1.04e-06 best:6.60e-07 TC2
35 TC2:6.79e-07 TC3:9.46e-07 TC3W:8.32e-07 TC4:1.36e-06 best:6.79e-07 TC2
36 TC2:8.16e-07 TC3:9.57e-07 TC3W:6.90e-07 TC4:1.22e-06 best:6.90e-07 TC3W
37 TC2:7.63e-07 TC3:9.61e-07 TC3W:8.28e-07 TC4:1.63e-06 best:7.63e-07 TC2
38 TC2:7.55e-07 TC3:9.38e-07 TC3W:6.87e-07 TC4:1.28e-06 best:6.87e-07 TC3W
39 TC2:7.93e-07 TC3:9.54e-07 TC3W:7.78e-07 TC4:1.30e-06 best:7.78e-07 TC3W
40 TC2:7.78e-07 TC3:1.17e-06 TC3W:7.90e-07 TC4:1.32e-06 best:7.78e-07 TC2
42 TC2:8.58e-07 TC3:9.84e-07 TC3W:8.51e-07 TC4:1.46e-06 best:8.51e-07 TC3W
44 TC2:9.00e-07 TC3:1.14e-06 TC3W:9.46e-07 TC4:1.49e-06 best:9.00e-07 TC2
46 TC2:1.06e-06 TC3:1.21e-06 TC3W:1.27e-06 TC4:1.59e-06 best:1.06e-06 TC2
48 TC2:1.11e-06 TC3:1.59e-06 TC3W:1.11e-06 TC4:2.06e-06 best:1.11e-06 TC2
50 TC2:1.46e-06 TC3:1.41e-06 TC3W:1.06e-06 TC4:1.76e-06 best:1.06e-06 TC3W
52 TC2:1.06e-06 TC3:1.51e-06 TC3W:1.14e-06 TC4:1.79e-06 best:1.06e-06 TC2
54 TC2:1.09e-06 TC3:1.37e-06 TC3W:1.35e-06 TC4:3.27e-06 best:1.09e-06 TC2
56 TC2:2.04e-06 TC3:1.72e-06 TC3W:1.38e-06 TC4:2.47e-06 best:1.38e-06 TC3W
58 TC2:1.51e-06 TC3:1.92e-06 TC3W:2.11e-06 TC4:2.20e-06 best:1.51e-06 TC2
60 TC2:1.39e-06 TC3:1.83e-06 TC3W:1.91e-06 TC4:2.23e-06 best:1.39e-06 TC2
63 TC2:1.65e-06 TC3:2.66e-06 TC3W:1.82e-06 TC4:2.32e-06 best:1.65e-06 TC2
66 TC2:1.55e-06 TC3:2.11e-06 TC3W:1.86e-06 TC4:2.58e-06 best:1.55e-06 TC2
69 TC2:1.64e-06 TC3:2.32e-06 TC3W:1.91e-06 TC4:2.53e-06 best:1.64e-06 TC2
72 TC2:1.83e-06 TC3:2.33e-06 TC3W:1.95e-06 TC4:2.56e-06 best:1.83e-06 TC2
75 TC2:2.37e-06 TC3:2.47e-06 TC3W:2.03e-06 TC4:3.69e-06 best:2.03e-06 TC3W
78 TC2:2.35e-06 TC3:2.52e-06 TC3W:2.11e-06 TC4:3.17e-06 best:2.11e-06 TC3W
81 TC2:2.59e-06 TC3:2.55e-06 TC3W:2.21e-06 TC4:3.40e-06 best:2.21e-06 TC3W
85 TC2:2.79e-06 TC3:2.88e-06 TC3W:2.40e-06 TC4:3.74e-06 best:2.40e-06 TC3W
89 TC2:2.91e-06 TC3:3.13e-06 TC3W:2.70e-06 TC4:5.19e-06 best:2.70e-06 TC3W
93 TC2:3.33e-06 TC3:3.31e-06 TC3W:2.82e-06 TC4:4.12e-06 best:2.82e-06 TC3W
97 TC2:3.20e-06 TC3:4.85e-06 TC3W:2.90e-06 TC4:4.27e-06 best:2.90e-06 TC3W
51 lt-tunetoom: toom2.c:499: gf2x_mul_tc3u: Assertion `sa >= 59' failed.
Makefile:2202: recipe for target 'tunetoom.res' failed
make[4]: *** [tunetoom.res] Aborted
make[4]: *** Deleting file 'tunetoom.res'
make[4]: Target 'tune-toom' not remade because of errors.
make[4]: Leaving directory '/home/buildbot/slave/sage_git/build/local/var/tmp/sage/build/gf2x-1.1.p2/src/src'
Makefile:976: recipe for target 'tune-toom' failed
make[3]: *** [tune-toom] Error 2
make[3]: Leaving directory '/home/buildbot/slave/sage_git/build/local/var/tmp/sage/build/gf2x-1.1.p2/src'
Error: Failed to tune gf2x.

@kiwifb
Copy link
Member

kiwifb commented Jun 4, 2017

comment:20

Replying to @vbraun:

I reset the buildbot docker instance, the log's aren't saved for all eternity...

Sure. It would be nice to have them a little bit longer though.

I also saw some similar failures after reverting this ticket so perhaps its unrelated? Or an incremental build picks up pieces from the previous gf2x?

If you still get some of these without the ticket, it is indeed probably a separate issue. But it would have been nice to at least have the result of the low-level tuning

@kiwifb
Copy link
Member

kiwifb commented Jun 4, 2017

comment:21

Actually it is impossible to know if this is related to the original issue without knowing the results of the low level tuning.

@vbraun
Copy link
Member Author

vbraun commented Jun 4, 2017

comment:22

Incremental build after removing this ticket fails: http://build.sagemath.org/#/builders/66/builds/2

Full rebuild (make distclean) on the same commit ef05f46ddbc6c94cd1e911b0090efdfe8d7ec02f succeeds: http://build.sagemath.org/#/builders/30/builds/1

I saw this on at least two buildslaves; Could be a timing / cpu load issue but suspicious nevertheless.

@kiwifb
Copy link
Member

kiwifb commented Jun 4, 2017

comment:23

Nothing much in those linked logs. They look like cmake upgrade logs not gf2x bug fix logs.

@vbraun
Copy link
Member Author

vbraun commented Jun 4, 2017

comment:24

There are a number of tickets merged in the branch but it has nothing to do with cmake specifically (which is optional and unused by default). Click on "view all" to see the start of the git log...

@kiwifb
Copy link
Member

kiwifb commented Jun 4, 2017

comment:25

OK, not sure what happened the first time I looked at the link

[gf2x-1.1.p1] Summary of tune-lowlevel results
[gf2x-1.1.p1] mul1 -> mul1cl.c [ 1.4 ns ] (unchanged)
[gf2x-1.1.p1] mul2 -> mul2cl2.c [ 2.2 ns ] (unchanged)
[gf2x-1.1.p1] mul3 -> mul3k2.c [ 9.0 ns ]
[gf2x-1.1.p1] mul4 -> mul4cl1.c [ 9.9 ns ]
[gf2x-1.1.p1] mul5 -> mul5k3.c [ 15.1 ns ]
[gf2x-1.1.p1] mul6 -> mul6k_c.c [ 20.2 ns ]
[gf2x-1.1.p1] mul7 -> mul7cl.c [ 25.3 ns ] (unchanged)
[gf2x-1.1.p1] mul8 -> mul8k.c [ 92.6 ns ] (unchanged)
[gf2x-1.1.p1] mul9 -> mul9cl.c [ 39.4 ns ] (unchanged)

The failure has to be unrelated. The fix I committed was for mul9clk2.c and here mul9cl.c is used instead. This is most likely another bug.

@vbraun
Copy link
Member Author

vbraun commented Jun 5, 2017

Changed branch from u/fbissey/gf2x_test to a64f2a5

@zimmermann6
Copy link

comment:28

I confirm the issue of comment [comment:15] is unrelated.

We are working on the new release.

In the meantime I cannot understand how the failure can happen. Apparently gf2x_mul_tc3u is called with sa=51, whereas GF2X_MUL_TOOMU_THRESHOLD=59. But in src/tunetoom.c,
routine tuneutoom, we start with sa=BESTMINU+1 where BESTMINU is defined to be
GF2X_MUL_TOOMU_THRESHOLD-1. Please can you print the value of GF2X_MUL_TOOMU_THRESHOLD
at the beginning of tuneutoom, and investigate how it can be 51?

@zimmermann6
Copy link

Changed commit from a64f2a5 to none

@kiwifb
Copy link
Member

kiwifb commented Jun 12, 2017

comment:29

From what I can see a lot of people get the new failure. It seems like people who would have gotten mul9clk2.c before now get mul9cl.c in the low level tuning.

However my own tuning with gcc also uses mul9cl.c so it must be the cause in isolation. The two failures I got to observe also had mul6k_c.c while my gcc tuning uses mul6k_b.c. Note that apart from mul6 my gcc low level tuning is identical to the one I quoted from the build bot in comment 25.

@zimmermann6
Copy link

comment:30

I believe the new failure is independent from the low-level tuning.

However as said in comment [comment:28] I don't understand how it can happen. On a machine where it happens, please can you print the value of GF2X_MUL_TOOMU_THRESHOLD at the beginning of tuneutoom, and investigate how it can be 51?

@kiwifb
Copy link
Member

kiwifb commented Jun 12, 2017

comment:31

@ Travis: Can you provide the info requested by Paul Zimmermann in the previous comment? Like I said I don't experience it, so I cannot provide that info.

@dimpase
Copy link
Member

dimpase commented Jun 12, 2017

comment:32

I see this error on Fedora Linux machine, I'll try to see what I can supply.

@dimpase
Copy link
Member

dimpase commented Jun 12, 2017

comment:33

I've added

--- a/src/tunetoom.c
+++ b/src/tunetoom.c
@@ -107,6 +107,9 @@ void tunetoom(long tablesz)
     double T3[1], TK[1], TW[1], T4[1];
     double mint;
     unsigned long *a, *b, *c, *d, *t;
+    int tre;
+    tre = GF2X_MUL_TOOMU_THRESHOLD;
+    printf(" tunetoom: GF2X_MUL_TOOMU_THRESHOLD = %d\n", tre); 
 
     high = tablesz;
     if (high < BESTMIN)

and so it did

[gf2x-1.1.p2] ./tunetoom -s 1.05 100 -o tunetoom.res
[gf2x-1.1.p2]  tunetoom: GF2X_MUL_TOOMU_THRESHOLD = 51
[gf2x-1.1.p2] 10 TC2:7.78e-08 TC3:0.00e+00 TC3W:1.60e-07 TC4:0.00e+00 best:7.78e-08 TC2
[gf2x-1.1.p2] 11 TC2:8.60e-08 TC3:0.00e+00 TC3W:1.66e-07 TC4:0.00e+00 best:8.60e-08 TC2
...
[gf2x-1.1.p2] 97 TC2:3.16e-06 TC3:3.66e-06 TC3W:3.05e-06 TC4:4.36e-06 best:3.05e-06 TC3W
[gf2x-1.1.p2] 51 lt-tunetoom: toom2.c:499: gf2x_mul_tc3u: Assertion `sa >= 59' failed.

51 comes from the 1st of the 3 includes, I suppose:

gf2x/gf2x-thresholds.h:#define GF2X_MUL_TOOMU_THRESHOLD           51
...
already_tuned/x86_64_pclmul/gf2x-thresholds.h:#define GF2X_MUL_TOOMU_THRESHOLD            51
already_tuned/opteron/gf2x-thresholds.h:#define GF2X_MUL_TOOMU_THRESHOLD          51

I don't know what goes wrong---more things to print?

@jpflori
Copy link

jpflori commented Jun 12, 2017

comment:34

I get similar errors on a ppc64 machine.

@zimmermann6
Copy link

comment:35

the fix is to replace in toom2.c, line 499:

    ASSERT(sa >= MINI_GF2X_MUL_TOOMU_THRESHOLD);

by

    ASSERT(sa >= 33);

which better corresponds to the accompagnying comment.

@tscrim
Copy link
Collaborator

tscrim commented Jun 12, 2017

comment:36

Hum...doing sage -f gf2x rebuilt without issue (with [limited?] tuning after the first build without any tuning). So I can no longer reproduce the build failure I was getting. At least Paul seems to have found a fix.

@dimpase
Copy link
Member

dimpase commented Jun 12, 2017

gf2x-1.1.p2.log

@dimpase
Copy link
Member

dimpase commented Jun 12, 2017

comment:37

Attachment: gf2x-1.1.p2.log

I am trying to create the patch:

--- a/toom2.c
+++ b/toom2.c
@@ -496,7 +496,7 @@ void gf2x_mul_tc3(unsigned long *c, const unsigned long *a,
 void gf2x_mul_tc3u(unsigned long * c, const unsigned long * a, long sa,
              const unsigned long * b, unsigned long * stk)
 {
-    ASSERT(sa >= GF2X_MUL_TOOMU_THRESHOLD);    // n should be at least 6 for internal
+    ASSERT(sa >= 33);  // n should be at least 6 for internal
     // reasons and 17 so calls to Toom
     // have size at least 9, so need
     // sa >= 33.

And as you see from the log, it is getting applied (and I inspect the source after the package building ends in error, I see it applied).
But I absolutely do not understand why this does not work, as I get exactly the same error:

51 lt-tunetoom: toom2.c:499: gf2x_mul_tc3u: Assertion `sa >= 59' failed

Please advise - it looks as if some weirdness is going on I don't get.

@zimmermann6
Copy link

comment:38

did you run make clean?

@dimpase
Copy link
Member

dimpase commented Jun 12, 2017

comment:39

Replying to @zimmermann6:

did you run make clean?

./sage -i gf2x does an installation from scratch, no?! See the top part of the log...

@dimpase
Copy link
Member

dimpase commented Jun 12, 2017

comment:40

I even tried removing the build directory manually and doing ./sage -i gf2x again, with the same result.

@zimmermann6
Copy link

comment:41

I am lost here. Could it be that you have a toom2.c file elsewhere on your system?

@dimpase
Copy link
Member

dimpase commented Jun 12, 2017

comment:42

it was lt-tunetoom linked against a previous version of libgf2x.so in SAGE_LOCAL/lib/.

This is something I would call a bug in gf2x, as you cannot guarantee that libgf2x.so unique on the system---you really have to make sure you tune what you're installing, not something else...

Anyhow, all good now.

@dimpase
Copy link
Member

dimpase commented Jun 12, 2017

comment:43

the branch with the fix will be posted on #23225, as this ticket in closed.

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

7 participants