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

FFT selection code #3

Closed
xanthe-cat opened this issue Feb 28, 2024 · 1 comment · Fixed by #11
Closed

FFT selection code #3

xanthe-cat opened this issue Feb 28, 2024 · 1 comment · Fixed by #11
Labels
bug Something isn't working

Comments

@xanthe-cat
Copy link
Collaborator

xanthe-cat commented Feb 28, 2024

As noted previously in #1 the default FFT selected for small exponents may be accurate but it misses the mark for Fermat exponents which have a limited range of possible FFTs that may be used. At Teal’s suggestion I’ve tested modifications to Mlucas.c, firstly at line 1261:

if(!fft_length || (!INTERACT && 8*fft_length > 9*kblocks && MODULUS_TYPE == MODULUS_TYPE_MERSENNE)) {

The added condition in the second clause ensures the 9 > 8 rule for selecting the next FFT doesn’t clobber Fermat exponents and retains the same behaviour for Mersennes. The more extensive modification at lines 1304 ff. or thereabouts prevent Mlucas running the self-test when Mlucas selects a wrong default FFT in spite of a user-supplied FFT.

	SETUP_FFT: /* CXC: addition by Teal D inserted at line 1308 to printf the preferred FFT length; also line 1310 if statement */
		/* Look for a best-FFT-radix-set entry in the .cfg file: */
		dum = get_preferred_fft_radix(kblocks);
		if(!dum) {	// Need to run a timing self-test at this FFT length before proceeding:
			sprintf(cbuf,"INFO: FFT length %d = %d K not found in the '%s' file.\n", n, kblocks, CONFIGFILE);
			fprintf(stderr,"%s", cbuf);
			if (!fft_length) return ERR_RUN_SELFTEST_FORLENGTH + (kblocks << 8);
		}
@tdulcet tdulcet added the bug Something isn't working label Feb 29, 2024
@xanthe-cat
Copy link
Collaborator Author

xanthe-cat commented Mar 3, 2024

The nested if statement might better be written as

if (!fft_length || MODULUS_TYPE == MODULUS_TYPE_MERSENNE) return ERR_RUN_SELFTEST_FORLENGTH + (kblocks << 8);

as this leaves the handling of the Mersenne numbers completely unchanged.

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

Successfully merging a pull request may close this issue.

2 participants