mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Blogorrhea > EdH

Reply
 
Thread Tools
Old 2018-02-22, 03:31   #1
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

3,253 Posts
Default How I Install ggnfs onto my Ubuntu Machines

(Note: I expect to keep the first post of each of these "How I Install..." threads up-to-date with the latest version. Please read the rest of each thread to see what may have led to the current set of instructions.)

This thread will explain the steps I use to install* ggnfs onto a computer which is already running Ubuntu. This procedure should work for other linux distributions as well but the only other one I've currently tested is Debain.

*In this instance "install" is referring to the acquiring and compilation of the ggnfs package only. The binaries will have to be called using their respective paths.

I will expect the user of these steps to be able to use the sudo command.

I will use a directory called Math for these installations. You may elect to replace "Math" with your own choice.

These instructions can be used as a reference only, if you want, but I will provide specifics that work for me. If you follow these steps as I provide them, you should end up with a working installation.

First, follow the procedures in:

How I Install GMP on my Ubuntu Machines
and
How I Install GMP-ECM on my Ubuntu Machines

or, install GMP and ECM from the repositories. If you use the repositories, check to see if ECM is called ecm or gmp-ecm. You can try:
Code:
which ecm
If it returns something like /usr/local/bin/ecm, then it is called ecm.

In the case of the ggnfs sievers, you don't need to perform the following step if you are planning to use the already available binaries referenced below. I would, however, create a folder named ggnfs within the Math folder and then a bin folder within the ggnfs folder, in which to place the binaries. If you do perform the next two steps, the folders will be created.

If you have already installed the following packages, you can skip the next two steps, although performing them wouldn't hurt anything.

Open a terminal and Enter:
Code:
sudo apt-get update
You should be prompted for your password. This prompt should only appear once for your terminal session, unless you leave it idle for a long time.

After the update completes and the user prompt reappears, type:
Code:
sudo apt-get install g++ m4 zlib1g-dev make p7zip
Accept the prompt.

(optional) Go to the following link:

(optional) GPL Number Field Sieve implementation

(optional) Click on Clone or download and choose Download ZIP. Move the ggnfs-master.zip file to your Math folder.

Go to the following link:

Download B2 Sievers

Download the attachment and place it in the Math folder.

If you have downloaded the ggnfs-master.zip file, at this point extract the folder into the Math folder and rename it to ggnfs.

Finally, for now, extract the lasieve4_64.7z files into the Math/ggnfs/bin folder.

Using the files window, select all six sievers that you extracted and right click on them. Choose Properties->Permissions and look for the "Allow executing files as program" checkbox. Click this until a checkmark is displayed. (It usually takes two clicks if doing all sievers at once.)

At this point, you should have a pretty good working version of the ggnfs package for all your sieving needs. However, if you want to get a little bit better, you can compile a set of sievers adjusted for your particular hardware. Here's what you do:

In a terminal move into the appropriate folder:
Code:
cd ~/Math/ggnfs/src/experimental/lasieve4_64
Apply the following patches to the appropriate files within the athlon64 folder:
Code:
Index: athlon64/mpqs_td.asm
===================================================================
--- athlon64/mpqs_td.asm    (revision 441)
+++ athlon64/mpqs_td.asm    (working copy)
@@ -290,7 +290,7 @@
     mull %ecx
     testl %edx,%edx
     jnz tdloop
-    cmpw $27,nr
+    cmpw $27,nrw
     jnc gotonext
     movl aux4d,%eax
     movw aux5w,10(relptr,nr,2)
@@ -321,10 +321,10 @@
     mull %ecx
     testl %edx,%edx
     jnz tdloopk
-    cmpw $27,nr
+    cmpw $27,nrw
     jnc gotonext
     movl aux4d,%eax
-    movw nr1,10(relptr,nr,2)
+    movw nr1w,10(relptr,nr,2)
     incq nr
     movl aux4d,qxd
     jmp divloopk
