primesearch / Mlucas

Ⓜ️ Ernst Mayer's Mlucas and Mfactor programs for GIMPS
https://mersenneforum.org/mayer/README.html
GNU General Public License v3.0
8 stars 2 forks source link

Error during P-1 stage 2 restart: `Assertion failed: Stage 2 params mismatch those captured in the .stat logfile!` #37

Open tdulcet opened 2 months ago

tdulcet commented 2 months ago

This assert statement does not seem to consider the small prime relocation feature which changes the initial B2_start value: https://github.com/primesearch/Mlucas/blob/cfc33a8c2e68ef780df539ff92d692a0ce4afa31/src/Mlucas.c#L2645-L2647 Specifically, it does not seem to account for this section of code which conditionally sets the B2_start value: https://github.com/primesearch/Mlucas/blob/cfc33a8c2e68ef780df539ff92d692a0ce4afa31/src/pm1.c#L1078-L1086 This prevents restarting stage 2 of some P-1 tests. To fix this, maybe we could change the assert statement to something like:

ASSERT(psmall == i && (B2_start == psmall * B1 || B2_start == B2 / psmall), "Stage 2 params mismatch those captured in the .stat logfile!")

It would also be good if we could get feedback from someone more familiar the P-1 algorithms.

This was first reported by Ken on the forum.