Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tdulcet opened this issue Sep 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@tdulcet
Copy link
Member

tdulcet commented Sep 11, 2024

This assert statement does not seem to consider the small prime relocation feature which changes the initial B2_start value:

Mlucas/src/Mlucas.c

Lines 2645 to 2647 in cfc33a8

// Now compare the params from the restartfile vs those captured in the log:
if(psmall)
ASSERT(psmall == i && B2_start == B2/psmall, "Stage 2 params mismatch those captured in the .stat logfile!");
Specifically, it does not seem to account for this section of code which conditionally sets the B2_start value:

Mlucas/src/pm1.c

Lines 1078 to 1086 in cfc33a8

Small-prime relocation: If B2/psmall >= B1, we map the primes q in [B1,B2/psmall] to [B1*psmall,B2], run
stage 2 not from B1 to B2 but from B1*psmall to B2, and incorporate them into the stage 2 accumulator when
each corresponding semiprime q*psmall is hit in the remapped stage 2 interval:
*/
pm1_check_bounds(); // This sanity-checks the bounds and sets B2_start = B1 if unset.
if(B2_start == B1 && B2 >= B1*psmall) { // It's possible user running a S2 with B2/psmall < B1, hence the 2nd clause
reloc_start = psmall*B1; // Start including relocation-semiprimes once S2 passes this point, and
B2_start = MIN(reloc_start, B2/psmall); // shift B2_start upward to reflect the fact that primes in [B1,B2/psmall]
// will be relocated to [B1*psmall,B2].
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.

@tdulcet tdulcet added the bug Something isn't working label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant