(Last updated: August 15, 2017)
At any time, there are usually two branches of y-cruncher that are active maintained. The following table lists the changes that are confirmed for each active branch.
Most easy-to-fix bugs get patched and cherrypicked into all active branches. But an actual release is only done when the bugs involved collectively reach a sufficient level of severity. So the current version that is available for download might be (and quite often is) behind the release branch.
Publicly released versions of y-cruncher tend to lag behind the internal ones by several months or more. This is mostly for QC reasons since there is usually zero tolerance for bugs that affect the correctness of a computation.
|Branch||Version #||Changes (from v0.7.3.9474)|
y-cruncher was pretty heavily developed between 2008 - 2013. But I've since left school and found a full-time job. While y-cruncher will probably remain a side-hobby for the near future, it won't get as much attention as it used to get. At the very least, I'll continue to fix whatever bugs that are discovered. And I'll make an effort to keep the program up-to-date with the latest instruction set extensions and development toolchains. But for the most part, the project is done.
Most of the work right now is in cleaning up the code and refactoring it into idiomatic C++ for long-term maintainability. The program was (and still largely is) a fragile mess of unreadable C hackery with little to no documentation. So at the very least, I'd like to get it into a state where someone other than myself can read it.
Nevertheless, it's a never-ending project. So there are things on the to-do list. But it can be a long time before anything gets done.
Development on AVX512 began in 2014. And as of 2016, most of the work that could be done without the hardware has been completed.
Internally, there are currently 3 binaries with AVX512. Only two of them have been tested on real hardware and have been enabled.
Skylake X is here! The 16-KNL and 17-SKX binaries have been tested and enabled.
Performance gains are relatively disappointing due to the memory bottleneck and thermal throttling.
|Rewrite the Radix Conversion||
The current radix conversion code is actually a prototype that ended up in production. It has so many problems that it's basically unsalvageable.
The current code is actually the 3rd radix conversion to be used in y-cruncher (and the 2nd to use the Scaled Remainder Tree). But it's still a prototype since it's the first to combine all of the following features/optimizations:
At the time (2011), this was very ambitious - perhaps a little too ambitious. In the end, it required so many hacks that the thing became a complete mess.
The radix conversion will need to be completely redesigned and rewritten.
Still trying to figure out a way to approach this in a way that will be maintainable without sacrificing any performance...
The existing radix conversion has virtually no internal abstraction. This makes it both very fast and unmaintainable.
|Reduced Memory Mode||
For Pi Chudnovsky and Ramanujan, add a mode that will allow a computation to be done using less memory/disk at the cost of slower performance.
For a typical computation, most of the work requires very little memory. It's the occasional memory spike that causes y-cruncher to have such a high memory requirement.
There are about 4 large memory spikes in a Pi computation. In approximate descending order of size, they are:
These spikes can be flattened via space-time tradeoffs in the respective algorithms. Since the trade-off only needs to be done at the spikes, the overall performance hit should be reasonably small.
As of v0.6.8, only the first two memory spikes have been suppressed. The overall memory reduction is not enough to be worth enabling the feature publicly.
The last two spikes both involve the radix conversion which is completely blocked pending the rewrite of the radix conversion code.
This partially completed feature was used for the 12.1 trillion digit computation of Pi.
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) 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) 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.
Use a filesystem designed for data integrity (such ZFS). While this is almost too obvious, there will also be performance trade-offs.
The other approaches involve adding checksumming into y-cruncher's raid-file implementation. But this is easier said than done:
Inlining checksums into the data will break sector-alignment and incur copy-shifting overhead. But perhaps this can be merged with the RAID interleaving. Placing the checksums elsewhere will add seek overhead. Either way, it will be messy.
Due to the poor state of the current raid-file code, any significant change will likely imply a complete rewrite of the entire raid-file implementation.
y-cruncher is currently a shared memory program. So it will run efficiently given the following assumptions:
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:
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.
In the context of y-cruncher, this optimization is applicable to the following constants/algorithms:
Even though GCD factorization has been known for years, y-cruncher has yet to use it for a number of reasons:
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.