aboutsummaryrefslogtreecommitdiff
path: root/tools/000_gendata/gendata.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-09-26 15:57:25 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-09-26 16:33:27 +0200
commitbc2cba8529a163d129dec91b5ec448a29a14591a (patch)
tree618827c2192b446bd6b8d8f72e99db268bd540d2 /tools/000_gendata/gendata.c
parent818186b480d7c05e0c58ff89da2180f5b2476434 (diff)
downloadnissy-core-bc2cba8529a163d129dec91b5ec448a29a14591a.tar.gz
nissy-core-bc2cba8529a163d129dec91b5ec448a29a14591a.zip
Added checkdata function
Diffstat (limited to 'tools/000_gendata/gendata.c')
-rw-r--r--tools/000_gendata/gendata.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/tools/000_gendata/gendata.c b/tools/000_gendata/gendata.c
new file mode 100644
index 0000000..78f81ab
--- /dev/null
+++ b/tools/000_gendata/gendata.c
@@ -0,0 +1,80 @@
1#include "../tool.h"
2
3char *solver, *options;
4uint64_t *expected;
5
6uint64_t expected_h48[12][9][21] = {
7 [0] = {
8 [2] = {
9 [0] = 5473562,
10 [1] = 34776317,
11 [2] = 68566704,
12 [3] = 8750867,
13 },
14 [4] = {
15 [0] = 1,
16 [1] = 1,
17 [2] = 4,
18 [3] = 34,
19 [4] = 331,
20 [5] = 3612,
21 [6] = 41605,
22 [7] = 474128,
23 [8] = 4953846,
24 [9] = 34776317,
25 [10] = 68566704,
26 [11] = 8749194,
27 [12] = 1673,
28 },
29 },
30};
31
32static void
33run(void) {
34 int64_t size;
35 char *buf, filename[1024];
36
37 getfilename(solver, options, filename);
38 size = generatetable(solver, options, &buf);
39 switch (size) {
40 case -1:
41 return;
42 case -2:
43 goto gendata_run_finish;
44 default:
45 nissy_datainfo(buf, write_stdout);
46 printf("\n");
47 printf("Succesfully generated %" PRId64 " bytes. "
48 "See above for details on the tables.\n", size);
49
50 writetable(buf, size, filename);
51 break;
52 }
53
54gendata_run_finish:
55 free(buf);
56}
57
58int main(int argc, char **argv) {
59 uint8_t h, k;
60 char description[256];
61
62 if (argc < 3) {
63 fprintf(stderr, "Error: not enough arguments."
64 "A solver and its options must be given.\n");
65 return 1;
66 }
67
68 solver = argv[1];
69 options = argv[2];
70 parse_h48_options(options, &h, &k, NULL);
71 expected = expected_h48[h][k];
72 sprintf(description, "benchmark gendata_h48 h = %" PRIu8
73 ", k = %" PRIu8 "", h, k);
74
75 nissy_setlogger(log_stderr);
76
77 timerun(run, description);
78
79 return 0;
80}

Generated with cgit - Back to sebastiano.tronto.net