diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-11 19:24:15 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-11 22:10:42 +0200 |
| commit | c4f64cf2556c0f8597e1fbc19d7c664b8da94612 (patch) | |
| tree | 67cf5324d089dc8bafa255a5580556ba44361b0d /tools/200_stats_tables_h48 | |
| parent | 4668156da5915c8d7a7b40edaf6617b004547bd7 (diff) | |
| download | nissy-core-c4f64cf2556c0f8597e1fbc19d7c664b8da94612.tar.gz nissy-core-c4f64cf2556c0f8597e1fbc19d7c664b8da94612.zip | |
Added buffer sizes in API args
Diffstat (limited to 'tools/200_stats_tables_h48')
| -rw-r--r-- | tools/200_stats_tables_h48/stats_tables_h48.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/200_stats_tables_h48/stats_tables_h48.c b/tools/200_stats_tables_h48/stats_tables_h48.c index a9a2a1e..11df137 100644 --- a/tools/200_stats_tables_h48/stats_tables_h48.c +++ b/tools/200_stats_tables_h48/stats_tables_h48.c | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #define LOG_EVERY (NCUBES_PER_THREAD / 10) | 6 | #define LOG_EVERY (NCUBES_PER_THREAD / 10) |
| 7 | 7 | ||
| 8 | int NCUBES_PER_THREAD; | 8 | int NCUBES_PER_THREAD; |
| 9 | int64_t size = 0; | ||
| 9 | const char *solver = "h48stats"; | 10 | const char *solver = "h48stats"; |
| 10 | const char *filename = "tables/h48h0k4"; | 11 | const char *filename = "tables/h48h0k4"; |
| 11 | char *buf; | 12 | char *buf; |
| @@ -40,11 +41,12 @@ run_thread(void *arg) | |||
| 40 | cp = rand64(); | 41 | cp = rand64(); |
| 41 | co = rand64(); | 42 | co = rand64(); |
| 42 | nissy_getcube(ep, eo, cp, co, "fix", cube); | 43 | nissy_getcube(ep, eo, cp, co, "fix", cube); |
| 43 | nissy_solve(cube, "h48stats", "", 0, MAXMOVES, 1, -1, buf, s); | 44 | nissy_solve(cube, "h48stats", NISSY_NISSFLAG_NORMAL, |
| 45 | 0, MAXMOVES, 1, -1, size, buf, 12, s); | ||
| 44 | for (j = 0; j < 12; j++) | 46 | for (j = 0; j < 12; j++) |
| 45 | a->v[j][(int)s[j]]++; | 47 | a->v[j][(int)s[j]]++; |
| 46 | if ((i+1) % LOG_EVERY == 0) | 48 | if ((i+1) % LOG_EVERY == 0) |
| 47 | fprintf(stderr, "[thread %d] %d cubes solved...\n", | 49 | printf("[thread %d] %d cubes solved...\n", |
| 48 | a->thread_id, i+1); | 50 | a->thread_id, i+1); |
| 49 | } | 51 | } |
| 50 | 52 | ||
| @@ -57,6 +59,8 @@ void run(void) { | |||
| 57 | pthread_t thread[THREADS]; | 59 | pthread_t thread[THREADS]; |
| 58 | thread_arg_t arg[THREADS]; | 60 | thread_arg_t arg[THREADS]; |
| 59 | 61 | ||
| 62 | size = nissy_datasize(solver); | ||
| 63 | |||
| 60 | for (i = 0; i < THREADS; i++) { | 64 | for (i = 0; i < THREADS; i++) { |
| 61 | arg[i] = (thread_arg_t) { | 65 | arg[i] = (thread_arg_t) { |
| 62 | .thread_id = i, | 66 | .thread_id = i, |
| @@ -88,7 +92,7 @@ int main(int argc, char **argv) { | |||
| 88 | nissy_setlogger(log_stderr); | 92 | nissy_setlogger(log_stderr); |
| 89 | 93 | ||
| 90 | if (argc < 2) { | 94 | if (argc < 2) { |
| 91 | fprintf(stderr, "Error: not enough arguments. " | 95 | printf("Error: not enough arguments. " |
| 92 | "Number of cubes per thread must be provided.\n"); | 96 | "Number of cubes per thread must be provided.\n"); |
| 93 | return 1; | 97 | return 1; |
| 94 | } | 98 | } |
| @@ -96,7 +100,7 @@ int main(int argc, char **argv) { | |||
| 96 | NCUBES_PER_THREAD = atoi(argv[1]); | 100 | NCUBES_PER_THREAD = atoi(argv[1]); |
| 97 | 101 | ||
| 98 | if (NCUBES_PER_THREAD < 1 || NCUBES_PER_THREAD > 1000000) { | 102 | if (NCUBES_PER_THREAD < 1 || NCUBES_PER_THREAD > 1000000) { |
| 99 | fprintf(stderr, "Invalid number of cubes: must be > 0 and " | 103 | printf("Invalid number of cubes: must be > 0 and " |
| 100 | "< 1000000, but %d was given.\n", NCUBES_PER_THREAD); | 104 | "< 1000000, but %d was given.\n", NCUBES_PER_THREAD); |
| 101 | return 1; | 105 | return 1; |
| 102 | } | 106 | } |
