y-cruncher - Developments

(Last updated: February 21, 2024)



Back To:


Active Branches:


This is a table of all the active branches of y-cruncher. As this is just a side-hobby, overall development is slow and there is no formal release cycle.

Branch Version # Changes (from v0.8.4.9537)
v0.8.4 v0.8.4.9537


trunk v0.8.5.9536-3 none

Versions older than v0.8.3 are no longer maintained. Barring extreme circumstances, I will not be fixing bugs on anything older than v0.8.3.


Build support for anything older than v0.7.10 is no longer maintained. If you are running any large (world record) computation using v0.7.9 or older, I will not be able to help you if something goes wrong that requires a program change to fix and resume.





As of August 2023, the project has wrapped up a major rewrite of all the large multiplication algorithms. This follows a 2 year hiatus in development where my interests had shifted to a completely unrelated project.


With the rewrite completed, the project is once again on hiatus for an unknown amount of the time. The sheer complexity of the new FFT design along with an unexpected death in my household has completely drained me mentally. So no major development will be expected for a while.



Feature Description Status
Update Compiler to ICX

Intel's classic C++ compiler (ICC) has been discontinued. Switch to their new LLVM-based compiler (ICX).


Also switch Linux from GCC to ICX. Linux been a bit slower partly because GCC was never as good as ICC.

This was originally planned for Q4 2023, but has been put on hold indefinitely.


The problem is that ICX is worse than ICC. Intel decided to discontinue their old compiler (ICC) before their new one (ICX) could match it in performance. Therefore, changing compilers from ICC -> ICX would lead to an (unacceptable) performance loss for y-cruncher.


While I am in talks with Intel's compiler engineers about fixing ICX's regressions, I don't see any realistic progress happening. ICX simply has too many difficult-to-fix performance regressions to fix. And I doubt they will spend a lot of developer time on issues that only impact a tiny portion of their user base.


While I remain hopeful that ICX will eventually reach ICC's performance, I'm not overly confident of it. Since it's impossible to stay on an old compiler version forever, it's likely that a future version of y-cruncher will take a performance loss once it is forced to move off ICC.


Things To Do:

Feature Description Status

Custom Formulas:


Add support for the exponential function.

This will enable the fully generic non-integer power function for real numbers.

This has been tentatively implemented in v0.8.4 using Newton's Method to invert log(x).


While it's unclear if the bit-burst algorithm is faster, it is also much more difficult to implement.

Improved Stress Tester

The current stress-tester has increasingly poor coverage in today's processors. In fact, the program's unit and integration test frameworks are a better stress test than the dedicated stress test itself!


Find a way build a new stress test around these "better" workloads.

y-cruncher has notoriously become "powerful" enough to break not just overclocked systems, but also stock systems as well as servers. The potential for making it an even more powerful stress-test has a lot of value for ensuring stability of production systems.


This idea is currently being considered for monetization.


MRFM stands for "Multi-Region Far Memory". It is a very large experimental project that will attempt to solve the NUMA problem and more generally, the supercomputer problem.


The current design of MRFM that is planned is a fundamental departure from y-cruncher's battle-tested model of computation. So virtually all high-level code will need new implementations for MRFM.


As a result, the plan calls for two completely new computation modes:

  • Multi-Region NUMA
  • Multi-Region Swap

This will bring the total number of modes to 4. But if all goes as planned, Multi-Region Swap will become a no-compromise generalization of the current Swap Mode. So it will be possible to remove the current Swap Mode without losing much functionality.


Due to the sheer scale of this project along with a large number of unknowns, this was expected to be (and has become) a multi-year project with no guarantee of success.

Much of the planning for this began years ago. But actual coding didn't start until around September of 2016.


As of 2018, progress is stalled due to large amounts of technical debt in y-cruncher's high-level code which have been accumulating for years.


MRFM remains a multi-year project with no end in sight and has stalled.




As of 2023, the multiplication rewrite of v0.8.x has forced me to revisit this which led to some unexpected developments.


Without disclosing too much, MRFM is not dead and may actually happen at some point. Though if it does become realized, it will not be in the way I had envisioned it nearly a decade ago.


Regardless, there's lots of research that needs to be done. Though I dare say that y-cruncher v0.8.2 already has some of the foundations needed to actually make MRFM a reality.



Old Ideas Shelved Indefinitely:

Most of these ideas are from the v0.7.8 era where there was significant development on extending y-cruncher's mathematical functionality. But as of 2023, y-cruncher has started falling behind the hardware curve. Thus priorities have shifted away.

Feature Description Status
Slave Mode

Provide a way to control y-cruncher through TCP. This will allow 3rd party applications to build a GUI around y-cruncher.


