blocklanczos cannot restart from checkpoint
The problem seems to be the mismatch between blstate_load()
:
if (pi->m->jrank == 0 && pi->m->trank == 0) {
rc = asprintf(&tmp, "%s.control", filename_base);
ASSERT_ALWAYS(rc >= 0);
FILE * f = fopen(tmp, "rb");
bit_vector_read_from_stream(bl->D[i1], f);
size_t rc;
rc = fread(bl->L[i1].data(), sizeof(mat64), 1, f);
printf("rc=%ld, errno=%d\n", rc, errno);
ASSERT_ALWAYS(rc == 1);
rc = fread(bl->L[i2].data(), sizeof(mat64), 1, f);
printf("rc=%ld, errno=%d\n", rc, errno);
ASSERT_ALWAYS(rc == 1);
fclose(f);
free(tmp);
}
on the one hand, and blstate_save()
on the other hand:
if (pi->m->jrank == 0 && pi->m->trank == 0) {
rc = asprintf(&tmp, "%s.control", filename_base);
ASSERT_ALWAYS(rc >= 0);
FILE * f = fopen(tmp, "wb");
bit_vector_write_to_stream(bl->D[i1], f);
size_t rc;
rc = fwrite(bl->L[i1].data(), sizeof(mat64), 1, f);
ASSERT_ALWAYS(rc == (size_t) 1);
fclose(f);
free(tmp);
}
The former tries to load two mat64
from the "control" file, while the latter stores only one.