Steps to install and set up Aliqueit on an Ubuntu* computer
(including gmp, ecm, ggnfs, msieve, YAFU, Aliqueit)
Last update: 11 Dec 2012 for 32-bit / 4 Dec 2016 for 64-bit
The updated information for these steps is now located in a set of pages at How I Install...
*These steps will work with both 32-bit and 64-bit systems and other distributions as well as Ubuntu, but there may be differences such as installation locations, etc. for other distributions. Therefore, the steps on this page are specifically tailored toward Ubuntu.
Although this is intended to be the steps to create a working version of Aliqueit, it is in fact steps to set up all the other packages listed above, as well. As long as these steps are taken in order, you should be able to stop anywhere along the way and have working packages up through that point.
Various linux distributions include some of the math packages, such as gmp-ecm in their repositories. However, due to the delay between package releases and repository inclusion, and expecting that those using these packages will be trying to stay on the leading edge, I will be describing the steps that acquire, compile and (possibly) install the latest versions of the packages available in most cases. (It may be necessary to uninstall a repository version to properly install the latest.) That being said, feel free to use repository versions of packages if you would rather.
In some cases, you might want to compile with different options than the ones I will suggest. It is fine to experiment with such changes, but I suggest going through the setup with the options below and comfirming a working system prior to those changes. Although the one created by these steps may not be optimum, I am trying to get everything up and running for your installation. Once everything is working, you'll have a base to try alternate setups from.
Nearly all of the current (and past) workings for these installations are being (and have been) discussed to some length on the Mersenne Forum Factoring Pages and it is suggested that all installation issues be brought up there.
As mentioned earlier, if you would prefer to try repository versions for some of the packages, that is OK as well. They may work fine and save some time and installation hassles.
Note 1: Proceed at your own risk! I accept no responsibility for the accuracy of, or how you use the information provided. Proceed at your own risk!
Note 2: It is expected that you have some familiarity with Ubuntu, or at least a linux distribution, but most information is pretty basically presented. You will need to know how to open a terminal, navigate through directories via a file manager such as nautilus and edit files via a text editor such as gedit. You will also need administrator privileges to use sudo commands.
Note 3: I will be using the user ID of math and the main folder of Mathwork for these steps. You are free to use another user name and/or folder. Simply replace my suggestions with yours.
1. ONLY PERFORM THIS STEP IF YOU ARE DELETING A PRIOR OS OR INSTALLING A NEW HARD DRIVE (OR, YOU ARE FAMILIAR WITH INSTALLING FOR DUAL-BOOT) - THIS CAN/WILL DESTROY A PREVIOUS OPERATING SYSTEM!! Install Ubuntu as appropriate for your system.
2. Create a user named math, either at installation or later (and log in as math, if necessary).
3. Update Ubuntu
4. Open a terminal and check Perl and Python:
- a. type perl -v Enter
- b. type python Enter
- 1. Check that version is >= 2.6
- 2. Use CTRL+D to exit.
Note: In the case of Perl and Python, as long as the previous is met, it isn't necessary to acquire the latest versions.
- If something above is not met, install the appropriate package via the repository.
The following steps are provided in the necessary order to allow those packages that depend on others to be addressed in that workable order. You should be able to stop at whichever package is the last one you are interested in, but install all previous ones. Overall end purposes may suggest changes to the options I will suggest, but for now the provided steps should create a fully working setup. A specific example is that for YAFU to run NFS, it is necessary to compile msieve using the NO_ZLIB=1 option. You may wish to skip that for Aliqueit, where YAFU won't be used for that type of work. Alternate installations of many packages can be experimented with on your own later.
5. Check for and install, if necessary, the following from the repositories for all linux platforms:
- a. g++
- b. subversion
- c. m4
- d. wget
- e. zlib1g-dev
- f. make
- g. libtool
- h. autoconf
- i. p7zip (Needed only to decompress the optional ggnfs sievers.)
6. Create a folder called Mathwork within the math (/home/math, but also called home) folder.
7. Step through the following as far as to include all your desired programs/packages:
- a. gmp. The current version can be found at The GNU Multiple Precision Arithmetic Library. Choose Download under Page contents: to locate the appropriate compressed file.
- 1. Extract the gmp archive into the Mathwork folder. Make sure "Re-create folders" is checked.
- 2. Rename the new directory to just gmp.
- 3. In a terminal, navigate to Mathwork/gmp.
- 4. Type ./configure Enter
- Ensure ./configure returns without errors.**
- 5. Type make Enter
- Ensure make returns without errors.**
- 6. Type make check Enter
- Ensure make check returns without errors.**
- 7. Type sudo make install Enter
- ** If errors show up at any of these steps, they must be resolved before continuing. Try to look for reasons for the error via the specific message(s) and correct them. Then start over from Step 4. If you can't resolve the errors, you can try installing the repository version.
- Note: The above procedure is only the very basic version of installation. To gain maximum efficiency, refer to the documentation provided in the text files accompanying the source code.
- b. gmp-ecm. To acquire the most current gmp-ecm source code I use Subversion to download it from gforge.inria.fr. Open a terminal and type (or copy/paste) the svn checkout command from below (then Enter):
svn co svn://scm.gforge.inria.fr/svn/ecm/trunk /home/$USER/Mathwork/ecm
- 1. In a terminal navigate to the /home/math/Mathwork/ecm folder.
- 2. Type libtoolize Enter
- 3. Type autoreconf -i Enter
- 4. Type ./configure --with-gmp=/usr/local/ Enter
- Ensure ./configure returns without errors.*
- 5. Type make Enter
- Ensure make returns without errors.**
- 6. Type make check Enter
- Ensure make check returns without errors.***
- 7. Type sudo make install Enter
- Note: If a libecm conflict occurs, you may need to remove libgmpxx4ldbl via the repository Software manager.
- * If you get a gmp version conflict error, do the following:
- a. Type whereis libgmp Enter
- b. Note the location of libgmp.a (i.e. /usr/local/lib/libgmp.a)
- c. Add --with-gmp=/usr/local/ to the ./configure entry - for example:
./configure --with-gmp=/usr/local/
- ** If errors show up at any of these steps, they must be resolved before continuing. Try to look for reasons for the error via the specific message(s) and correct them. Then start over from Step 4. If you can't resolve the errors, you can try installing the repository version.
- c. ggnfs. The current version can be found at: radii/ggnfs - GitHub. Click on the download ZIP button to acquire the archive.
- 1. Extract the ggnfs archive into the Mathwork folder. Make sure "Re-create folders" is checked.
- 2. Rename the new directory to just ggnfs.
- 3. In a terminal, navigate to Mathwork/ggnfs.
- 4. Type make Enter
- 5. Choose the correct target for your system. If you're unsure of your cpu, Type cat /proc/cpuinfo Enter
- 6. Type make target Enter
- Note for 64-bit installation: The current version sometimes crashes during compile. Whether or not this is the case, you should now make the assembly enhanced sievers within the package or you can use the following referenced sievers. If the compile completes successfully, either may be used, but the following optional ones may still run better. To build the assembly enhanced sievers from the original package, follow these steps:
- 1. In a terminal change to the math/Mathwork/ggnfs/src/experimental/lasieve4_64/athlon64
- 2. Edit Makefile such that -march=k8 is -march=native and -mtune=k8 is -mtune=native
- 3. Change to the athlon64 folder and make the same changes to that Makefile
- 4. Open the INSTALL file in the lasieve4_64 directory and follow its instructions, making sure each compile returns without errors**.
- 5. After folowing the steps in the INSTALL file, you should have six gnfs-lasieve4I1#e binary files in the lasieve4_64 directory. Move these six files into the ggnfs/bin directory, overwriting any that already exist.
**If errors are encountered, you can try to work through them using this thread at mersenneforum.org or use the below referenced set from bsquared. User bsquared (Mersenne forum ID) has optimized a set that can be retrived from here. Note that p7zip will be needed to decompress these sievers.
- a. Unpack the static binaries from bsquared into the /home/math/Mathwork/ggnfs/bin folder, overwriting any already there.
- b. Open the /home/math/Mathwork/ggnfs/bin folder with Nautilus or an equivalent file utility.
- c. Right-click on each of the six gnfs-lasieve4I1#e files in turn.
- d. Choose Properties at the bottom of the menu.
- e. Choose the Permissions tab.
- f. Check the box beside "Execute:" that says "Allow executing file as program."
- g. Close the Properties box.
- d. Msieve - YAFU prerequisite. If you are not intending to compile YAFU with the NFS option, you can skip this step and proceed directly to the YAFU step. It is recommended that you perform this step and compile YAFU with NFS, but it is not necessary.
To acquire the msieve source code I use Subversion to download it from SourceForge.net. Open a terminal and type (or copy/paste) the svn checkout command from below (then Enter):
svn co https://svn.code.sf.net/p/msieve/code/trunk /home/$USER/Mathwork/msieve (for 64-bit)
svn co -r 722 https://svn.code.sf.net/p/msieve/code/trunk /home/$USER/Mathwork/msieve (for 32-bit)
- 1. In a terminal navigate to the /home/math/Mathwork/msieve folder
- 2. Type make Enter
- 3. Choose the correct target(s) for your system. Include NO_ZLIB=1 and ECM=1.
- 4. Type make target(s) Enter (e.g. make x86 NO_ZLIB=1 ECM=1 Enter)
- e. YAFU. For the present, 32-bit installations of YAFU will need to be limited to revision 250 (similar to the -r 722 in msieve above.) I use Subversion to download it from SourceForge.net. Open a terminal and type (or copy/paste) the following (then Enter):
svn co https://svn.code.sf.net/p/yafu/code/branches/wip /home/$USER/Mathwork/yafu (for 64-bit)
svn co -r 250 https://svn.code.sf.net/p/yafu/code/trunk /home/$USER/Mathwork/yafu (for 32-bit)
- 1. Using a text editor, open /home/math/Mathwork/yafu/Makefile and make the following changes:
- OPT_FLAGS = -O3 -mmmx -msse2 (only needed for 32-bit installation)
- # modify these for your particular gmp/gmp-ecm installation
-
- INC += -I/home/math/Mathwork/msieve (only needed for 32-bit installation)
-
- INC += -I/usr/local/lib/
- LIBS += -L/usr/local/lib/
- INC += -I/home/math/Mathwork/ecm (only needed for 32-bit installation)
- LIBS += -L/home/math/Mathwork/ecm (only needed for 32-bit installation)
Also modify the same four previous lines (gmp/ecm) as above in the "else" section.
- # modify the following line for your particular msieve installation
- LIBS += -L/home/math/Mathwork/msieve
- 2. Save/close Makefile.
- 3. In a terminal, navigate to the /home/math/Mathwork/yafu folder.
- 4. Type make Enter
- 5. If prompted, choose the correct target for your system.
- Note: If you plan to use YAFU to fully factor large numbers (recommended), add NFS=1 in the following step.
- 6. Type make NFS=1 Enter
- 7. In a terminal type whereis ecm Enter (Remember this location.)
- 8. With a text editor open /home/math/Mathwork/yafu/yafu.ini.
- a. Edit ggnfs_dir to =/home/math/Mathwork/ggnfs/bin/
- b. Edit ecm_path to =full location from above (i.e. /usr/local/bin/ecm).
- c. Remove the four lines that begin with tune_info=Intel(R)...
- d. Save/close yafu.ini.
- Note: At this point, it is suggested that you test the YAFU installation by "tuning" it, but this will take a few minutes. You may also do this later. If you wish to tune YAFU, perform the following:
- 1. In a terminal, navigate to the /home/math/Mathwork/yafu folder.
- 2. Type ./yafu tune Enter
- f. Msieve - making it current. If you used msieve revision 722 (-r 722) above, you should now update to the current revision. To acquire the current msieve source code use Subversion to download it from SourceForge.net. Open a terminal and type (or copy/paste) the svn checkout command from below (then Enter):
svn co https://svn.code.sf.net/p/msieve/code/trunk /home/math/Mathwork/msieve
- 1. In a terminal navigate to the /home/math/Mathwork/msieve folder
- 2. Type make Enter
Note: If you used revision 722 above, please note that the Makefile changed between r722 and the current revision.
- 3. Choose the correct target(s) for your system. You should include ECM=1.
- 4. Type make target(s) Enter (e.g. make all ECM=1 Enter)
- Note for later: If msieve (or YAFU during nfs) gives an illegal instruction type or memory error when tested later, come back to this step and do the following:
- a. Open the Makefile with a text editor
- b. Change -march=core2 to -march=native
- c. Type make clean Enter
- d. Type make target(s) Enter (e.g. make all ECM=1 Enter)
- g. Aliqueit. The current version can be found at mklasson.com :: Aliquot sequences. Save the file referenced by the linux link.
- 1. Create the folder Aliqueit within the Mathwork folder.
- 2. Open Aliqueit###_linux.tgz and extract all the files into the Aliqueit folder. Make sure "Re-create folders" is checked.
- 3. Open /home/math/Mathwork/Aliqueit/aliqueit.ini with a text editor:
- a. Comment/Uncomment the appropriate ggnfs_clean_cmd.
- b. Comment/Uncomment the appropriate null_device.
- c. Comment/Uncomment the appropriate prefer_yafu.
- d. Modify - ecm_cmd = ecm
- e. Modify - ecmpy_cmd = python /home/math/Mathwork/Aliqueit/ecm.py (if you plan to use ecm.py)
- f. Modify - yafu_cmd = /home/math/Mathwork/yafu/yafu (see yafu.ini note below)
- g. Modify - msieve_cmd = /home/math/Mathwork/msieve/msieve
- h1. Modify - ggnfs_cmd = python "/home/math/Mathwork/Aliqueit/factmsieve.py" (if you plan to use factmsieve.py)
- h2. Modify - ggnfs_cmd = perl "/home/math/Mathwork/Aliqueit/factMsieve.pl" (if you plan to use factMsieve.pl)
- i. Modify - use_ecm.py = (appropriately)
- j. ** See note below ** Modify - use_msieve_polyfind = (appropriately)
- k. Save/close aliqueit.ini
- Note about yafu.ini: When YAFU is called by Aliqueit, it will look for yafu.ini in the Aliqueit directory, so if you require options other than the default ones, i.e. -threads 2, copy yafu.ini from the yafu directory into the Aliqueit directory.
** Special Note about msieve poly searching: With older versions of msieve, I experienced a never-ending poly search when gnfs was called. The solution I used was to set gnfs to invoke the poly selection, use factmsieve.py v75 (or later) and set the "MSIEVE_POLY_TIME_LIMIT" to 60.
- h. ecm.py. This is optional. This script allows ecm to use more than one CPU core/hyper-thread. To find the latest version, search this thread at mersenneforum.org.
- 1. Extract ecm.py into the /home/math/Mathwork/Aliqueit folder.
- 2. With a text editor, open ecm.py.
- 4. Modify ECM_PATH = 'path from previous step (7.e.7. above)' (i.e. '/usr/local/bin/')
- 5. Modify ECM_THREADS = (appropriately)
- 6. Modify ECM = (appropriately) (i.e. ecm)
- 7. Save/close ecm.py
- i. factmsieve.py. This is optional. You can use factMsieve.pl (Perl script), found within the GGNFS files, if preferred. I can no longer find version 76 of factmsieve on the Internet. So, unless the author tells me to remove it, I'll have it available here.
- 1. Extract factmsieve.py into the /home/math/Mathwork/Aliqueit folder.
- 2. With a text editor, open /home/math/Mathwork/Aliqueit/factmsieve.py.
- 3. Modify - GGNFS_PATH = '/home/math/Mathwork/ggnfs/bin/'
- 4. Modify - MSIEVE_PATH = '/home/math/Mathwork/msieve/'
- 5. Modify - NUM_CORES = (appropriate number)
- 6. Modify - USE_CUDA = (appropriately)
- 7. Modify any other appropriate items for your system
- 8. Save/close factmsieve.py
- j. factMsieve.pl. This is optional and can be used instead of factmsieve.py. The file is provided with the ggnfs package and can be found in the /home/math/Mathwork/ggnfs/tests folder.
- 1. Copy the factMsieve.pl file into the /home/math/Mathwork/Aliqueit folder.
- 2. With a text editor, open /home/math/Mathwork/Aliqueit/factMsieve.pl.
- 3. Modify $GGNFS_BIN_PATH="/home/math/Mathwork/ggnfs/bin";
- 4. Save/close factMsieve.pl
- 5. Place a copy of msieve into the /home/math/Mathwork/ggnfs/bin folder, from the /home/math/Mathwork/msieve folder.
Testing your installation:
You should now be able to run aliquot sequences using aliqueit and all the associated packages. The following is a procedure to do just that, based on the above installation:
- 1. Choose a number and check it in the db and reservations thread at factordb.com and Aliquot Sequences - mersenneforum.org, respectively.
- 2. Open a terminal.
- 3. Type cd Mathwork/Aliqueit Enter
- 4. Use wget to retrieve the elf for the number - type (or copy/paste) wget "http://factordb.com/search.php?se=1&aq=#####&action=all&text=Text&raw=1" -O alq_#####.elf Enter (use your chosen number in place of #####)
- 5. Type ./aliqueit ##### Enter (or, you can add options based on your choices for the number - see aliqueit.txt).
Automating Aliqueit:
If you would like to run Aliqueit on several numbers, this can be accomplished via a bash script. Here is a simple example:
---start of script---
#!/bin/bash
cd /home/math/Mathwork/Aliqueit
alq=4788
wget 'http://www.factordb.com/elf.php?seq='${alq}'&type=1' -O /home/math/Mathwork/Aliqueit/alq_${alq}.elf
/home/math/Mathwork/Aliqueit/aliqueit -d 180 $alq
/home/math/Mathwork/Aliqueit/aliqueit -s 0 $alq
alq=######
wget 'http://www.factordb.com/elf.php?seq='${alq}'&type=1' -O /home/math/Mathwork/Aliqueit/alq_${alq}.elf
/home/math/Mathwork/Aliqueit/aliqueit -d 120 -c 95 -b -e $alq
/home/math/Mathwork/Aliqueit/aliqueit -s 0 $alq
---end of script---
You can run the script by typing bash scriptname Enter.
You can choose individual parameters for each Aliqueit run within the specific calls. To add more sequences to work on, simply copy/paste the last set of lines and edit appropriately.
If you find errors or wish to make comments about this page, please post on the Mersenne Forum Factoring Pages under the appropriate package pages, such as under the yafu pages for an issue with YAFU.
Additional Notes:
At this point you also have working copies of gmp-ecm, msieve and YAFU that can be run by themselves. For example, to start YAFU:
- 1. In a terminal, type cd /home/math/Mathwork/yafu Enter
- 2. Type ./yafu Enter
- - - - - - - - - - - - - - - - - - - - - - - - - - -