More details here: https://github.com/Mysticial/y-cruncher-GUI

An early version of this was launched with v0.7.6. As of v0.7.7, it theoretically should be complete enough to implement a full GUI for both the stress tester and custom compute options.


Incremental progress will continue to be made. In particular a unified way to express menus and suboptions is still needed.


As of 2019, priorities have shifted elsewhere.

Optimized Square Root

Custom Formulas:


The current square root is just the inverse square root followed by a multiply by the input.


It may be possible to do better by merging that multiply in the final iteration - as is the case for division and reciprocal.

Optimize the AGM

Custom Formulas:


In the final iterations of the AGM, much of the output is already known. These can be used to skip some of the early iterations of the Newton's Method square root.
Optimize log(x)

Custom Formulas:


The current log(x) implementation is a dumb wrapper around AGM(1,x).


There are ways to make the AGM require fewer iterations that should be investigated.

Non-Monotonically Convergent Hypergeometric Series

Custom Formulas:


Extend the SeriesHypergeometric function to allow series that are not monotonically convergent.


This is needed for confluent hypergeometic functions at large inputs where the series initially diverges before eventually converging.


This will allow certain approximation algorithms to be implemented:

  • Sweeney's method for the Euler-Mascheroni Constant
  • Gamma function at rational inputs.

This is expected to be very difficult.


Irregular convergence behavior wreaks havoc on the Binary Splitting implementation since a lot of assumptions break down. While the Brent-McMillan formula for the Euler-Mascheroni Constant already exhibits this behavior, it is specially handled.


The most difficult part of this is precision control. In order to do precision control, y-cruncher needs to know:

  1. How large the series terms can get.
  2. What magnitude the final value converges to.

#1 is complicated, but likely doable.

#2 doesn't seem approachable in the generic case with the mathematical techniques that I know of.


#2 is difficult due to destructive cancellation. Confluent hypergeometric functions are notorious for this behavior. And it is just the simplest case.


Take a series and something as simple as taking its derivative can drastically alter the magnitude of the value that it converges to. (i.e. exp(-x2) and the Error Function for very large x)


It is likely that #2 will require the user to explicitly tell y-cruncher what the final magnitude will be.



Areas of Research:


Silent Data Corruption:

Disk I/O is the bane of large number computations. Historically, it was bad only because it is slow. Nowadays, it's also unreliable.


"Unreliability" comes in several forms:

  1. Basic I/O errors where an API call to read or write fails.
  2. The entire drive fails completely leading to permenant data loss.
  3. Silent data corruption that is neither detected by the hardware nor the operating system.

(1) and (2) are easily solved using checkpoint-restart and periodic backups. y-cruncher has supported checkpointing this since v0.5.4 so it isn't really a problem anymore. But (3) is very scary and remains a huge problem today.


Silent data corruption is the worst since it's undetected. It plagues database applications, and unfortunately, y-cruncher is extremely vulnerable as well. If an error manages to slip through y-cruncher's built-in redundancy checks, it will cause a computation to finish with the wrong digits.





Hard drives already use error-correction and CRCs to ensure data integrity. And transfers between the drive to the controller are also protected with CRCs. So you would expect that data corruption would be detected by the operating system right? Nope...


When a hard drive fails to read a sector due to CRC failures, it usually propagates all the way back into the program and manifests as a (1). So that's not a problem. But transfer errors between the drive and the controller are less ideal. Supposedly, transfer errors lead to retransmission. But this isn't always the case.


Throughout the years of developing y-cruncher, transfer errors have also been observed to:

  1. Severely slow down or hang the drive in question.
  2. Silent data corruption.
  3. Silent data corruption and an increase to the S.M.A.R.T. "Ultra ATA CRC error count".

(1) is to be expected if the connection quality is so bad that the data gets stuck in a retransmission loop.

(2) is also be expected if the corrupted data passes a CRC by chance. (I have no idea how long the CRC is, but if it's CRC32, a 1 in 4 billion chance isn't small.)

(3) makes absolutely no sense at all. If the hard drive was able to detect the error, then why the hell doesn't it notify the OS that the operation failed?


In any case, there are other things that don't add up. And in the end, we are forced to accept the reality.


To date, y-cruncher's only defense for silent data corruption is the RAID3. When the swap file configuration is set to use RAID3, (almost) all reads are parity checked. And if the data is bad, it will report a failure. The parity bits are flipped so that zeroing errors that zero everything will fail the parity.


Unfortunately, this is far from sufficient:

To date, silent data corruption has yet to bring down a world-record attempt. But it happens regularly in the development test machines (which contain some very old hard drives). There has also been an instance reported on a forum where a 1 trillion digit computation of Pi failed - presumably due to silent data corruption.


