Ernst Mayer's Mlucas and Mfactor programs for GIMPS
Ernst Mayer passed away unexpectedly on September 10, 2023. This repository contains his posthumously released Mlucas v21 code, which is now maintained by the Great Internet Mersenne Prime Search (GIMPS) community. The Python PrimeNet program/script previously bundled with Mlucas is now maintained in a separate repository.
Mlucas and Mfactor are 100% open source programs. Mlucas is for primality and P-1 testing of Mersenne and Fermat numbers, including support for the Lucas-Lehmer, Probable prime (PRP) and Pépin tests. Mfactor is for trial factoring. They support x86 Intel and AMD, ARM and other CPUs.
The original Mlucas README is available for posterity and contains a lot of information, but note that it is no longer up to date. For more information about Mlucas v21, please see the Ernst's Mlucas - the future thread on the Mersenne Forum.
Feature | Mlucas | Prime95/MPrime | |
---|---|---|---|
Architectures | x86 | ✔️ | ✔️ |
- | ARM | ✔️ | |
- | Other | ✔️ | |
Worktypes | LL | ✔️ | ✔️ |
- | PRP | ✔️ | ✔️ |
- | P-1 | ✔️ | ✔️ |
- | P+1 | ✔️ | |
- | ECM | ✔️ | |
- | Pépin | ✔️ | ✔️ |
PRP | Proofs | ✔️ | |
- | Certs | ✔️ | |
Error Checking | Jacobi | ✔️ | |
- | Gerbicz | ✔️ | ✔️ |
Random Shifts | ✔️ | ✔️ | |
Interface | CLI | ✔️ | MPrime only |
- | GUI | Prime95 only | |
Multiple Workers | Separate runs | ✔️ | |
PrimeNet Support | Separate script | ✔️ | |
Max FFT Length | 256M (512M with 0 shift) |
32M (AVX) - 64M (AVX512) |
|
Largest Exponent | 4,294,967,231 (8,937,021,911 with 0 shift) |
595,700,000 (AVX) - 1,169,000,000 (AVX512) |
|
Performance | ~50-90% | 100% | |
Free 🆓 | Yes, GPL | No, EULA | |
100% Open Source | ✔️ | Mostly | |
Claim Full EFF Awards | ✔️ |
Linux users can use the Mlucas install script to automatically download, build, setup and run Mlucas, including downloading, setting up and running the PrimeNet Python program for automated PrimeNet assignments.
Dependencies:
- Make
- GNU C or Clang compiler
- *GNU Multiple Precision (GMP) library
- *Portable Hardware Locality (hwloc) library
- *Python 3
* Optional
- Verify that the dependencies above are installed. On Debian and Ubuntu, run:
sudo apt update
andsudo apt install build-essential libgmp-dev libhwloc-dev
. - If one has git installed, just run:
git clone https://github.com/primesearch/Mlucas.git
. Otherwise, download the latest archive:wget https://github.com/primesearch/Mlucas/archive/main.tar.gz
and then decompress the files:tar -xzvf main.tar.gz
. - To download the PrimeNet program, run:
wget -nv https://raw.github.com/tdulcet/Distributed-Computing-Scripts/master/primenet.py
.
- Verify that the dependencies above are installed. Run:
brew install gmp hwloc
. - If one has git installed, just run:
git clone https://github.com/primesearch/Mlucas.git
. Otherwise, download the latest archive:curl -LO https://github.com/primesearch/Mlucas/archive/main.tar.gz
and then decompress the files:tar -xzvf main.tar.gz
. - To download the PrimeNet program, run:
curl -sSLO https://raw.github.com/tdulcet/Distributed-Computing-Scripts/master/primenet.py
.
Native Windows builds are experimental. For now, Windows users should use the Windows Subsystem for Linux (WSL) and follow the Linux instructions above instead.
- Download and install MSYS2.
- Verify that the dependencies above are installed. With the MINGW64 environment, run:
pacman -S mingw-w64-x86_64-gmp mingw-w64-x86_64-hwloc
. - If one has git installed, just run:
git clone https://github.com/primesearch/Mlucas.git
. Otherwise, download the latest archive:wget https://github.com/primesearch/Mlucas/archive/main.tar.gz
and then decompress the files:tar -xzvf main.tar.gz
. - To download the PrimeNet program, run:
wget -nv https://raw.github.com/tdulcet/Distributed-Computing-Scripts/master/primenet.py
.
- Change into the
Mlucas
directory. Run:cd Mlucas
orcd Mlucas-main
depending on which method one used to download it. - Run:
- To build Mlucas:
bash makemake.sh [use_hwloc]
. - To build Mfactor:
bash makemake.sh mfac [word]
, whereword
is optionally one of1word
,2word
,3word
,4word
ornword
.
- To build Mlucas:
To build with Clang or another compiler instead of GCC, run: export CC=<compiler>
, for example: export CC=clang
.
- Change into the
obj
directory. Run:cd obj
orcd obj_mfac
depending on if one built Mlucas or Mfactor respectively.
This README is still in progress. For now, see the original Mlucas README, which has more information about how to setup and run Mlucas. Also see Help below. Note that with Mlucas v21, if built with the hwloc library, one would want to use the new -core
option instead of -cpu
.
The help.txt file includes a variety of usage information not covered in the original README, concentrating largely on the Mlucas command line options. A separate documentation page covers Fermat numbers.
Pull requests welcome!