Skip to content

Commit

Permalink
fix checkpoint loading
Browse files Browse the repository at this point in the history
  • Loading branch information
brubsby committed Jul 24, 2024
1 parent dc95ed8 commit 5e7182e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -334,3 +334,4 @@ not planned for a specific release yet, no particular order!
- detailed runtime logging https://www.mersenneforum.org/showpost.php?p=662953&postcount=3845
- begink and endk logging https://www.mersenneforum.org/showpost.php?p=662953&postcount=3845
- only log every n seconds https://www.mersenneforum.org/showpost.php?p=662795&postcount=3826
- catch HUP https://www.mersenneforum.org/showpost.php?p=662777&postcount=3815
18 changes: 9 additions & 9 deletions src/checkpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ checkpoint_write() writes the checkpoint file.
}
else
{
sprintf(buffer,"%s%u %d %d %d %s: %d %d %s %d", NAME_NUMBERS, exp, bit_min, bit_max, NUM_CLASSES, MFAKTC_VERSION, cur_class, num_factors, strlen(factors_string) ? factors_string : "0", class_time);
sprintf(buffer,"%s%u %d %d %d %s: %d %d %s %llu", NAME_NUMBERS, exp, bit_min, bit_max, NUM_CLASSES, MFAKTC_VERSION, cur_class, num_factors, strlen(factors_string) ? factors_string : "0", class_time);
i=checkpoint_checksum(buffer,strlen(buffer));
fprintf(f,"%s%u %d %d %d %s: %d %d %s %d %08X", NAME_NUMBERS, exp, bit_min, bit_max, NUM_CLASSES, MFAKTC_VERSION, cur_class, num_factors, strlen(factors_string) ? factors_string : "0", class_time, i);
fprintf(f,"%s%u %d %d %d %s: %d %d %s %llu %08X", NAME_NUMBERS, exp, bit_min, bit_max, NUM_CLASSES, MFAKTC_VERSION, cur_class, num_factors, strlen(factors_string) ? factors_string : "0", class_time, i);
fclose(f);
}
}
Expand All @@ -75,8 +75,8 @@ int checkpoint_read(unsigned int exp, int bit_min, int bit_max, int *cur_class,
/*
checkpoint_read() reads the checkpoint file and compares values for exp,
bit_min, bit_max, NUM_CLASSES read from file with current values.
If these parameters are equal than it sets cur_class and num_factors to the
values from the checkpoint file.
If these parameters are equal than it sets cur_class, num_factors,
factors_string, and class_time to the values from the checkpoint file.
returns 1 on success (valid checkpoint file)
returns 0 otherwise
Expand Down Expand Up @@ -107,17 +107,17 @@ returns 0 otherwise
if(i<70)
{
ptr=&(buffer[i]);
sscanf(ptr,"%d %d %s", cur_class, num_factors, factors_string);
sprintf(buffer2,"%s%u %d %d %d %s: %d %d %s %d", NAME_NUMBERS, exp, bit_min, bit_max, NUM_CLASSES, MFAKTC_VERSION, *cur_class, *num_factors, factors_string, class_time);
sscanf(ptr,"%d %d %s %llu", cur_class, num_factors, factors_string, class_time);
sprintf(buffer2,"%s%u %d %d %d %s: %d %d %s %llu", NAME_NUMBERS, exp, bit_min, bit_max, NUM_CLASSES, MFAKTC_VERSION, *cur_class, *num_factors, factors_string, *class_time);
chksum=checkpoint_checksum(buffer2,strlen(buffer2));
sprintf(buffer2,"%s%u %d %d %d %s: %d %d %s %d %08X", NAME_NUMBERS, exp, bit_min, bit_max, NUM_CLASSES, MFAKTC_VERSION, *cur_class, *num_factors, factors_string, class_time, chksum);
sprintf(buffer2,"%s%u %d %d %d %s: %d %d %s %llu %08X", NAME_NUMBERS, exp, bit_min, bit_max, NUM_CLASSES, MFAKTC_VERSION, *cur_class, *num_factors, factors_string, *class_time, chksum);
if(*cur_class >= 0 && \
*cur_class < NUM_CLASSES && \
*num_factors >= 0 && \
strlen(buffer) == strlen(buffer2) && \
strstr(buffer, buffer2) == buffer && \
(*num_factors == 0 && strlen(factors_string) == 1) || \
(*num_factors >= 1 && strlen(factors_string) > 1))
((*num_factors == 0 && strlen(factors_string) == 1) || \
(*num_factors >= 1 && strlen(factors_string) > 1)))
{
ret=1;
}
Expand Down
1 change: 0 additions & 1 deletion src/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ void print_help(char *string)
printf(" -st run builtin selftest and exit\n");
printf(" -st2 same as -st but extended range for k_min/m_max\n");
printf(" -v <number> set verbosity (min = 0, default = 1, more = 2, max/debug = 3)\n");
printf(" -nolog don't create/append stdout to mfaktc.log\n");
printf("\n");
printf("options for debuging purposes\n");
printf(" --timertest run test of timer functions and exit\n");
Expand Down
2 changes: 1 addition & 1 deletion src/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ code path */
*******************************************************************************
******************************************************************************/

#define MFAKTC_VERSION "0.23-beta.3" /* DO NOT CHANGE! */
#define MFAKTC_VERSION "0.23-beta.4" /* DO NOT CHANGE! */



Expand Down

0 comments on commit 5e7182e

Please sign in to comment.