Pure mathematics is a rich source of cpu-intensive problems with very precise semantics.
Typically its algorithms and data structures are side-effect free, which makes them surprisingly
easy to parallelize efficiently in Haskell. Calculating
Gröbner Bases is a good first example. So
far, we have implemented the improved Buchberger algorithm for the case of polynomials over
ℤ/pℤ
, achieving near-linear speedups for up to at least 6 cores, and currently about 25x
speedups counting garbage collection, or 32x not counting gc, for 60 cores. The Buchberger
algorithm is not obviously or "embarrassingly" parallel, and we believe this is the first
successful attempt to parallelize it.
You can see some timings at timings/timings.txt. If you want to compile and run these calculations on your machine, the quickest way is probably:
-
Download and install ghcup, ghc 9.4.8 or later, and cabal from GHCup or Getting started - GHCup, if you haven't already.
-
Download, or fork and clone, this repository (calculi).
-
cd
into yourcalculi
directory, and runcabal run time-gb -- +RTS -N6
with "6" replaced by the number of cores you want to use (we suggest the number of physical performance cores on your machine minus 1 or 2, not counting hyperthreading or efficiency cores). You can also runcabal run time-gb -- --help
to see more options.