Originally posted by mklasson
- process the range in order of increasing n instead of k. Would make splitting ranges much easier.
I know. Didn't make it into the new version. Next time.
Originally posted by mklasson
- ability to print a list of all the numbers that are to be tested in a specified range.
That wouldn't be hard to add. OK.
Originally posted by mklasson
- also, I think it would be nice to be able to specifiy the B1 and B2 bounds manually even when running in "range mode". This would be useful if I'd like to, say, increase B2 somewhat after a range is processed and then do a quick pass through it again.
That sounds kind of cool. OK.
Originally posted by mklasson
EDIT: Oh yeah, I think there's something not quite right about the memory usage. Even though I give sbfactor 600MB, task manager only ever says it uses 450MB. I've got 1GB in the machine, so that's not the problem. At startup, sbfactor reports 600MB granted to it.
I think that's normal. I didn't actually test it with more than 256MB but there's nothing saying it will use the max mem. It also has to allocate it in 3 goofy sized chunks so that's probably why.
here's how it does it:
Code:
/* Compute how many values we can allocate */
unsigned long choose_pminus1_numvals (void)
{
/* Compute the number of gwnum temporaries available */
return ((unsigned long)
(((double) memory * 1000000.0 -
(double) map_fftlen_to_memused (FFTLEN, PLUS1)) /
(double) gwnum_size (FFTLEN)));
}
void choose_pminus1_plan (
unsigned long B, /* Stage 1 bound */
unsigned long C, /* Stage 2 bound */
unsigned long numvals) /* Returns max number of temps */
{
/* Handle case where there is no stage 2 */
if (C <= B) {
D = 0;
E = 0;
return;
}
/* Handle case where we are very low on the number of temporaries available */
if (numvals < 12) {
D = 210;
E = 1;
goto done;
}
/* Try various values of D until we find the largest D that doesn't use */
/* too much memory */
D = (unsigned long) sqrt (C-B) / 2310 + 1;
if (D > numvals / 480) D = numvals / 480 + 1;
D = D * 2310;
for ( ; ; ) {
/* We guess at the best E for a given D */
if (D <= 180) E = 2;
else if (D <= 420) E = 4;
else if (D <= 2310) E = 12;
else if (D <= 6930) E = 30;
else E = 48;
/* See if this combination of D and E will fit in memory */
if (D * D < C + C) {
if (D >= 2310) {
if (D / 2310 * 480 + E + 4 <= numvals) break;
} else if (D >= 210) {
if (D / 210 * 48 + E + 4 <= numvals) break;
} else {
if (D / 30 * 8 + E + 4 <= numvals) break;
}
}
/* Try next smaller value of D */
if (D > 2310) D = D - 2310;
else if (D > 210) D = D - 210;
else if (D > 30) D = D - 30;
else break;
}
/* Allocate more memory */
done: free (nQx);
free (eQx);
free (pairings);
nQx = (gwnum *) malloc ((D>>1) * sizeof (gwnum));
eQx = (gwnum *) malloc ((E+1) * sizeof (gwnum));
pairings = (char *) malloc ((D + 15) >> 4);
}
-Louie