@@ -354,7 +354,7 @@
     testl %edx,%edx
     jnz tdloopa
     movl aux4d,%eax
-    cmpw $27,nr
+    cmpw $27,nrw
     jnc gotonext
     addw nr1w,aux5w
     movw aux5w,10(relptr,nr,2)
Index: athlon64/tdslinie.asm
===================================================================
--- athlon64/tdslinie.asm    (revision 441)
+++ athlon64/tdslinie.asm    (working copy)
@@ -10,6 +10,7 @@
 define(sieve_ptr,%r8)dnl
 define(sieve_ptr_ub,%r9)dnl
 define(root,%r10)dnl
+define(rootw,%r10w)dnl
 define(prime,%r11)dnl
 define(prime32,%r11d)dnl
 define(sv0,%al)dnl
@@ -115,7 +116,7 @@
 tdslinie_next_j`'i:
 ')
     cmpq aux_ptr,aux_ptr_ub
-    movw root,root_src
+    movw rootw,root_src
     leaq 8(aux_ptr),aux_ptr
     ja tdslinie_fbi_loop
 tdslinie_ende:
Index: athlon64/tdslinie1.asm
===================================================================
--- athlon64/tdslinie1.asm    (revision 441)
+++ athlon64/tdslinie1.asm    (working copy)
@@ -10,6 +10,7 @@
 define(sieve_ptr,%r8)dnl
 define(sieve_ptr_ub,%r9)dnl
 define(root,%r10)dnl
+define(rootw,%r10w)dnl
 define(prime,%r11)dnl
 define(prime32,%r11d)dnl
 define(sv0,%al)dnl
@@ -58,7 +59,7 @@
     jnz tdslinie1_suche
 tdslinie1_nextfbi:
     cmpq aux_ptr,aux_ptr_ub
-    movw root,root_src
+    movw rootw,root_src
     leaq 8(aux_ptr),aux_ptr
     ja tdslinie1_fbi_loop
 tdslinie1_ende:
Index: athlon64/tdslinie2.asm
===================================================================
--- athlon64/tdslinie2.asm    (revision 441)
+++ athlon64/tdslinie2.asm    (working copy)
@@ -10,6 +10,7 @@
 define(sieve_ptr,%r8)dnl
 define(sieve_ptr_ub,%r9)dnl
 define(root,%r10)dnl
+define(rootw,%r10w)dnl
 define(prime,%r11)dnl
 define(prime32,%r11d)dnl
 define(sv0,%al)dnl
@@ -57,7 +58,7 @@
     jnz tdslinie2_suche
 tdslinie2_next_fbi:
     cmpq aux_ptr,aux_ptr_ub
-    movw root,root_src
+    movw rootw,root_src
     leaq 8(aux_ptr),aux_ptr
     ja tdslinie2_fbi_loop
 tdslinie2_ende:
Index: athlon64/tdslinie3.asm
===================================================================
--- athlon64/tdslinie3.asm    (revision 441)
+++ athlon64/tdslinie3.asm    (working copy)
@@ -7,6 +7,7 @@
 define(sieve_ptr,%r8)dnl
 define(sieve_ptr_ub,%r9)dnl
 define(root,%r10)dnl
+define(rootw,%r10w)dnl
 define(prime,%r11)dnl
 define(prime32,%r11d)dnl
 define(sv0,%al)dnl
@@ -73,7 +74,7 @@
 tdslinie3_next_j`'i:
 ')
     cmpq aux_ptr,aux_ptr_ub
-    movw root,root_src
+    movw rootw,root_src
     leaq 8(aux_ptr),aux_ptr
     ja tdslinie3_fbi_loop
 tdslinie3_ende:
