mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   YAFU (https://www.mersenneforum.org/forumdisplay.php?f=96)
-   -   AVX-ECM (https://www.mersenneforum.org/showthread.php?t=25056)

bsquared 2020-11-30 16:32

[QUOTE=bsquared;564835]
In my tinyecm code (< 64 bits) where there are just a few fixed and very small B1 values, I found that in a few cases the cost of PRAC(p1*p2) is cheaper than PRAC(p1) + PRAC(p2). It isn't practical to test combinations of primes like this in real time for arbitrary (and larger) B1. But I wonder if it is worth compiling a list of prime pairs that are cheaper when combined below bounds like 1M, 3M, 11M, etc.[/QUOTE]

Ran a quick test attempting to pair primes < 1M. There are ~5k pairs that are cheaper this way, sometimes dramatically so[SUP]1[/SUP]. But there are ~78k primes below this bound so the total cost savings is a fraction of a percent.

edit: nevermind - this is not valid. Have to check that the chain actually works! conclusion is unchanged - finding cheaper pairs doesn't seem worthwhile.
[CODE]prime 9769 * 9781 cost = 103.5
prime 9769 cost = 109.0
prime 9781 cost = 103.5
(sum 212.5, savings 109.0 @ prac v=0.620181980807)
[/CODE]

mathwiz 2020-12-08 16:41

If I do a "git pull" on the latest code, and then "make COMPILER=gcc SKYLAKEX=1", I'm getting a bunch of linker errors:

[code]gcc -g -O3 -mavx -march=skylake-avx512 -DSKYLAKEX -Wall -I. -I../../gmp-6.2.1 -c -o vec_common.o vec_common.c
gcc -g -O3 -mavx -march=skylake-avx512 -DSKYLAKEX -Wall -I. -I../../gmp-6.2.1 -c -o calc.o calc.c
gcc -g -O3 -mavx -march=skylake-avx512 -DSKYLAKEX -Wall -I. -I../../gmp-6.2.1 -c -o queue.o queue.c
rm -f libavxecm.a
ar r libavxecm.a eratosthenes/presieve.o eratosthenes/count.o eratosthenes/offsets.o eratosthenes/primes.o eratosthenes/roots.o eratosthenes/linesieve.o eratosthenes/soe.o eratosthenes/tiny.o eratosthenes/worker.o eratosthenes/soe_util.o eratosthenes/wrapper.o threadpool.o main.o ecm.o util.o vecarith.o vecarith52.o vec_common.o calc.o queue.o
ar: creating libavxecm.a
ranlib libavxecm.a
gcc -g -O3 -mavx -march=skylake-avx512 -DSKYLAKEX -Wall -I. -I../../gmp-6.2.1 eratosthenes/presieve.o eratosthenes/count.o eratosthenes/offsets.o eratosthenes/primes.o eratosthenes/roots.o eratosthenes/linesieve.o eratosthenes/soe.o eratosthenes/tiny.o eratosthenes/worker.o eratosthenes/soe_util.o eratosthenes/wrapper.o threadpool.o main.o ecm.o util.o vecarith.o vecarith52.o vec_common.o calc.o queue.o -o avx-ecm libavxecm.a -L../../gmp-6.2.1/.libs -lm -lgmp -lpthread
/usr/bin/ld: eratosthenes/count.o:/tmp/avx-ecm/eratosthenes/soe.h:323: multiple definition of `nmasks'; eratosthenes/presieve.o:/tmp/avx-ecm/eratosthenes/soe.h:323: first defined here
/usr/bin/ld: eratosthenes/count.o:/tmp/avx-ecm/eratosthenes/soe.h:341: multiple definition of `szSOEp'; eratosthenes/presieve.o:/tmp/avx-ecm/eratosthenes/soe.h:341: first defined here
/usr/bin/ld: eratosthenes/count.o:/tmp/avx-ecm/eratosthenes/soe.h:340: multiple definition of `spSOEprimes'; eratosthenes/presieve.o:/tmp/avx-ecm/eratosthenes/soe.h:340: first defined here
/usr/bin/ld: eratosthenes/count.o:/tmp/avx-ecm/eratosthenes/soe.h:337: multiple definition of `P_MAX'; eratosthenes/presieve.o:/tmp/avx-ecm/eratosthenes/soe.h:337: first defined here
/usr/bin/ld: eratosthenes/count.o:/tmp/avx-ecm/eratosthenes/soe.h:336: multiple definition of `P_MIN'; eratosthenes/presieve.o:/tmp/avx-ecm/eratosthenes/soe.h:336: first defined here
/usr/bin/ld: eratosthenes/count.o:/tmp/avx-ecm/eratosthenes/soe.h:335: multiple definition of `NUM_P'; eratosthenes/presieve.o:/tmp/avx-ecm/eratosthenes/soe.h:335: first defined here
/usr/bin/ld: eratosthenes/count.o:/tmp/avx-ecm/eratosthenes/soe.h:334: multiple definition of `PRIMES'; eratosthenes/presieve.o:/tmp/avx-ecm/eratosthenes/soe.h:334: first defined here
/usr/bin/ld: eratosthenes/count.o:/tmp/avx-ecm/eratosthenes/soe.h:330: multiple definition of `SOE_VFLAG'; eratosthenes/presieve.o:/tmp/avx-ecm/eratosthenes/soe.h:330: first defined here[/code]

bsquared 2020-12-08 16:47

[QUOTE=mathwiz;565667]If I do a "git pull" on the latest code, and then "make COMPILER=gcc SKYLAKEX=1", I'm getting a bunch of linker errors:
[/QUOTE]

Those are very similar errors to what is happening [URL="https://www.mersenneforum.org/showthread.php?t=23087"]here[/URL], with someone trying to compile YAFU using gcc 10.2.0. Are you using the same version of gcc, by any chance?

As with yafu, I see no problems with gcc 7.3.0 or icc 18.0.3.

[edit]
I know that defining globals in header files is frowned upon, but I didn't know it was an error as long as the header is only included once. That is why they are protected with the #ifndef X #define X macros. Could that have changed with the latest gcc? Maybe putting a -std=c11 in the make would help?

EdH 2020-12-08 17:16

Just to note, gcc 8.3.0 (Debian) and 9.3.0 (Ubuntu) worked fine for YAFU (wip), last time I upgraded all my machines.


Note: I will probably move this to the other thread later, since it's not really about AVX-ECM.

mathwiz 2020-12-08 21:36

[QUOTE=EdH;565675]Just to note, gcc 8.3.0 (Debian) and 9.3.0 (Ubuntu) worked fine for YAFU (wip), last time I upgraded all my machines.


Note: I will probably move this to the other thread later, since it's not really about AVX-ECM.[/QUOTE]

Indeed, using gcc-8 instead of my default (gcc-10) appears to work fine.

bsquared 2020-12-08 21:51

[QUOTE=mathwiz;565704]Indeed, using gcc-8 instead of my default (gcc-10) appears to work fine.[/QUOTE]

Good to know, thanks.

I've asked a question about this over in the programming thread; maybe more people read that and someone might know what's going on. I've browsed the gcc changelog but nothing jumps out at me as a possible cause of this behavior. No time at the moment to dig deeper... hoping that someone smarter than me can bail me out here.


All times are UTC. The time now is 16:46.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.