mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Linux (https://www.mersenneforum.org/forumdisplay.php?f=39)
-   -   Compile Linux version for PFGW (https://www.mersenneforum.org/showthread.php?t=22018)

nordi 2017-02-08 23:55

@paulunderwood: I worked around the -lgcc_s problem you had. Remove the " -Wl,-no_pie" option from the makefile. It seems "ld" only has "-pie", not "-no_pie".

nordi 2017-02-09 00:59

I have a pretty well-automated version now: To build PFGW with Docker, get and extract the sources of PFGW. In the directory with the sources, create a Dockerfile with this content:
[CODE]FROM gcc
RUN apt-get update && apt-get install -y libgmp-dev wget unzip

RUN mkdir /usr/src/mprime && \
cd /usr/src/mprime && \
# openpfgw insists on version 28.6
wget -O mprime.zip --quiet https://www.mersenne.org/ftp_root/gimps/p95v286.source.zip && \
# unzip produces some warnings and therefore has exit code 1.
unzip mprime.zip ; \
rm mprime.zip
RUN cd /usr/src/mprime/gwnum && \
make -j -f make64

COPY . /usr/src/openpfgw
WORKDIR /usr/src/openpfgw
RUN cp /usr/lib/x86_64-linux-gnu/libgmp.a packages/gmp/64bit/
RUN cp /usr/src/mprime/gwnum/gwnum.a packages/gwnum/64bit/gwnum.a
RUN sed -i 's/-Wl,-no_pie//g' makefile

RUN make -j
[/CODE]Run "docker build -t pfgw ." (mind the dot at the end) to build a new image. Then "docker run -it pfgw" to start a container with that image. The executable is at /usr/src/openpfgw/pfgw64 and it actually works.

This assumes "#include <ctype.h>" fix to PFGW is already applied.

paulunderwood 2017-02-09 01:59

Thanks for the tips, nordi :tu:

Incidentally, I added [c]gwset_num_threads ( &gwdata, 4 );[/c] to every line with [c]gwinit2(&gwdata, sizeof(gwhandle), (char *) GWNUM_VERSION);[/c] and got a multi-threaded PFGW working at 300% on my Haswell 4770k. Good for speedy proofs, but not so good for overall number-crunching throughput :smile:

henryzz 2017-02-09 11:31

[QUOTE=paulunderwood;452579]Thanks for the tips, nordi :tu:

Incidentally, I added [c]gwset_num_threads ( &gwdata, 4 );[/c] to every line with [c]gwinit2(&gwdata, sizeof(gwhandle), (char *) GWNUM_VERSION);[/c] and got a multi-threaded PFGW working at 300% on my Haswell 4770k. Good for speedy proofs, but not so good for overall number-crunching throughput :smile:[/QUOTE]
It is more efficient the larger the FFT. There would be people using it if this feature was added to the main source. Please do rouge.
A larger fft can fit in the L3 cache with 1x4threads than 4x1threads

bur 2021-09-01 11:20

I tried compiling the sources from sourceforge, but get the following error:
[CODE]g++: error: packages/gwnum/64bit/gwnum.a: File or directory not found
make: *** [makefile:8: pfgw64] Error 1[/CODE]
The gwnum/64bit/ directory is indeed empty. Any idea how to get it to compile? Or is it unnceccessary anyway and I should just use the precompiled binaries? I have an i9-10900k.

rogue 2021-09-01 12:44

[QUOTE=bur;586976]I tried compiling the sources from sourceforge, but get the following error:
[CODE]g++: error: packages/gwnum/64bit/gwnum.a: File or directory not found
make: *** [makefile:8: pfgw64] Error 1[/CODE]
The gwnum/64bit/ directory is indeed empty. Any idea how to get it to compile? Or is it unnceccessary anyway and I should just use the precompiled binaries? I have an i9-10900k.[/QUOTE]

You have to d/l gwnum separately. This is part of Prime95, so d/l the Prime95 source. You will likely need to build the 64-bit Linux version of gwnum.a (if it isn't included) then copy to the directory specified above. There should be a linux makefile in the Prime95 sources.

Prime95 2021-09-01 17:13

[QUOTE=rogue;586983]You have to d/l gwnum separately. This is part of Prime95, so d/l the Prime95 source. You will likely need to build the 64-bit Linux version of gwnum.a (if it isn't included) then copy to the directory specified above. There should be a linux makefile in the Prime95 sources.[/QUOTE]

In the gwnum directory, type "make -f make64"

bur 2021-09-02 06:08

Ok, thanks, it worked.

Are there any flags I could use to optimize e.g. for avx2? The makefile didn't look like it, but I'm far from being an expert there.

rogue 2021-09-02 16:22

[QUOTE=bur;587042]Ok, thanks, it worked.

Are there any flags I could use to optimize e.g. for avx2? The makefile didn't look like it, but I'm far from being an expert there.[/QUOTE]

No. gwnum will choose the best FFT based upon the available hardware. If the best FFT uses AVX2, then it will use that FFT. If AVX2 is not available, then any FFT that requires AVX2 will not be used.

MJansen 2021-10-30 11:38

Hi I am looking for some help:

I have been using Ubuntu for a short while now and am not that advanced a user. I have been trying to get pfgw64 running and I succeeded in getting the source files from pfgw64 unzipped in the right place under Ubuntu, as well as GMP and Gwnum.

I found some links as to getting it running, but I guess the main find was an older website, since most of the suggested changes did not make a difference ([url]https://wiki.deac.wfu.edu/user/Software:OpenPFGW[/url]).

Running the make -f makefile command gives me the following error that I cannot fix myself:
[QUOTE]
~/Src/openpfgw$ make -f makefile
make -C pform/pflib
make[1]: Entering directory '/home/mydir/Src/openpfgw/pform/pflib'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/mydir/Src/openpfgw/pform/pflib'
make -C pform/pfmath
...
more of entering, nothing to be done, leaving messages
...
make[1]: Entering directory '/home/mydir/Src/openpfgw/pform/primesieve'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/mydir/Src/openpfgw/pform/primesieve'
g++ \
pform/pfgw/.libs/pfgw_main.a pform/pfio/.libs/pfio.a pform/pfoo/.libs/pfoo.a pform/pfgwlib/.libs/pfgwlib.a \
pform/pfmath/.libs/pfmath.a pform/pflib/.libs/pflib.a pform/primesieve/.libs/primesieve.a \
packages/gmp/64bit/libgmp.a packages/gwnum/64bit/gwnum.a -o pfgw64 -lpthread -lstdc++
/usr/bin/ld: pform/pfgw/.libs/pfgw_main.a(gw_prp.o): in function `bench_gwPRP(Integer*, unsigned int)':
gw_prp.cpp:(.text+0x471): undefined reference to `gwsquare2'
/usr/bin/ld: gw_prp.cpp:(.text+0x4b6): undefined reference to `gwsquare2_carefully'
/usr/bin/ld: pform/pfgw/.libs/pfgw_main.a(gw_prp.o): in function `prp_using_gwnum(Integer*, unsigned int, char const*, unsigned long*, int)':
gw_prp.cpp:(.text+0x702): undefined reference to `gwstartnextfft'
/usr/bin/ld: gw_prp.cpp:(.text+0x747): undefined reference to `gwsquare2'
/usr/bin/ld: gw_prp.cpp:(.text+0x909): undefined reference to `gwstartnextfft'
/usr/bin/ld: gw_prp.cpp:(.text+0x929): undefined reference to `gwsquare2_carefully'
/usr/bin/ld: pform/pfgw/.libs/pfgw_main.a(gf_factorize.o): in function `GFNDivisibilityTest(char const*, Integer*, char const*, Integer, int, int, int, int, Integer*)':
gf_factorize.cpp:(.text+0x139): undefined reference to `gwsquare2'
/usr/bin/ld: gf_factorize.cpp:(.text+0x214): undefined reference to `gwsquare2_carefully'
/usr/bin/ld: pform/pfio/.libs/pfio.a(pfscriptfns.o): in function `PFScriptFile::GWPowMod(Integer*, Integer, Integer, Integer, char*)':
pfscriptfns.cpp:(.text+0x464e): undefined reference to `gwmul'
/usr/bin/ld: pfscriptfns.cpp:(.text+0x46c7): undefined reference to `gwsquare2'
/usr/bin/ld: pfscriptfns.cpp:(.text+0x4726): undefined reference to `gwsquare2_carefully'
/usr/bin/ld: pfscriptfns.cpp:(.text+0x4748): undefined reference to `gwmul_carefully'
/usr/bin/ld: pform/pfoo/.libs/pfoo.a(algebra.o): in function `IntegerMultiplier::squaremulInteger(GWInteger&, int, int)':

... cut short
[/QUOTE]

So I guess the crux is in this: undefined reference to `gwsquare2', but where is this function and how do I get this function to be seen?

Kind regards
Michiel Jansen

paulunderwood 2021-10-30 12:56

i have just downloaded the latest OpenPFGW from sourceforge and it compiled for me straight way, although I did not put libgmp.a and gwnum.a in place so it did not complete.

I get:

[code]
g++: error: packages/gmp/64bit/libgmp.a: No such file or directory
g++: error: packages/gwnum/64bit/gwnum.a: No such file or directory
[/code]

which can be remedied by compiling gmp and mprime, and putting libgmp,a and gwnum.a in the right directories. :smile:


All times are UTC. The time now is 22:15.

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