diff options
Diffstat (limited to 'src/solvers')
| -rw-r--r-- | src/solvers/distribution.h | 10 | ||||
| -rw-r--r-- | src/solvers/h48/distribution_h48.h | 10 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_h48.h | 14 | ||||
| -rw-r--r-- | src/solvers/h48/solve.h | 12 |
4 files changed, 23 insertions, 23 deletions
diff --git a/src/solvers/distribution.h b/src/solvers/distribution.h index e9302da..78b9b5e 100644 --- a/src/solvers/distribution.h +++ b/src/solvers/distribution.h | |||
| @@ -10,13 +10,13 @@ typedef struct { | |||
| 10 | const unsigned char *table; | 10 | const unsigned char *table; |
| 11 | } getdistribution_data_t; | 11 | } getdistribution_data_t; |
| 12 | 12 | ||
| 13 | STATIC void *getdistribution_runthread(void *); | 13 | STATIC wrapthread_return_t getdistribution_runthread(void *); |
| 14 | STATIC void getdistribution(const unsigned char *, | 14 | STATIC void getdistribution(const unsigned char *, |
| 15 | uint64_t [static INFO_DISTRIBUTION_LEN], const tableinfo_t [static 1]); | 15 | uint64_t [static INFO_DISTRIBUTION_LEN], const tableinfo_t [static 1]); |
| 16 | STATIC bool distribution_equal(const uint64_t [static INFO_DISTRIBUTION_LEN], | 16 | STATIC bool distribution_equal(const uint64_t [static INFO_DISTRIBUTION_LEN], |
| 17 | const uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t); | 17 | const uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t); |
| 18 | 18 | ||
| 19 | STATIC void * | 19 | STATIC wrapthread_return_t |
| 20 | getdistribution_runthread(void *arg) | 20 | getdistribution_runthread(void *arg) |
| 21 | { | 21 | { |
| 22 | getdistribution_data_t *data = (getdistribution_data_t *)arg; | 22 | getdistribution_data_t *data = (getdistribution_data_t *)arg; |
| @@ -33,7 +33,7 @@ getdistribution_runthread(void *arg) | |||
| 33 | for (j = 0; j < ENTRIES_PER_BYTE(k); j++) | 33 | for (j = 0; j < ENTRIES_PER_BYTE(k); j++) |
| 34 | data->distr[(table[i] & (m << (j*k))) >> (j*k)]++; | 34 | data->distr[(table[i] & (m << (j*k))) >> (j*k)]++; |
| 35 | 35 | ||
| 36 | return NULL; | 36 | return wrapthread_return_val; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | STATIC void | 39 | STATIC void |
| @@ -60,12 +60,12 @@ getdistribution( | |||
| 60 | .distr = local_distr[i], | 60 | .distr = local_distr[i], |
| 61 | .table = table, | 61 | .table = table, |
| 62 | }; | 62 | }; |
| 63 | wrapthread_create(&thread[i], NULL, | 63 | wrapthread_create(&thread[i], |
| 64 | getdistribution_runthread, &targ[i]); | 64 | getdistribution_runthread, &targ[i]); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | for (i = 0; i < THREADS; i++) | 67 | for (i = 0; i < THREADS; i++) |
| 68 | wrapthread_join(thread[i], NULL); | 68 | wrapthread_join(thread[i]); |
| 69 | 69 | ||
| 70 | memset(distr, 0, INFO_DISTRIBUTION_LEN * sizeof(uint64_t)); | 70 | memset(distr, 0, INFO_DISTRIBUTION_LEN * sizeof(uint64_t)); |
| 71 | for (i = 0; i < THREADS; i++) | 71 | for (i = 0; i < THREADS; i++) |
diff --git a/src/solvers/h48/distribution_h48.h b/src/solvers/h48/distribution_h48.h index 93a6933..80c946e 100644 --- a/src/solvers/h48/distribution_h48.h +++ b/src/solvers/h48/distribution_h48.h | |||
| @@ -4,11 +4,11 @@ needed for H48 because of the intertwined fallback table, and it is easier | |||
| 4 | to have some duplication than to make these functions needlessly generic. | 4 | to have some duplication than to make these functions needlessly generic. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | STATIC void *getdistribution_h48_runthread(void *); | 7 | STATIC wrapthread_return_t getdistribution_h48_runthread(void *); |
| 8 | STATIC void getdistribution_h48(const unsigned char *, | 8 | STATIC void getdistribution_h48(const unsigned char *, |
| 9 | uint64_t [static INFO_DISTRIBUTION_LEN], const tableinfo_t [static 1]); | 9 | uint64_t [static INFO_DISTRIBUTION_LEN], const tableinfo_t [static 1]); |
| 10 | 10 | ||
| 11 | STATIC void * | 11 | STATIC wrapthread_return_t |
| 12 | getdistribution_h48_runthread(void *arg) | 12 | getdistribution_h48_runthread(void *arg) |
| 13 | { | 13 | { |
| 14 | getdistribution_data_t *data = (getdistribution_data_t *)arg; | 14 | getdistribution_data_t *data = (getdistribution_data_t *)arg; |
| @@ -33,7 +33,7 @@ getdistribution_h48_runthread(void *arg) | |||
| 33 | data->distr[(t & (m << (3*k))) >> (3*k)]--; | 33 | data->distr[(t & (m << (3*k))) >> (3*k)]--; |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | return NULL; | 36 | return wrapthread_return_val; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | STATIC void | 39 | STATIC void |
| @@ -58,12 +58,12 @@ getdistribution_h48( | |||
| 58 | .distr = local_distr[i], | 58 | .distr = local_distr[i], |
| 59 | .table = table, | 59 | .table = table, |
| 60 | }; | 60 | }; |
| 61 | wrapthread_create(&thread[i], NULL, | 61 | wrapthread_create(&thread[i], |
| 62 | getdistribution_h48_runthread, &targ[i]); | 62 | getdistribution_h48_runthread, &targ[i]); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | for (i = 0; i < THREADS; i++) | 65 | for (i = 0; i < THREADS; i++) |
| 66 | wrapthread_join(thread[i], NULL); | 66 | wrapthread_join(thread[i]); |
| 67 | 67 | ||
| 68 | memset(distr, 0, INFO_DISTRIBUTION_LEN * sizeof(uint64_t)); | 68 | memset(distr, 0, INFO_DISTRIBUTION_LEN * sizeof(uint64_t)); |
| 69 | for (i = 0; i < THREADS; i++) | 69 | for (i = 0; i < THREADS; i++) |
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h index ef8a854..b37bcfb 100644 --- a/src/solvers/h48/gendata_h48.h +++ b/src/solvers/h48/gendata_h48.h | |||
| @@ -3,7 +3,7 @@ STATIC long long gendata_h48_dispatch( | |||
| 3 | STATIC uint64_t gendata_h48short(gendata_h48short_arg_t [static 1]); | 3 | STATIC uint64_t gendata_h48short(gendata_h48short_arg_t [static 1]); |
| 4 | STATIC int64_t gendata_h48(gendata_h48_arg_t [static 1]); | 4 | STATIC int64_t gendata_h48(gendata_h48_arg_t [static 1]); |
| 5 | STATIC void gendata_h48_maintable(gendata_h48_arg_t [static 1]); | 5 | STATIC void gendata_h48_maintable(gendata_h48_arg_t [static 1]); |
| 6 | STATIC void *gendata_h48_runthread(void *); | 6 | STATIC wrapthread_return_t gendata_h48_runthread(void *); |
| 7 | 7 | ||
| 8 | STATIC_INLINE void gendata_h48_mark(gendata_h48_mark_t [static 1]); | 8 | STATIC_INLINE void gendata_h48_mark(gendata_h48_mark_t [static 1]); |
| 9 | STATIC_INLINE bool gendata_h48_dfs_stop( | 9 | STATIC_INLINE bool gendata_h48_dfs_stop( |
| @@ -230,9 +230,9 @@ gendata_h48_maintable(gendata_h48_arg_t arg[static 1]) | |||
| 230 | 230 | ||
| 231 | inext = 0; | 231 | inext = 0; |
| 232 | count = 0; | 232 | count = 0; |
| 233 | wrapthread_mutex_init(&shortcubes_mutex, NULL); | 233 | wrapthread_mutex_init(&shortcubes_mutex); |
| 234 | for (i = 0; i < CHUNKS; i++) | 234 | for (i = 0; i < CHUNKS; i++) |
| 235 | wrapthread_mutex_init(&table_mutex[i], NULL); | 235 | wrapthread_mutex_init(&table_mutex[i]); |
| 236 | for (i = 0; i < THREADS; i++) { | 236 | for (i = 0; i < THREADS; i++) { |
| 237 | dfsarg[i] = (h48_dfs_arg_t){ | 237 | dfsarg[i] = (h48_dfs_arg_t){ |
| 238 | .h = arg->h, | 238 | .h = arg->h, |
| @@ -251,7 +251,7 @@ gendata_h48_maintable(gendata_h48_arg_t arg[static 1]) | |||
| 251 | dfsarg[i].table_mutex[ii] = &table_mutex[ii]; | 251 | dfsarg[i].table_mutex[ii] = &table_mutex[ii]; |
| 252 | 252 | ||
| 253 | wrapthread_create( | 253 | wrapthread_create( |
| 254 | &thread[i], NULL, gendata_h48_runthread, &dfsarg[i]); | 254 | &thread[i], gendata_h48_runthread, &dfsarg[i]); |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | if (NISSY_CANSLEEP) { | 257 | if (NISSY_CANSLEEP) { |
| @@ -281,7 +281,7 @@ gendata_h48_maintable(gendata_h48_arg_t arg[static 1]) | |||
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | for (i = 0; i < THREADS; i++) | 283 | for (i = 0; i < THREADS; i++) |
| 284 | wrapthread_join(thread[i], NULL); | 284 | wrapthread_join(thread[i]); |
| 285 | 285 | ||
| 286 | h48map_destroy(&shortcubes); | 286 | h48map_destroy(&shortcubes); |
| 287 | 287 | ||
| @@ -291,7 +291,7 @@ gendata_h48_maintable(gendata_h48_arg_t arg[static 1]) | |||
| 291 | writetableinfo(&arg->info, bufsize, (unsigned char *)arg->h48buf); | 291 | writetableinfo(&arg->info, bufsize, (unsigned char *)arg->h48buf); |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | STATIC void * | 294 | STATIC wrapthread_return_t |
| 295 | gendata_h48_runthread(void *arg) | 295 | gendata_h48_runthread(void *arg) |
| 296 | { | 296 | { |
| 297 | uint64_t coord, coordext, coordmin; | 297 | uint64_t coord, coordext, coordmin; |
| @@ -328,7 +328,7 @@ gendata_h48_runthread(void *arg) | |||
| 328 | } | 328 | } |
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | return NULL; | 331 | return wrapthread_return_val; |
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | STATIC void | 334 | STATIC void |
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index 15ac6ea..4fd0aea 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -78,7 +78,7 @@ STATIC_INLINE void h48_prune_restore_inverse(const h48_prune_t [static 1], | |||
| 78 | STATIC int64_t solve_h48_maketasks( | 78 | STATIC int64_t solve_h48_maketasks( |
| 79 | dfsarg_solve_h48_t [static 1], dfsarg_solve_h48_maketasks_t [static 1], | 79 | dfsarg_solve_h48_t [static 1], dfsarg_solve_h48_maketasks_t [static 1], |
| 80 | solve_h48_task_t [static H48_STARTING_CUBES], int [static 1]); | 80 | solve_h48_task_t [static H48_STARTING_CUBES], int [static 1]); |
| 81 | STATIC void *solve_h48_runthread(void *); | 81 | STATIC wrapthread_return_t solve_h48_runthread(void *); |
| 82 | STATIC int64_t solve_h48_dfs(dfsarg_solve_h48_t [static 1]); | 82 | STATIC int64_t solve_h48_dfs(dfsarg_solve_h48_t [static 1]); |
| 83 | STATIC void solve_h48_log_solutions(solution_list_t [static 1], size_t); | 83 | STATIC void solve_h48_log_solutions(solution_list_t [static 1], size_t); |
| 84 | STATIC int solve_h48_compare_tasks(const void *, const void *); | 84 | STATIC int solve_h48_compare_tasks(const void *, const void *); |
| @@ -383,7 +383,7 @@ solve_h48_dfs(dfsarg_solve_h48_t arg[static 1]) | |||
| 383 | return ret; | 383 | return ret; |
| 384 | } | 384 | } |
| 385 | 385 | ||
| 386 | STATIC void * | 386 | STATIC wrapthread_return_t |
| 387 | solve_h48_runthread(void *arg) | 387 | solve_h48_runthread(void *arg) |
| 388 | { | 388 | { |
| 389 | int i, j; | 389 | int i, j; |
| @@ -445,7 +445,7 @@ solve_h48_runthread(void *arg) | |||
| 445 | 445 | ||
| 446 | solve_h48_runthread_end: | 446 | solve_h48_runthread_end: |
| 447 | dfsarg->thread_done = true; | 447 | dfsarg->thread_done = true; |
| 448 | return NULL; | 448 | return wrapthread_return_val; |
| 449 | } | 449 | } |
| 450 | 450 | ||
| 451 | STATIC int64_t | 451 | STATIC int64_t |
| @@ -638,7 +638,7 @@ solve_h48( | |||
| 638 | 638 | ||
| 639 | } | 639 | } |
| 640 | 640 | ||
| 641 | wrapthread_mutex_init(&solutions_mutex, NULL); | 641 | wrapthread_mutex_init(&solutions_mutex); |
| 642 | 642 | ||
| 643 | mtarg = (dfsarg_solve_h48_maketasks_t) { | 643 | mtarg = (dfsarg_solve_h48_maketasks_t) { |
| 644 | .cube = oc.cube, | 644 | .cube = oc.cube, |
| @@ -689,7 +689,7 @@ solve_h48( | |||
| 689 | arg[i].target_depth = d; | 689 | arg[i].target_depth = d; |
| 690 | arg[i].thread_done = false; | 690 | arg[i].thread_done = false; |
| 691 | wrapthread_create( | 691 | wrapthread_create( |
| 692 | &thread[i], NULL, solve_h48_runthread, &arg[i]); | 692 | &thread[i], solve_h48_runthread, &arg[i]); |
| 693 | } | 693 | } |
| 694 | 694 | ||
| 695 | /* Log solutions and handle pause / stop / resume */ | 695 | /* Log solutions and handle pause / stop / resume */ |
| @@ -718,7 +718,7 @@ solve_h48( | |||
| 718 | } | 718 | } |
| 719 | 719 | ||
| 720 | for (i = 0; i < threads; i++) | 720 | for (i = 0; i < threads; i++) |
| 721 | wrapthread_join(thread[i], NULL); | 721 | wrapthread_join(thread[i]); |
| 722 | 722 | ||
| 723 | solve_h48_log_solutions(&sollist, lastused); | 723 | solve_h48_log_solutions(&sollist, lastused); |
| 724 | lastused = sollist.used; | 724 | lastused = sollist.used; |
