mersenneforum.org

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

kruoli 2021-04-21 13:54

It looks like there are still some libraries missing? Msieve is version 1.53.

[CODE]gcc -O3 -march=native -DUSE_AVX2 -DUSE_SSE41 -DUSE_SSE2 -DUsenFS -I../ytools -I../ysieve -Iinclude -Ifactor -Itop/cmdParser -I. -I../gmpecm -I../gmp-6.2.1 -Itop/aprcl -L../ytools -L../ysieve top/driver.o top/test.o factor/tune.o factor/autofactor.o top/cmdParser/cmdOptions.o top/cmdParser/calc.o -o yafu -lysiqs -lyecm -lynfs -L../../ysieve.git/trunk -L../../ytools.git/trunk -L. -L../gmp/lib/ -L../gmp-ecm/lib/ -L../msieve-1.53 -lmsieve ../gmpecm/.libs/libecm.a ../gmp-6.2.1/.libs/libgmp.a -lytools -lysieve -lpthread -lm -ldl
/usr/bin/ld: factor/autofactor.o: in function `schedule_work':
autofactor.c:(.text+0x2233): undefined reference to `snfs_find_form'
/usr/bin/ld: autofactor.c:(.text+0x2319): undefined reference to `snfs_find_form'
/usr/bin/ld: autofactor.c:(.text+0x238e): undefined reference to `est_gnfs_size_via_poly'
/usr/bin/ld: factor/autofactor.o: in function `factor':
autofactor.c:(.text+0x4001): undefined reference to `snfs_find_form'
/usr/bin/ld: ./libysiqs.a(SIQS.o): in function `siqs_static_init':
SIQS.c:(.text+0x4e65): undefined reference to `resieve_medprimes_32k_avx2'
/usr/bin/ld: SIQS.c:(.text+0x4e73): undefined reference to `tdiv_medprimes_32k_avx2'
/usr/bin/ld: SIQS.c:(.text+0x4e8f): undefined reference to `med_sieveblock_32k_avx2'
/usr/bin/ld: SIQS.c:(.text+0x4ea7): undefined reference to `nextRoots_32k_avx2'
/usr/bin/ld: SIQS.c:(.text+0x5363): undefined reference to `nextRoots_32k_sse41'
/usr/bin/ld: SIQS.c:(.text+0x5371): undefined reference to `med_sieveblock_32k_sse41'
/usr/bin/ld: ./libynfs.a(snfs.o): in function `snfs_init':
snfs.c:(.text+0xa9): undefined reference to `mpz_polys_init'
/usr/bin/ld: ./libynfs.a(snfs.o): in function `snfs_clear':
snfs.c:(.text+0x145): undefined reference to `mpz_polys_free'
/usr/bin/ld: ./libynfs.a(snfs.o): in function `print_snfs':
snfs.c:(.text+0x76e): undefined reference to `print_poly'
/usr/bin/ld: ./libynfs.a(snfs.o): in function `snfs_test_sieve':
snfs.c:(.text+0x28a7): undefined reference to `IGNOrenFS_ABORT'
/usr/bin/ld: snfs.c:(.text+0x28b0): undefined reference to `test_sieve'
/usr/bin/ld: snfs.c:(.text+0x28b6): undefined reference to `IGNOrenFS_ABORT'
/usr/bin/ld: ./libynfs.a(snfs.o): in function `approx_norms':
snfs.c:(.text+0x2e53): undefined reference to `ggnfs_table'
/usr/bin/ld: ./libynfs.a(snfs.o): in function `gen_xyyxf_poly':
snfs.c:(.text+0x3c14): undefined reference to `mpz_polys_free'
/usr/bin/ld: snfs.c:(.text+0x4657): undefined reference to `mpz_polys_free'
/usr/bin/ld: snfs.c:(.text+0x4727): undefined reference to `mpz_polys_free'
/usr/bin/ld: ./libynfs.a(snfs.o): in function `gen_brent_poly':
snfs.c:(.text+0x5e66): undefined reference to `mpz_polys_free'
/usr/bin/ld: snfs.c:(.text+0x5eed): undefined reference to `mpz_polys_free'
/usr/bin/ld: ./libynfs.a(snfs.o):snfs.c:(.text+0x6296): more undefined references to `mpz_polys_free' follow
/usr/bin/ld: ./libynfs.a(snfs.o): in function `skew_snfs_params':
snfs.c:(.text+0x8c1): undefined reference to `get_ggnfs_params'
/usr/bin/ld: ../msieve-1.53/libmsieve.a(savefile.o): in function `savefile_open':
savefile.c:(.text+0x118): undefined reference to `gzopen64'
/usr/bin/ld: savefile.c:(.text+0x21b): undefined reference to `gzopen64'
/usr/bin/ld: savefile.c:(.text+0x251): undefined reference to `gzopen64'
/usr/bin/ld: ../msieve-1.53/libmsieve.a(savefile.o): in function `savefile_close':
savefile.c:(.text+0x2f1): undefined reference to `gzclose'
/usr/bin/ld: ../msieve-1.53/libmsieve.a(savefile.o): in function `savefile_write_line':
savefile.c:(.text+0x3d0): undefined reference to `gzputs'
/usr/bin/ld: ../msieve-1.53/libmsieve.a(savefile.o): in function `savefile_flush':
savefile.c:(.text+0x454): undefined reference to `gzputs'
/usr/bin/ld: ../msieve-1.53/libmsieve.a(savefile.o): in function `savefile_eof':
savefile.c:(.text+0x321): undefined reference to `gzeof'
/usr/bin/ld: ../msieve-1.53/libmsieve.a(savefile.o): in function `savefileread_line':
savefile.c:(.text+0x36c): undefined reference to `gzgets'
/usr/bin/ld: ../msieve-1.53/libmsieve.a(savefile.o): in function `savefilerewind':
savefile.c:(.text+0x491): undefined reference to `gzrewind'
collect2: error: ld returned 1 exit status
make: *** [Makefile:424: yafu] Error 1[/CODE]

bsquared 2021-04-21 14:03

It should be -DUSE_NFS to define yafu's nfs functions (not -DUsenFS). Also, I usually build msieve with NO_ZLIB; otherwise you might have to find/build/link a zlib library.

kruoli 2021-04-21 14:08

The call was [C]make CC=gcc CFLAGS="-O3 -march=native -DUSE_AVX2 -DUSE_SSE41 -DUSE_SSE2 -DUSE_NFS -I../ytools -I../ysieve -Iinclude -Ifactor -Itop/cmdParser -I. -I../gmpecm -I../gmp-6.2.1 -Itop/aprcl -L../ytools -L../ysieve" NFS=1[/C]. The small letters came from an extension in my browser (there are also a lot of identifiers that got mixed up on posting). I double checked this in the compilation output and it is fine there. I'll try again using NO_ZLIB.

kruoli 2021-04-21 14:13

Having -DNO_ZLIB or NO_ZLIB=1, it gives:
[CODE]gcc -O3 -march=native -DUSE_AVX2 -DUSE_SSE41 -DUSE_SSE2 -DUSE_NFS -DNO_ZLIB -I../ytools -I../ysieve -Iinclude -Ifactor -Itop/cmdParser -I. -I../gmpecm -I../gmp-6.2.1 -Itop/aprcl -L../ytools -L../ysieve -c -o factor/qs/msieve/lanczos.o factor/qs/msieve/lanczos.c
In file included from include/factor.h:28,
from include/qs_impl.h:23,
from include/lanczos.h:21,
from factor/qs/msieve/lanczos.c:18:
include/msieve_common.h:6: warning: "NO_ZLIB" redefined
#define NO_ZLIB

<command-line>: note: this is the location of the previous definition
In file included from include/factor.h:28,
from include/qs_impl.h:23,
from include/lanczos.h:21,
from factor/qs/msieve/lanczos.c:18:
include/msieve_common.h:35:5: error: unknown type name ‘gzFile’
gzFile* fp;
^~~~~~
In file included from include/qs_impl.h:20,
from include/lanczos.h:21,
from factor/qs/msieve/lanczos.c:18:
include/monty.h:86:19: warning: inline function ‘_umul128’ declared but never defined
__inline uint64_t _umul128(uint64_t x, uint64_t y, uint64_t* hi);
^~~~~~~~
make: *** [Makefile:449: factor/qs/msieve/lanczos.o] Error 1[/CODE]

bsquared 2021-04-21 14:28

Sorry, I meant I build msieve with NO_ZLIB=1.

You might still have to point to a zlib.h. msieve has one; I have this in my makefile
"-I../../msieve/zlib"

kruoli 2021-04-21 14:42

[QUOTE=bsquared;576351]Sorry, I meant I build msieve with NO_ZLIB=1.[/QUOTE]

Blast! You wrote that, I was not paying enough attention. I thought that I already had compiled msieve using that option; to make sure, I just recompiled it and then ran the yafu-compile again. Indeed, some of the errors vanished, so my brain failed me yet again. But there are still a lot of undefined references:
[CODE]/usr/bin/ld: factor/autofactor.o: in function `schedule_work':
autofactor.c:(.text+0x2233): undefined reference to `snfs_find_form'
/usr/bin/ld: autofactor.c:(.text+0x2319): undefined reference to `snfs_find_form'
/usr/bin/ld: autofactor.c:(.text+0x238e): undefined reference to `est_gnfs_size_via_poly'
/usr/bin/ld: factor/autofactor.o: in function `factor':
autofactor.c:(.text+0x4001): undefined reference to `snfs_find_form'
/usr/bin/ld: ./libysiqs.a(SIQS.o): in function `siqs_static_init':
SIQS.c:(.text+0x4e65): undefined reference to `resieve_medprimes_32k_avx2'
/usr/bin/ld: SIQS.c:(.text+0x4e73): undefined reference to `tdiv_medprimes_32k_avx2'
/usr/bin/ld: SIQS.c:(.text+0x4e8f): undefined reference to `med_sieveblock_32k_avx2'
/usr/bin/ld: SIQS.c:(.text+0x4ea7): undefined reference to `nextRoots_32k_avx2'
/usr/bin/ld: SIQS.c:(.text+0x5363): undefined reference to `nextRoots_32k_sse41'
/usr/bin/ld: SIQS.c:(.text+0x5371): undefined reference to `med_sieveblock_32k_sse41'
/usr/bin/ld: ./libynfs.a(snfs.o): in function `snfs_init':
snfs.c:(.text+0xa9): undefined reference to `mpz_polys_init'
/usr/bin/ld: ./libynfs.a(snfs.o): in function `snfs_clear':
snfs.c:(.text+0x145): undefined reference to `mpz_polys_free'
/usr/bin/ld: ./libynfs.a(snfs.o): in function `print_snfs':
snfs.c:(.text+0x76e): undefined reference to `print_poly'
/usr/bin/ld: ./libynfs.a(snfs.o): in function `snfs_test_sieve':
snfs.c:(.text+0x28a7): undefined reference to `IGNORE_NFS_ABORT'
/usr/bin/ld: snfs.c:(.text+0x28b0): undefined reference to `test_sieve'
/usr/bin/ld: snfs.c:(.text+0x28b6): undefined reference to `IGNORE_NFS_ABORT'
/usr/bin/ld: ./libynfs.a(snfs.o): in function `approx_norms':
snfs.c:(.text+0x2e53): undefined reference to `ggnfs_table'
/usr/bin/ld: ./libynfs.a(snfs.o): in function `gen_xyyxf_poly':
snfs.c:(.text+0x3c14): undefined reference to `mpz_polys_free'
/usr/bin/ld: snfs.c:(.text+0x4657): undefined reference to `mpz_polys_free'
/usr/bin/ld: snfs.c:(.text+0x4727): undefined reference to `mpz_polys_free'
/usr/bin/ld: ./libynfs.a(snfs.o): in function `gen_brent_poly':
snfs.c:(.text+0x5e66): undefined reference to `mpz_polys_free'
/usr/bin/ld: snfs.c:(.text+0x5eed): undefined reference to `mpz_polys_free'
/usr/bin/ld: ./libynfs.a(snfs.o):snfs.c:(.text+0x6296): more undefined references to `mpz_polys_free' follow
/usr/bin/ld: ./libynfs.a(snfs.o): in function `skew_snfs_params':
snfs.c:(.text+0x8c1): undefined reference to `get_ggnfs_params'
collect2: error: ld returned 1 exit status
make: *** [Makefile:424: yafu] Error 1[/CODE]

