diff options
Diffstat (limited to 'tools/gendata_h48')
| -rw-r--r-- | tools/gendata_h48/gendata_h48.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tools/gendata_h48/gendata_h48.c b/tools/gendata_h48/gendata_h48.c new file mode 100644 index 0000000..c8a6d12 --- /dev/null +++ b/tools/gendata_h48/gendata_h48.c | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | #include "../timerun.h" | ||
| 2 | #include "../../src/cube.h" | ||
| 3 | |||
| 4 | #define MAXDEPTH 20 | ||
| 5 | #define HVALUE 0 | ||
| 6 | #define OPTIONS "0;20" | ||
| 7 | #define LONGOPTIONS "h = 0, max depth = 20" | ||
| 8 | |||
| 9 | #define COCSEPSIZE 1119792 | ||
| 10 | #define ETABLESIZE(h) (((3393 * 495 * 70) >> 1) << (size_t)(h)) | ||
| 11 | |||
| 12 | char *buf; | ||
| 13 | |||
| 14 | void run(void) { | ||
| 15 | uint32_t *h48info; | ||
| 16 | int i; | ||
| 17 | int64_t s; | ||
| 18 | |||
| 19 | s = nissy_gendata("h48", OPTIONS, buf); | ||
| 20 | |||
| 21 | if (s == -1) { | ||
| 22 | printf("Error generating table\n"); | ||
| 23 | } else { | ||
| 24 | printf("Succesfully generated %" PRId64 " bytes. Table:\n", s); | ||
| 25 | h48info = (uint32_t *)buf + (ETABLESIZE(HVALUE) + COCSEPSIZE) / 4; | ||
| 26 | for (i = 0; i < MAXDEPTH+1; i++) | ||
| 27 | printf("%d:\t%" PRIu32 "\n", i, h48info[i+1]); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | int main(void) { | ||
| 32 | int64_t size; | ||
| 33 | |||
| 34 | nissy_setlogger(log_stderr); | ||
| 35 | |||
| 36 | size = nissy_datasize("h48", OPTIONS); | ||
| 37 | if (size == -1) { | ||
| 38 | printf("gendata_h48 benchmark: error in datasize\n"); | ||
| 39 | return 1; | ||
| 40 | } | ||
| 41 | |||
| 42 | buf = malloc(size); | ||
| 43 | |||
| 44 | timerun(run, "benchmark gendata_h48 " LONGOPTIONS); | ||
| 45 | |||
| 46 | free(buf); | ||
| 47 | |||
| 48 | return 0; | ||
| 49 | } | ||
