mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   EdH (https://www.mersenneforum.org/forumdisplay.php?f=152)
-   -   How I install YAFU onto my Ubuntu Machines (https://www.mersenneforum.org/showthread.php?t=23087)

EdH 2018-02-24 01:53

How I install YAFU 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* YAFU 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 YAFU package only. The binary will have to be called using its respective path.

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:

[URL="http://www.mersenneforum.org/showthread.php?p=480597"] How I Install GMP onto my Ubuntu Machines[/URL]
,
[URL="http://www.mersenneforum.org/showthread.php?p=480608"] How I Install GMP-ECM onto my Ubuntu Machines[/URL]
,
[URL="http://www.mersenneforum.org/showthread.php?t=23085"]How I Install msieve onto my Ubuntu Machines[/URL]
and
[URL="https://www.mersenneforum.org/showthread.php?t=23081"]How I Install ggnfs onto my Ubuntu Machines[/URL] (This is optional to compiling YAFU, but sievers are necessary to run NFS routines.)


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
[/code]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 subversion
[/code]Accept the prompt.

[B]Special Note on the following procedure(s):[/B] There are two branches available for YAFU. The "wip" branch and the "trunk" branch. The wip branch is the development branch and has all the latest work. This is the branch you should use if you want to stay at the leading edge of YAFU. However, if you have troubles with the installation, or just want a stable running package, you should use the trunk branch. I will note any differences in the installation steps with [B]wip/trunk[/B] designations.

To download the "[B]wip[/B]" YAFU package:
[code]
svn co https://svn.code.sf.net/p/yafu/code/branches/wip $HOME/Math/yafu
[/code]To download the "[B]trunk[/B]" YAFU package:
[code]
svn co https://svn.code.sf.net/p/yafu/code/trunk $HOME/Math/yafu
[/code]Move into the yafu folder:
[code]
cd Math/yafu
[/code]Using a text editor, open the Makefile file and make the following edits:
[code]
. . .
[B]#CC = gcc-7.3.0[/B] (This edit is only needed in the "wip" Makefile.)
. . .

ifeq ($(NFS),1)
CFLAGS += -DUSE_NFS
# modify the following line for your particular msieve installation

ifeq ($(MIC),1)
LIBS += -L../msieve/lib/phi
else
[B]LIBS += -L../msieve[/B]
endif
LIBS += -lmsieve
endif
[/code]Save and close Makefile.

Run the following in your terminal:
[code]
lscpu
[/code]See how many CPU(s) are reported and then look for sse4_1 and avx2 in the Flags listing.

Run the following in your terminal:
[code]
echo $HOME
[/code]Run the following in your terminal:
[code]
which ecm
[/code]You should see:
[code]
/usr/local/bin/ecm
[/code]Open the yafu.ini file and modify the following lines:
[code]
threads=<# of CPUs reported above>
ggnfs_dir=<$HOME string returned>/Math/ggnfs/bin/
ecm_path=/usr/local/bin/ecm
[/code]Save and close yafu.ini

For the "[B]wip[/B]" version, run the following in the terminal:
[code]
make NFS=1
[/code]or
[code]
make NFS=1 USE_SSE41=1
[/code]or
[code]
make NFS=1 USE_AVX2=1
[/code]or
[code]
make NFS=1 USE_SSE41=1 USE_AVX2=1
[/code]depending on the flags reported above.

For the "[B]trunk[/B]" version, run the following in the terminal:
[code]
make x86_64 NFS=1
[/code]or
[code]
make x86_64 NFS=1 USE_SSE41=1
[/code]or
[code]
make x86_64 NFS=1 USE_AVX2=1
[/code]or
[code]
make x86_64 NFS=1 USE_SSE41=1 USE_AVX2=1
[/code]depending on the flags reported above.

Test your installation and calculate tune data with the following command:
[code]
./yafu "tune"
[/code]Return to your home directory:
[code]
cd ~/
[/code]

bsquared 2018-02-24 02:01

[QUOTE=EdH;480734]
Run the following in the terminal:
[code]
make NFS=1
[/code]or
[code]
make NFS=1 USE_SSE41=1
[/code]depending on whether the flag was reported above.

[/QUOTE]

or
[code]
make NFS=1 USE_AVX2=1
[/code]depending on whether the flag was reported above.

This helps quite a bit for siqs on supported cpus.

EdH 2018-02-24 05:14

Excellent! Thank you B[SUP]2[/SUP].

Are sse4_1 and avx2 mutually exclusive?

uglyb 2018-04-14 21:49

What's about [B]ggnfs[/B]? Does yafu need it?

LaurV 2018-04-21 09:34

Yes, if you want to factor anything over 110 digits, you will need external ggnfs and path to it in yafu ini

MisterBitcoin 2018-04-28 18:12

Invalid option "B1pm1" while starting "tune".

Looks like somethink went wrong. After several hours following your posts.
At least GMP, ECM and msieve worked.



Any idea how I can fix that issue, so that yafu will work on my server?

EdH 2018-04-29 03:39

[QUOTE=MisterBitcoin;486491]Invalid option "B1pm1" while starting "tune".

Looks like somethink went wrong. After several hours following your posts.
At least GMP, ECM and msieve worked.



Any idea how I can fix that issue, so that yafu will work on my server?[/QUOTE]
Try the following:
[code]
$ which ecm
[/code]and make sure you get the line:
[code]
ecm: /usr/local/bin/ecm
[/code]This ensures it was installed to that location.

(If you get a different location, try that in your yafu.ini file in the next step.)

Next, make sure your yafu.ini file has the following line:
[code]
ecm_path=/usr/local/bin/ecm
[/code]On Debian I don't have sudo set, so I have to go into root mode via su to use make install with GMP and ECM, whereas in Ubuntu, I use sudo make install:

Debian:
[code]
$ make
$ make check
$ su
Password: **************
# make install
exit
$
[/code]Ubuntu:
[code]
$ make
$ make check
$ sudo make install
[sudo] password for user: **************
$
[/code]YAFU will do some ECM without the correct path in the ini file, but it

MisterBitcoin 2018-04-29 08:49

I´ve restarted the process but still got the same result.
ECM is in the correct path, same as ggnfs.



This what I see when I open yafu.ini.

[CODE]B1pm1=100000
B1pp1=20000
B1ecm=11000
rhomax=1000
threads=4
pretest_ratio=0.25
%ggnfs_dir=..\ggnfs-bin\Win32\
ggnfs_dir=/home/user/Math/ggnfs/bin/
%ggnfs_dir=../../ggnfs-bin/
%ecm_path=..\gmp-ecm\build.vc10\x64\Release\ecm.exe
ecm_path=/usr/local/bin/ecm[/CODE]


At least I´m happy that ggnfs went fine without problems. :smile:

bsquared 2018-04-29 15:56

[QUOTE=MisterBitcoin;486491]Invalid option "B1pm1" while starting "tune".

Looks like somethink went wrong. After several hours following your posts.
At least GMP, ECM and msieve worked.



Any idea how I can fix that issue, so that yafu will work on my server?[/QUOTE]

Is this yafu's tune that it's having problems with? That's something I haven't seen before, but, tune is optional. Just omit that step and see if you can run ecm curves with yafu.

./yafu "ecm(rsa(256),100)" -v -threads 2 -B1ecm 1000000

MisterBitcoin 2018-04-29 20:48

[QUOTE=bsquared;486579]Is this yafu's tune that it's having problems with? That's something I haven't seen before, but, tune is optional. Just omit that step and see if you can run ecm curves with yafu.

./yafu "ecm(rsa(256),100)" -v -threads 2 -B1ecm 1000000[/QUOTE]


Same result.

EdH 2018-04-30 03:17

The next thing I would try is to use the trunk version of YAFU:

First, rename your current yafu directory to yafu-orig:
[code]
mv ~/Math/yafu ~/Math/yafu-orig
[/code]Next, checkout the code/trunk versin of YAFU:
[code]
svn co https://svn.code.sf.net/p/yafu/code/trunk $HOME/Math/yafu
[/code]Next, move into the Math/yafu directory and edit the Makefile:

Change:
[code]
else
OBJ_EXT = .o

INC += -I../gmp/include
LIBS += -L../gmp/lib/linux/x86_64

INC += -I../gmp-ecm/include/linux
LIBS += -L../gmp-ecm/lib/linux/x86_64
[/code]To:
[code]
else
OBJ_EXT = .o

INC += -I[B]/usr/local/lib/[/B]
LIBS += -L[B]/usr/local/lib/[/B]

[B]#[/B]INC += -I../gmp-ecm/include/linux
[B]#[/B]LIBS += -L../gmp-ecm/lib/linux/x86_64
[/code]Next, change the msieve reference:
[code]
# modify the following line for your particular msieve installation

ifeq ($(MIC),1)
LIBS += -L../msieve/lib/phi
else
LIBS += -L../[B]msieve[/B]
endif
LIBS += -lmsieve
-L../msieve[/code]Now, save and close Makefile and copy your modified yafu.ini from yafu-orig into yafu, replacing the current one:
[code]
cp ~/Math/yafu-orig/yafu.ini ~/Math/yafu/yafu.ini
[/code]Check for sse4_1 and avx2:
[code]
cat /proc/cpuinfo
[/code]Next, compile yafu:
[code]
make x86_64 NFS=1 USE_SSE41=1 USE_AVX2=1
[/code]depending on the available functions.

And, finally test:
[code]
./yafu "tune"
[/code]


All times are UTC. The time now is 03:01.

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