bsquared 2021-04-21 14:50

Ok, no worries. At least now the undefined references are all in yafu.

From your build line earlier it looks like they should be getting included. The best bet in situations like this is to start fresh. Do a make clean [U]with your CFLAGS line included[/U]. You want to make sure all files, including those built only when AVX2 and NFS are enabled, are reset. Then try building yafu again.

kruoli 2021-04-21 15:25

Wonderful, we are getting nearer. :smile: The list of undefined references is getting smaller and smaller:
[CODE]gcc -O3 -march=native -DUSE_AVX2 -DUSE_SSE41 -DUSE_SSE2 -DUSE_NFS -I../ytools -I../ysieve -Iinclude -Ifactor -Itop/cmdParser -I. -I../gmpecm -I../gmp-6.2.1 -Itop/aprcl -L../ytools -L../ysieve top/driver.o top/test.o factor/tune.o factor/autofactor.o top/cmdParser/cmdOptions.o top/cmdParser/calc.o -o yafu -lysiqs -lyecm -lynfs -L../../ysieve.git/trunk -L../../ytools.git/trunk -L. -L../gmp/lib/ -L../gmp-ecm/lib/ -L../msieve-1.53 -lmsieve ../gmpecm/.libs/libecm.a ../gmp-6.2.1/.libs/libgmp.a -lytools -lysieve -lpthread -lm -ldl
/usr/bin/ld: ./libysiqs.a(SIQS.o): in function `siqs_static_init':
SIQS.c:(.text+0x4e65): undefined reference to `resieve_medprimes_32k_avx2'
/usr/bin/ld: SIQS.c:(.text+0x4e73): undefined reference to `tdiv_medprimes_32k_avx2'
/usr/bin/ld: SIQS.c:(.text+0x4e8f): undefined reference to `med_sieveblock_32k_avx2'
/usr/bin/ld: SIQS.c:(.text+0x4ea7): undefined reference to `nextRoots_32k_avx2'
/usr/bin/ld: SIQS.c:(.text+0x5363): undefined reference to `nextRoots_32k_sse41'
/usr/bin/ld: SIQS.c:(.text+0x5371): undefined reference to `med_sieveblock_32k_sse41'
collect2: error: ld returned 1 exit status
make: *** [Makefile:424: yafu] Error 1[/CODE]
I cleaned (with the flags included), built, cleaned again the same way, and built again, but that did not improve the results further.

bsquared 2021-04-21 15:49

Ah, I see why now.

I set up the makefile to build certain files conditionally. So when you set CFLAGS directly, that indicates that you have AVX2, but the AVX2-enabled files are not conditionally included.

Change your build line to
make yafu USE_AVX2=1 NFS=1 CC=gcc CFLAGS=...

The USE_AVX2=1 option to make will compile the needed files and also add the -DUSE_AVX2 and -DUSE_SSE41 identifiers to CFLAGS, so you can leave them out of your CFLAGS line. Also NFS=1 adds the -DUSE_NFS line, so you can leave that out of your CFLAGS line as well.

Sorry for the confusion, hope that helps.

kruoli 2021-04-21 16:06

Magnificent! :smile:

Now I have a functioning YAFU binary; thank you very much for the personal help.

I altered the make command as you suggested, but had to leave the explicit -D.. flags in the CFLAGS argument for some reason. Without them, there were errors. I also tried specifying CFLAGS before and after USE_AVX2=1, but still it could not find some things. So after I had -DUSE_AVX2 plus USE_AVX=1 (etc.), it worked.

bsquared 2021-04-21 17:14

[QUOTE=kruoli;576377]Magnificent! :smile:

Now I have a functioning YAFU binary; thank you very much for the personal help.

I altered the make command as you suggested, but had to leave the explicit -D.. flags in the CFLAGS argument for some reason. Without them, there were errors. I also tried specifying CFLAGS before and after USE_AVX2=1, but still it could not find some things. So after I had -DUSE_AVX2 plus USE_AVX=1 (etc.), it worked.[/QUOTE]

You're welcome!

I think what happened is that when you put a CFLAGS line as an input to make, it must ignore any CFLAGS stuff that happens in the makefile. Command line takes precedence, I guess. If you were to build without any CFLAGS input line, then I think my method would also work (That's how I build it.... just "make yafu NFS=1 USE_AVX2=1") You are not doing anything wrong; glad you found something that works.

If you don't mind sharing - what is your cpu? Just curious if you could try any of the AVX-512 code.


All times are UTC. The time now is 13:37.

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