From Deac Wiki
Jump to navigation Jump to search

OpenPFGW is software that is designed to perform PRP and primality tests on numbers of specific forms. It must be downloaded, compiled, and run from user home directories.

Compilation Instructions


First, create a directory for the downloads and compilations:

    mkdir ~/Src/

and cd into that directory

    cd ~/Src/

Move all downloads described below into this directory.


  • openpfgw.tar.gz
  • gmp
  • gwnum


  • Download the source package from - example uses: gmp-5.0.2.tar.bz2
  • Expand the package:
    tar jxf gmp-5.0.2.tar.bz2
  • This creates the directory gmp-5.0.2 -- cd into it:
    cd gmp-5.0.2
  • Do a standard configure and make, setting the installation to your home directory:
    ./configure --prefix=$HOME --enable-cxx
    make >& Make.out 
  • Wait for the make to complete, and then run the provided tests and make sure all are passed:
    make check >& Make.check.out 
  • View the file Make.check.out and look for lines which say something like "All 30 tests passed".
  • Install the package:
    make install


GWNUM is part of the GIMPS package.

  • Create a subdirectory under Src for the GIMPS package:
    mkdir ~/Src/gimps
    mv ~/Src/gimps
    cd ~/Src/gimps
  • Expand the archive, and cd into the gwnum directory:
    cd gwnum
  • Modify the gwnum makefile ~/Src/gimps/gwnum/make64 so that the CFLAGS and CPPFLAGS lines look like the following:
    CFLAGS = -I.. -DX86_64 -O2 -m64 -march=k8 -mtune=k8
    CPPFLAGS = -I.. -I../qd -DX86_64 -O2 -m64 -march=k8 -mtune=k8
  • Build the package:
    make -f make64


  • Download the source code:
    cd ~/Src/
    svn co openpfgw
  • Copy the appropriate files from GMP and GWNUM into the appropriate directories in openpfgw
  • GMP:
    cp ~/lib/libgmp*.a ~/Src/openpfgw/packages/gmp/64bit
    cp ~/include/gmp*.h ~/Src/openpfgw/packages/gmp/64bit
  • GWNUM:
    cp ~/Src/gimps/gwnum/gwnum.a ~/Src/openpfgw/packages/gwnum/64bit
    cp ~/Src/gimps/gwnum/*.h ~/Src/openpfgw/packages/gwnum/64bit
  • Edit the file ~/Src/openpfgw/ to add a PFGWSRC line, and so that the CFLAGS and CXXFLAGS lines look like this:
    IS64 = 1
    ifeq ($(IS64),1)
    CFLAGS = -O2 -m64 -march=k8 -mtune=k8 -DX86_64 -D_64BIT -I../../packages/gmp/64bit -I${PFGWSRC}/pfconfig/headers
    CXXFLAGS = -O2 -m64 -march=k8 -mtune=k8 -DX86_64 -D_64BIT  -I../../packages/gmp/64bit -I${PFGWSRC}/pfconfig/headers
    ifeq ($(IS64),0)
    CFLAGS  = -O2 -malign-double -m32 -I../../packages/gmp/32bit
    CXXFLAGS    = -O2 -malign-double -m32 -I../../packages/gmp/32bit
  • cd into the openpfgw directory:
    cd ~/Src/openpfgw
  • Edit all the following pform makefiles, and remove the line that says "include deps.d" (this is usually the last line in the files):
  • Create all the submakefiles for the prmsieve subproject. For each of the following MODULEs -- erat, atkins, compress, tables, arith -- do:
    cd pform/prmsieve/MODULE
    sh configure
    cd ../..
  • Edit the main pfgw makefile, and add "-lpthread -lstdc++" to the pfgw64 rule (the bits in bold below):
    pfgw64: baselib integer fft glue pfoo io entrypoint prmsieve
        ${CXX} ${CXXFLAGS}  \
            pform/pfgw/.libs/pfgw_main.a  pform/pfio/.libs/pfio.a pform/pfoo/.libs/pfoo.a pform/pfglue/.libs/pfglue.a pform/pfgwlib/.libs/pfgwlib.a \
            pform/pfmath/.libs/pfmath.a pform/pflib/.libs/pflib.a pform/prmsieve/.libs/prmsieve.a packages/gmp/64bit/libgmp.a \
            packages/gwnum/64bit/gwnum.a  -o pfgw64 -lpthread -lstdc++
  • Build pfgw64:
    make pfgw64

That process creates the executable pfgw64.

External Links