Approximately 80% of the disk I/Os that y-cruncher does are covered by redundancy checks at a higher level. So in the absence of RAID 3, silent data corruption will be detected with 80% probability if we assume uniform distribution. To put it simply, 80% is not good enough. But at the very least, failing a redundancy check should be an immediate and serious red flag.



Possible Solutions:


For a long time, solving the silent corruption problem was deemed too difficult. All software solutions come with a non-trivial amount of overhead.


y-cruncher v0.7.8 saw a complete overhaul of the Swap Mode functionality which finally allowed new features to be added. With the door opened to new stuff, one of the first experiments was a checksumming protocol which turned out be more performant than expected. Thus y-cruncher v0.7.8 will feature checksumming for disk I/O that will be enabled by default.


Will this solve the silent corruption problem? Only time will tell.



Non-Uniform Memory Access (NUMA):

y-cruncher is currently a shared memory program. So it will run efficiently given the following assumptions:

  1. All the memory in the system is shared and can be accessed by all processor cores.
  2. All processor cores have low latency and high-bandwidth access to all the memory.

As of 2016, these assumptions hold for almost all single-socket systems - which include the majority of personal desktop computers and low-end servers.


But due to the laws of physics and the speed of light, assumption #2 does not hold for larger systems. So now we're into the territory of Non-Uniform Memory Access (NUMA), cluster/distributed computing. For now the focus will be on NUMA systems since that's what the majority of the multi-socket systems are.


In short, y-cruncher does not run efficiently on NUMA. While it scales reasonably well onto dual-socket, it all goes downhill after that. There have been numerous reports of non-scaling (and even backwards scaling) on quad-Opteron systems. And all of this is due to the NUMA.


To exacerbate the problem, OS's normally default to a "first-touch" policy for memory allocation. The problem is that y-cruncher allocates all its memory at the start of a computation with a single thread. With the first-touch policy, all the memory will be allocated (or heavily biased) on one NUMA mode. So during the computation, all the cores from all the NUMA nodes will be hammering that one node for memory access. The interconnect going in and out of that one node will be overwhelmed by the traffic which leads to terrible performance.


y-cruncher v0.7.3 adds the ability to interleave memory across nodes. This balances the interconnect traffic and leads to a significant performance on modern dual and quad-socket systems. But ultimately, this doesn't actually solve the problem of NUMA since the memory accesses (which are now randomized) will still be hitting remote nodes over the interconnect.


To be efficient, the program needs to be aware of the NUMA and needs to be designed specifically for it. This is a fairly difficult task which is made worse by the unlimited combinations of NUMA topologies. Long story short, making y-cruncher NUMA aware will require changing the way that memory is fundamentally stored and managed. This means that it will need to be done as a new "mode" much like how "Ram Only" and "Swap Mode" have completely different data storage formats.



Currently, the most promising solution is to generalize the functionality of swap mode in the following ways:

  1. Instead of using a disk array, replace it with a "far memory" interface which can be anything from disk to interleaved NUMA or even cloud storage.
  2. Leverage the swap mode algorithms for minimizing disk access to minimize access to far memory.
  3. Duplicate shared resources into each NUMA node to reduce interconnect thrashing.


GCD Factorization:

Many binary splitting recursions have a lot of common factors between the fraction numerators and denominators. Implement an optimization that seeks to remove these common factors so that the numbers are smaller in size.


GCD Factorization was first described here (now a dead link). Since then, there have been subsequent publications that describe the method:

The general idea of the optimization is to keep the prime factorization of some of the recursion variables. Then use this factorization to obtain the GCD of the numerator and denominator terms. Obtaining this prime factorization is done using a sieve.


Current implementations of this optimization include GMP Pi Chudnovsky and TachusPi. And most literature reports a speedup of about 20 - 30% for Pi Chudnovsky.


In the context of y-cruncher, this optimization is applicable to the following constants/algorithms:


Current Problems:


Even though GCD factorization has been known for years, y-cruncher has yet to use it for a number of reasons:

  1. The naive approach to sieving the index terms will require a prohibitive amount of memory. This problem exists in GMP Pi Chudnovsky. Fabrice Bellard's TachusPi has a more efficient approach that does it using O( sqrt(N) ) memory - presumably using some sort of sieve segmentation. But he left few details on this approach.

  2. The data structure that is needed to perform the sieve and store the prime factorization is somewhat incompatible with y-cruncher's memory model.

  3. y-cruncher lacks the ability to efficiently perform integer divisions.

While (1) and (3) are certainly solvable, (2) is more difficult. All the ideas so far for attacking (2) are either complicated and fragile, or they require breaking out of the current memory model. For now, there's bigger fish to fry.