Edit the Makefiles within the lasieve4_64 and athlon64 folders to change four k8s to native:
Code:
...
CFLAGS=-O3 -march=k8 -mtune=k8 -funroll-loops
...
to
Code:
...
CFLAGS=-O3 -march=native -mtune=native -funroll-loops
...
and
Code:
...
CFLAGS= -O3 -march=k8 -mtune=k8 -I.
...
to
Code:
...
CFLAGS= -O3 -march=native -mtune=native -I.
...
Open the INSTALL file within the lasieve4_64 folder and perform its set of instructions:
Code:
cd athlon64
make liblasieve.a
make liblasieveI11.a
make liblasieveI12.a
make liblasieveI13.a
make liblasieveI14.a
make liblasieveI15.a
make liblasieveI16.a
cp *.a ..
cd ..
ln -s athlon64 asm
make
Watch each command to see if any errors appear. When the last make completes you will have the following sievers in the lasieve4_64 folder:
Code:
gnfs-lasieve4I11e
gnfs-lasieve4I12e
gnfs-lasieve4I13e
gnfs-lasieve4I14e
gnfs-lasieve4I15e
gnfs-lasieve4I16e
Copy or move the above six files into your Math/ggnfs/bin folder, replacing the bsquared sievers, if necessary.

Now, it might be a good idea to test them and see if they run:. In a terminal, move to the Math/ggnfs/bin folder:
Code:
cd ~/Math/ggnfs/bin
Create a sub-folder named testing:
Code:
mkdir testing
Change to the testing folder:
Code:
cd testing
Open a new file named testPoly using gedit:
Code:
gedit testPoly
Copy the following polynomial lines into the testPoly file:
Code:
n: 43715356796662829480745706047096704236720281338579999122488910362081610277175300878318314702043387129927
c4: 72
c3: 4312584054
c2: -8166581306957591
c1: -129446911934909498991070
c0: 170042303764543493053291724775
Y1: 38904204455749
Y0: -27913630115707931572790246
skew: 9145923.32
rlim: 2300000
alim: 1149999
lpbr: 26
lpba: 26
mfbr: 49
mfba: 49
rlambda: 2.6
alambda: 2.6
q0: 2300000
qintsize: 2500
#q1:1152500
#lasieve4I12e
Save and close the gedit window and on the command line enter:
Code:
../gnfs-lasieve4I12e -a -v -o testRels testPoly
You should see the following:
Code:
gnfs-lasieve4I12e (with asm64): L1_BITS=15, SVN $Revision$
FBsize 89232+0 (deg 4), 169510+0 (deg 1)
total yield: 9851, q=2301199 (0.00376 sec/rel)
with the numbers increasing. Eventually you will see the completion:
Code:
total yield: 17861, q=2302511 (0.00375 sec/rel) 
172 Special q, 264 reduction iterations
reports: 62453230->7087009->6511990->2180263->1522185->903714
Number of relations with k rational and l algebraic primes for (k,l)=:

Total yield: 17861
0/0 mpqs failures, 3273/1395 vain mpqs
milliseconds total: Sieve 18036 Sched 0 medsched 12013
TD 19677 (Init 1698, MPQS 6284) Sieve-Change 17330
TD side 0: init/small/medium/large/search: 488 1530 688 768 3617
sieve: init/small/medium/large/search: 944 4403 607 2354 1140
TD side 1: init/small/medium/large/search: 159 1174 630 794 1734
sieve: init/small/medium/large/search: 517 2780 597 2400 2294

Last fiddled with by EdH on 2019-09-15 at 15:24
EdH is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
How I install YAFU onto my Ubuntu Machines EdH EdH 88 2020-07-01 21:20
How I Install CADO-NFS onto my Ubuntu Machines EdH EdH 3 2019-06-24 03:42
How I Install GMP-ECM onto my Ubuntu Machines EdH EdH 12 2019-04-16 09:28
How I Install msieve onto my Ubuntu Machines EdH EdH 0 2018-02-23 14:43
How I Install GMP onto my Ubuntu Machines EdH EdH 0 2018-02-21 23:48

All times are UTC. The time now is 05:31.

Tue Aug 4 05:31:04 UTC 2020 up 18 days, 1:17, 0 users, load averages: 0.94, 1.11, 1.23

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

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.