Skip to content

cherubrock-seb/marin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

marin

Mersenne Prime search program

About

marin is an OpenCL™ application.
It determines whether a Mersenne number 2p - 1 is a probable prime using Fermat primality test (a = 3).

It implements an Efficient Modular Exponentiation Proof Scheme. The test is validated with Gerbicz - Li error checking.

Efficient multiplication modulo a Mersenne number is evaluated using an Irrational Base Discrete Weighted Transform.
A Number Theoretic Transform is implemented, over the field Z/pZ, p = 264 - 232 + 1 (see: Nick Craig-Wood, IOCCC 2012 Entry).

The algorithm is different from Nick Craig-Wood's implementation:

  • By the use of weights, xp - 1 is transformed into xn - 1, where n = 2m or 5 · 2m.
  • A recursive polynomial factorization approach splits x2n - r2 into xn - r, xn + r and x5n - r5 into 5 polynomials of the form xn - ri. See: Fast Multiplication.
  • Butterfly sizes are radix-4 and radix-5.

marin_algo.cpp is a basic implementation of the algorithm. Two main aplications are generated:

  • marin_cpu is an implementation of the algorithm on CPU. It is not optimised, it helps to check and debug the OpenCL application.
  • marin is the optimised OpenCL application. It can test any prime exponent p in [3; 1,509,949,421].

A checkpoint file is created if the application is interrupted and marin resumes from a checkpoint if it exists.

Build

The compiler must support 128-bit literal values. 64-bit versions of GCC and Clang support the built-in __uint128_t type.
The code has been validated with GCC 15.2 on Windows (MSYS2) and Linux.

TODO

  • Radix-5 must be be moved from the last stage to the first one.

About

Mersenne Prime search program

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 50.6%
  • C 49.4%