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

Assertion failed: Full-residue == 3^nsquares (mod q) check fails! #32

Open
efvb opened this issue Jun 13, 2024 · 1 comment
Open

Assertion failed: Full-residue == 3^nsquares (mod q) check fails! #32

efvb opened this issue Jun 13, 2024 · 1 comment

Comments

@efvb
Copy link

efvb commented Jun 13, 2024

I am using code from main, May 5th, compiled with GCC 11 with tuned Makefile with -O3 -flto=auto -DUSE_ARM_V8_SIMD -mcpu=neoverse-n1
This is an Ampere Arm VM.

I also have the file to restart, if needed.

Mlucas 21.0.1

https://www.mersenneforum.org/mayer/README.html

INFO: testing qfloat routines...
System total RAM = 23236, free RAM = 10691
INFO: 10691 MB of free system RAM detected.
CPU Family = ARM Embedded ABI, OS = Linux, 64-bit Version, compiled with Gnu C [or other compatible], Version 11.4.1 20230605 (Red Hat 11.4.1-2.1.0.1).
INFO: Build uses ARMv8 advanced-SIMD instruction set.
INFO: Using prefetch.
INFO: Using inline-macro form of MUL_LOHI64.
INFO: Using FMADD-based 100-bit modmul routines for factoring.
INFO: MLUCAS_PATH is set to ""
INFO: using 53-bit-significand form of floating-double rounding constant for scalar-mode DNINT emulation.
INFO: testing IMUL routines...
INFO: Testing 64-bit 2^p (mod q) functions with 100000 random (p, q odd) pairs...
INFO: System has 4 available processor cores.
INFO: testing FFT radix tables...
Set affinity for the following 4 cores: 0.1.2.3.
User did not set LowMem in mlucas.ini ... allowing all test types.
User did not set CheckInterval in mlucas.ini ... using default.
NTHREADS = 4
Setting ITERS_BETWEEN_CHECKPOINTS = 10000.
looking for worktodo.txt file...
worktodo.txt file found...reading next assignment...
worktodo.txt entry: PRP=164C2E2861CC217CF6033B299322924C,1,2,8546743,-1,99,0,3,5,"209104614239,2707424768671102639169"

INFO: Maximum recommended exponent for FFT length (448 Kdbl) = 8954601; p[ = 8546743]/pmax_rec = 0.9544526886.
Initial DWT-multipliers chain length = [long] in carry step.
INFO: restart file p8546743 found...reading...
Computing 8540000-squaring residue R (mod known prime q = 209104614239)
A: R == 9997626983 (mod q)
B: R == 135567088145 (mod q)
ERROR: at line 5271 of file ../src/Mlucas.c
Assertion failed: Full-residue == 3^nsquares (mod q) check fails!

@tdulcet
Copy link
Member

tdulcet commented Jun 13, 2024

Thanks for the bug report!

There are some known issues with LTO (see #10), so would you mind disabling it so we can rule that out. Just remove the -flto=auto argument from your Makefile and then recompile Mlucas.

If that does not help, could you add this printf call:

printf("pow[0] = %llu\npow[1] = %llu\npow[2] = %llu\npow[3] = %llu\n\nrem[0] = %llu\nrem[1] = %llu\nrem[2] = %llu\nrem[3] = %llu\n\nk = %u\n", pow[0], pow[1], pow[2], pow[3], rem[0], rem[1], rem[2], rem[3], k);

above that assert statement on line 5271:

Mlucas/src/Mlucas.c

Lines 5268 to 5271 in 1839858

// Raise 3 to the just-computed power; result in 4-limb local-array pow[]:
mi64_scalar_modpow_lr(3ull, exp, KNOWN_FACTORS+i, j, pow);
sprintf(cstr,"\tB: R == %s (mod q)\n",&cbuf[convert_mi64_base10_char(cbuf, pow, j, 0)] ); mlucas_fprint(cstr,1);
ASSERT(HERE, mi64_getlen(pow,4) == k && mi64_cmp_eq(pow,rem,k), "Full-residue == 3^nsquares (mod q) check fails!");
and then recompile Mlucas. This would provide more information about why the assert statement is failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants