diff options
19 files changed, 520 insertions, 227 deletions
diff --git a/benchmarks/benchmarks.md b/benchmarks/benchmarks.md index baba515..4f36cac 100644 --- a/benchmarks/benchmarks.md +++ b/benchmarks/benchmarks.md | |||
| @@ -2,11 +2,18 @@ | |||
| 2 | 2 | ||
| 3 | This page contains some benchmarks for some of the possible | 3 | This page contains some benchmarks for some of the possible |
| 4 | configurations of the H48 optimal solver. For comparison we also | 4 | configurations of the H48 optimal solver. For comparison we also |
| 5 | include similar measurements for Andrew Skalski's impressive optimal | 5 | include similar measurements for two other optimal solvers: |
| 6 | solver [vcube](https://github.com/Voltara/vcube), which has been taken | 6 | |
| 7 | as a benchmark reference throughout the development of H48. The two | 7 | * Andrew Skalski's [vcube](https://github.com/Voltara/vcube), which |
| 8 | solvers differ both in method (although they both use an A* search) | 8 | is a truly impressive implementation of Tomas Rokicki's |
| 9 | and implementation. | 9 | [nxopt](https://github.com/rokicki/cube20src/blob/master/nxopt.md) |
| 10 | that has been taken as a reference throughout the development of H48. | ||
| 11 | This solver also uses an A* search, but the search is supported | ||
| 12 | by different pruning tables. | ||
| 13 | * Arhan Chaudhary's | ||
| 14 | [egg-solver](https://github.com/ArhanChaudhary/egg-solver), which | ||
| 15 | is an AI-generated implementation of the H48 method with | ||
| 16 | highly-optimized microthreading. | ||
| 10 | 17 | ||
| 11 | Similar benchmarks can be found: | 18 | Similar benchmarks can be found: |
| 12 | 19 | ||
| @@ -18,6 +25,8 @@ Similar benchmarks can be found: | |||
| 18 | * In Enrico Tenuti's [thesis](https://github.com/enricotenuti/h48thesis), | 25 | * In Enrico Tenuti's [thesis](https://github.com/enricotenuti/h48thesis), |
| 19 | also using an old implementation of H48, but including more data and | 26 | also using an old implementation of H48, but including more data and |
| 20 | nice plots. | 27 | nice plots. |
| 28 | * In [the documentation page](https://egg-solver/arhan.sh/docs/index.html) | ||
| 29 | for egg-solver. | ||
| 21 | 30 | ||
| 22 | ## Setting | 31 | ## Setting |
| 23 | 32 | ||
| @@ -43,8 +52,9 @@ All benchmark tests were done on the following configuration: | |||
| 43 | * CPU: AMD Ryzen 7 7700 (8 cores, 16 virtual threads) | 52 | * CPU: AMD Ryzen 7 7700 (8 cores, 16 virtual threads) |
| 44 | * Memory: 2x Corsair Vengeance 32GB 5600MHz | 53 | * Memory: 2x Corsair Vengeance 32GB 5600MHz |
| 45 | * Motherboard: Gigabyte B650M K | 54 | * Motherboard: Gigabyte B650M K |
| 46 | * Operating system: Debian 13 (Linux kernel 6.12.57) | 55 | * Operating system: Debian 13 (Linux kernel 6.12) |
| 47 | * Compiler: GCC 14.2.0 for H48 and Clang 19.1.7 for vcube | 56 | * Compilers: GCC 14.2.0 for H48, Chhang 19.1.7 for vcube and |
| 57 | cargo 1.99.1 for egg-solver | ||
| 48 | 58 | ||
| 49 | ## Benchmark results | 59 | ## Benchmark results |
| 50 | 60 | ||
| @@ -53,11 +63,11 @@ All benchmark tests were done on the following configuration: | |||
| 53 | The first test we performed was finding a single optimal solution, and | 63 | The first test we performed was finding a single optimal solution, and |
| 54 | we compared the results with vcube. | 64 | we compared the results with vcube. |
| 55 | 65 | ||
| 56 | This test was run in a single-thread configuration, because the two | 66 | This test was run in a single-thread configuration, because the three |
| 57 | solvers use very different strategies for multithreading: vcube can only | 67 | solvers use very different strategies for multithreading: vcube can only |
| 58 | parallelize by solving one cube per thread, while H48 is able to take | 68 | parallelize by solving one cube per thread, while H48 and egg-solver can |
| 59 | advantage of multiple threads even when solving a single cube. Therefore | 69 | take advantage of multiple threads even when solving a single cube. |
| 60 | we prefer to compare their single-threaded performance only. | 70 | Therefore we prefer to compare their single-threaded performance only. |
| 61 | 71 | ||
| 62 | Since the size of the pruning table used by the solver is of utmost | 72 | Since the size of the pruning table used by the solver is of utmost |
| 63 | importance, we include two statistics: time per cube and time per cube | 73 | importance, we include two statistics: time per cube and time per cube |
| @@ -67,40 +77,52 @@ leads to more even results across the board, although the speed of the | |||
| 67 | solvers of the same family does not scale exactly linearly with the size | 77 | solvers of the same family does not scale exactly linearly with the size |
| 68 | of the pruning table. | 78 | of the pruning table. |
| 69 | 79 | ||
| 70 | <!-- The following details block can be found in benchmarks/single_thread_comparison.md --> | 80 | <!-- The following details block can be found in benchmarks/tables_1_thread.md --> |
| 71 | <details><summary>Results: Single solution, single thread</summary> | 81 | <details><summary>Results: Single solution, single thread</summary> |
| 72 | 82 | ||
| 73 | Time per cube (in seconds, lower is better). | 83 | Time per cube (in seconds, lower is better). |
| 74 | 84 | ||
| 75 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 85 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 76 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 86 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 77 | |vcube 212 |58.2 GiB| 0.11| 0.75| 3.43| 27.28| 19.30| | 87 | |vcube 212 |58.2 GiB| 0.11| 0.75| 3.43| 27.28| 19.30| |
| 78 | |H48 h11 |56.5 GiB| 0.09| 0.50| 2.24| 15.73| 15.55| | 88 | |egg h11 |58.0 GiB| 0.01| 0.06| 0.24| 2.16| 0.14| |
| 89 | |H48 h11 |56.5 GiB| 0.08| 0.43| 1.86| 12.20| 15.39| | ||
| 79 | |vcube 404 |31.8 GiB| 0.23| 1.24| 6.10| 59.33| 268.26| | 90 | |vcube 404 |31.8 GiB| 0.23| 1.24| 6.10| 59.33| 268.26| |
| 80 | |H48 h10 |28.3 GiB| 0.15| 0.76| 3.36| 23.51| 38.05| | 91 | |egg h10 |29.0 GiB| 0.02| 0.10| 0.47| 4.00| 0.23| |
| 92 | |H48 h10 |28.3 GiB| 0.13| 0.69| 3.37| 23.15| 38.00| | ||
| 81 | |vcube 308 |21.2 GiB| 0.17| 1.02| 6.20| 58.70| 604.35| | 93 | |vcube 308 |21.2 GiB| 0.17| 1.02| 6.20| 58.70| 604.35| |
| 82 | |H48 h9 |14.1 GiB| 0.24| 1.48| 6.69| | | | 94 | |egg h9 |14.5 GiB| 0.03| 0.19| 0.91| | | |
| 95 | |H48 h9 |14.1 GiB| 0.22| 1.43| 6.56| | | | ||
| 83 | |vcube 208 | 7.3 GiB| 0.56| 4.36| 20.58| | | | 96 | |vcube 208 | 7.3 GiB| 0.56| 4.36| 20.58| | | |
| 84 | |H48 h8 | 7.1 GiB| 0.46| 3.36| 14.13| | | | 97 | |egg h8 | 7.2 GiB| 0.07| 0.39| 1.82| | | |
| 85 | |H48 h7 | 3.5 GiB| 0.63| 4.85| 23.25| | | | 98 | |H48 h8 | 7.1 GiB| 0.46| 3.43| 14.18| | | |
| 99 | |egg h7 | 3.6 GiB| 0.11| 0.81| 4.35| | | | ||
| 100 | |H48 h7 | 3.5 GiB| 0.63| 4.84| 23.31| | | | ||
| 86 | |vcube 112 | 2.4 GiB| 0.96| 9.29| 40.52| | | | 101 | |vcube 112 | 2.4 GiB| 0.96| 9.29| 40.52| | | |
| 87 | |H48 h6 | 1.8 GiB| 1.25| 9.45| 46.31| | | | 102 | |egg h6 | 1.8 GiB| 0.20| 1.53| 8.19| | | |
| 103 | |H48 h6 | 1.8 GiB| 1.26| 9.51| 47.14| | | | ||
| 88 | 104 | ||
| 89 | Time per cube adjusted for table size (in seconds \* GiB, lower is better). | 105 | Time per cube adjusted for table size (in seconds \* GiB, lower is better). |
| 90 | 106 | ||
| 91 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 107 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 92 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 108 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 93 | |vcube 212 |58.2 GiB| 6.43| 43.80| 199.38| 1587.43| 1122.73| | 109 | |vcube 212 |58.2 GiB| 6.43| 43.80| 199.38| 1587.43| 1122.73| |
| 94 | |H48 h11 |56.5 GiB| 5.21| 28.28| 126.68| 889.01| 878.77| | 110 | |egg h11 |58.0 GiB| 0.55| 3.31| 13.99| 125.17| 8.04| |
| 111 | |H48 h11 |56.5 GiB| 4.56| 24.55| 104.96| 689.22| 869.37| | ||
| 95 | |vcube 404 |31.8 GiB| 7.40| 39.47| 194.01| 1887.94| 8535.87| | 112 | |vcube 404 |31.8 GiB| 7.40| 39.47| 194.01| 1887.94| 8535.87| |
| 96 | |H48 h10 |28.3 GiB| 4.22| 21.37| 94.86| 664.22| 1075.08| | 113 | |egg h10 |29.0 GiB| 0.50| 2.90| 13.69| 115.88| 6.80| |
| 114 | |H48 h10 |28.3 GiB| 3.62| 19.45| 95.15| 654.05| 1073.69| | ||
| 97 | |vcube 308 |21.2 GiB| 3.51| 21.71| 131.50| 1245.26| 12819.94| | 115 | |vcube 308 |21.2 GiB| 3.51| 21.71| 131.50| 1245.26| 12819.94| |
| 98 | |H48 h9 |14.1 GiB| 3.34| 20.97| 94.57| | | | 116 | |egg h9 |14.5 GiB| 0.47| 2.74| 13.19| | | |
| 117 | |H48 h9 |14.1 GiB| 3.11| 20.18| 92.68| | | | ||
| 99 | |vcube 208 | 7.3 GiB| 4.08| 31.74| 149.68| | | | 118 | |vcube 208 | 7.3 GiB| 4.08| 31.74| 149.68| | | |
| 100 | |H48 h8 | 7.1 GiB| 3.25| 23.75| 99.82| | | | 119 | |egg h8 | 7.2 GiB| 0.48| 2.82| 13.16| | | |
| 101 | |H48 h7 | 3.5 GiB| 2.22| 17.12| 82.14| | | | 120 | |H48 h8 | 7.1 GiB| 3.23| 24.26| 100.15| | | |
| 121 | |egg h7 | 3.6 GiB| 0.39| 2.94| 15.77| | | | ||
| 122 | |H48 h7 | 3.5 GiB| 2.22| 17.12| 82.35| | | | ||
| 102 | |vcube 112 | 2.4 GiB| 2.33| 22.53| 98.23| | | | 123 | |vcube 112 | 2.4 GiB| 2.33| 22.53| 98.23| | | |
| 103 | |H48 h6 | 1.8 GiB| 2.21| 16.70| 81.86| | | | 124 | |egg h6 | 1.8 GiB| 0.36| 2.76| 14.83| | | |
| 125 | |H48 h6 | 1.8 GiB| 2.24| 16.80| 83.33| | | | ||
| 104 | 126 | ||
| 105 | <img src="img/17moves1thread.png"> | 127 | <img src="img/17moves1thread.png"> |
| 106 | <img src="img/18moves1thread.png"> | 128 | <img src="img/18moves1thread.png"> |
| @@ -108,9 +130,13 @@ Time per cube adjusted for table size (in seconds \* GiB, lower is better). | |||
| 108 | <img src="img/20moves1thread.png"> | 130 | <img src="img/20moves1thread.png"> |
| 109 | </details> | 131 | </details> |
| 110 | 132 | ||
| 111 | As we can see, adjusting for table size, H48 is generally faster than | 133 | As we can see, egg-solver is the clear winner, consistently beating H48 by |
| 112 | vcube. The gap between the two solvers is larger for scrambles with | 134 | factors of 5.3x-8.8x for 17-19 moves scrambles, comparing tables of similar |
| 113 | longer optimal solutions. | 135 | size. Moreover, egg-solver is more than 100 times faster when solving the |
| 136 | superflip configuration. | ||
| 137 | |||
| 138 | Adjusting for table size, H48 is generally faster than vcube. The gap between | ||
| 139 | the two solvers is larger for scrambles with longer optimal solutions. | ||
| 114 | 140 | ||
| 115 | ### Single solution, multiple threads | 141 | ### Single solution, multiple threads |
| 116 | 142 | ||
| @@ -118,36 +144,48 @@ The same benchmark as before is repeated using 4 and 16 threads (recall | |||
| 118 | that the CPU used for these tests has 8 physical cores and 16 virtual | 144 | that the CPU used for these tests has 8 physical cores and 16 virtual |
| 119 | threads). | 145 | threads). |
| 120 | 146 | ||
| 121 | As mentioned above, we don't compare these results to vcube. Instead, | 147 | For the reasons mentioned above, we will only compare H48 and egg-solver |
| 122 | we compare them with the single-threaded results for H48 and we show | 148 | in this section. |
| 123 | how far the speedup factor is from a theoretically optimal 4x and 16x. | ||
| 124 | 149 | ||
| 125 | <!-- The following details block can be found in benchmarks/tables_4_threads.md --> | 150 | <!-- The following details block can be found in benchmarks/tables_4_threads.md --> |
| 126 | <details><summary>Results: Single solution, 4 threads</summary> | 151 | <details><summary>Results: Single solution, 4 threads</summary> |
| 127 | 152 | ||
| 128 | Time per cube (in seconds, lower is better). | 153 | Time per cube (in seconds, lower is better). |
| 129 | 154 | ||
| 130 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 155 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 131 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 156 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 132 | |H48 h11 |56.5 GiB| 0.04| 0.14| 0.60| 3.97| 4.19| | 157 | |egg h11 |58.0 GiB| 0.00| 0.01| 0.06| 0.55| 0.03| |
| 133 | |H48 h10 |28.3 GiB| 0.05| 0.20| 0.91| 6.65| 9.81| | 158 | |H48 h11 |56.5 GiB| 0.03| 0.13| 0.50| 3.24| 4.17| |
| 134 | |H48 h9 |14.1 GiB| 0.07| 0.39| 1.74| 12.54| 18.96| | 159 | |egg h10 |29.0 GiB| 0.00| 0.03| 0.12| 1.05| 0.09| |
| 135 | |H48 h8 | 7.1 GiB| 0.13| 0.90| 3.71| | | | 160 | |H48 h10 |28.3 GiB| 0.05| 0.18| 0.90| 6.21| 9.85| |
| 136 | |H48 h7 | 3.5 GiB| 0.17| 1.28| 6.12| | | | 161 | |egg h9 |14.5 GiB| 0.01| 0.05| 0.23| | | |
| 137 | |H48 h6 | 1.8 GiB| 0.33| 2.47| 12.22| | | | 162 | |H48 h9 |14.1 GiB| 0.07| 0.39| 1.73| 12.50| 18.97| |
| 163 | |egg h8 | 7.2 GiB| 0.02| 0.10| 0.48| | | | ||
| 164 | |H48 h8 | 7.1 GiB| 0.13| 0.91| 3.71| | | | ||
| 165 | |egg h7 | 3.6 GiB| 0.03| 0.21| 1.11| | | | ||
| 166 | |H48 h7 | 3.5 GiB| 0.18| 1.29| 6.19| | | | ||
| 167 | |egg h6 | 1.8 GiB| 0.05| 0.39| 2.11| | | | ||
| 168 | |H48 h6 | 1.8 GiB| 0.34| 2.48| 12.33| | | | ||
| 138 | 169 | ||
| 139 | Speed-up factor (higher is better). | 170 | Speed-up factor (higher is better). |
| 140 | 171 | ||
| 141 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 172 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 142 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 173 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 143 | |H48 h11 |56.5 GiB| 2.55| 3.46| 3.75| 3.96| 3.71| | 174 | |egg h11 |58.0 GiB| 3.77| 3.90| 3.89| 3.93| 5.42| |
| 144 | |H48 h10 |28.3 GiB| 3.09| 3.71| 3.67| 3.54| 3.88| | 175 | |H48 h11 |56.5 GiB| 2.51| 3.44| 3.75| 3.77| 3.69| |
| 145 | |H48 h9 |14.1 GiB| 3.25| 3.84| 3.85| | | | 176 | |egg h10 |29.0 GiB| 3.88| 3.77| 3.98| 3.81| 2.72| |
| 146 | |H48 h8 | 7.1 GiB| 3.53| 3.72| 3.81| | | | 177 | |H48 h10 |28.3 GiB| 2.79| 3.91| 3.75| 3.73| 3.86| |
| 147 | |H48 h7 | 3.5 GiB| 3.60| 3.78| 3.80| | | | 178 | |egg h9 |14.5 GiB| 3.90| 3.87| 3.88| | | |
| 148 | |H48 h6 | 1.8 GiB| 3.77| 3.82| 3.79| | | | 179 | |H48 h9 |14.1 GiB| 3.18| 3.66| 3.79| | | |
| 180 | |egg h8 | 7.2 GiB| 3.87| 3.91| 3.81| | | | ||
| 181 | |H48 h8 | 7.1 GiB| 3.48| 3.78| 3.82| | | | ||
| 182 | |egg h7 | 3.6 GiB| 3.87| 3.87| 3.93| | | | ||
| 183 | |H48 h7 | 3.5 GiB| 3.43| 3.75| 3.77| | | | ||
| 184 | |egg h6 | 1.8 GiB| 3.98| 3.90| 3.87| | | | ||
| 185 | |H48 h6 | 1.8 GiB| 3.73| 3.84| 3.82| | | | ||
| 149 | 186 | ||
| 150 | <img src="img/4threadsspeedupfactor.png"> | 187 | <img src="img/H48_4_threads_speedup_factor.png"> |
| 188 | <img src="img/egg_4_threads_speedup_factor.png"> | ||
| 151 | 189 | ||
| 152 | </details> | 190 | </details> |
| 153 | 191 | ||
| @@ -156,74 +194,92 @@ Speed-up factor (higher is better). | |||
| 156 | 194 | ||
| 157 | Time per cube (in seconds, lower is better). | 195 | Time per cube (in seconds, lower is better). |
| 158 | 196 | ||
| 159 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 197 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 160 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 198 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 161 | |H48 h11 |56.5 GiB| 0.02| 0.06| 0.22| 1.33| 1.84| | 199 | |egg h11 |58.0 GiB| 0.00| 0.01| 0.03| 0.27| 0.02| |
| 162 | |H48 h10 |28.3 GiB| 0.03| 0.08| 0.33| 2.34| 4.18| | 200 | |H48 h11 |56.5 GiB| 0.02| 0.06| 0.21| 1.16| 1.84| |
| 163 | |H48 h9 |14.1 GiB| 0.04| 0.15| 0.64| 4.45| 8.09| | 201 | |egg h10 |29.0 GiB| 0.00| 0.02| 0.09| 0.77| 0.04| |
| 164 | |H48 h8 | 7.1 GiB| 0.06| 0.34| 1.36| | | | 202 | |H48 h10 |28.3 GiB| 0.03| 0.08| 0.34| 2.24| 4.21| |
| 165 | |H48 h7 | 3.5 GiB| 0.07| 0.47| 2.20| | | | 203 | |egg h9 |14.5 GiB| 0.01| 0.04| 0.17| | | |
| 166 | |H48 h6 | 1.8 GiB| 0.13| 0.91| 4.39| | | | 204 | |H48 h9 |14.1 GiB| 0.03| 0.14| 0.64| 4.43| 8.04| |
| 205 | |egg h8 | 7.2 GiB| 0.01| 0.07| 0.33| | | | ||
| 206 | |H48 h8 | 7.1 GiB| 0.06| 0.30| 1.36| | | | ||
| 207 | |egg h7 | 3.6 GiB| 0.02| 0.15| 0.79| | | | ||
| 208 | |H48 h7 | 3.5 GiB| 0.08| 0.41| 2.20| | | | ||
| 209 | |egg h6 | 1.8 GiB| 0.04| 0.28| 1.53| | | | ||
| 210 | |H48 h6 | 1.8 GiB| 0.13| 0.77| 4.37| | | | ||
| 167 | 211 | ||
| 168 | Speed-up factor (higher is better). | 212 | Speed-up factor (higher is better). |
| 169 | 213 | ||
| 170 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 214 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 171 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 215 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 172 | |H48 h11 |56.5 GiB| 3.90| 8.14| 10.39| 11.86| 8.45| | 216 | |egg h11 |58.0 GiB| 5.56| 8.03| 8.00| 8.05| 8.45| |
| 173 | |H48 h10 |28.3 GiB| 5.72| 9.00| 10.03| 10.04| 9.09| | 217 | |H48 h11 |56.5 GiB| 3.73| 7.32| 8.87| 10.54| 8.35| |
| 174 | |H48 h9 |14.1 GiB| 6.56| 9.75| 10.53| | | | 218 | |egg h10 |29.0 GiB| 5.63| 5.58| 5.53| 5.18| 6.05| |
| 175 | |H48 h8 | 7.1 GiB| 8.08| 9.91| 10.40| | | | 219 | |H48 h10 |28.3 GiB| 4.76| 8.60| 9.84| 10.34| 9.03| |
| 176 | |H48 h7 | 3.5 GiB| 8.59| 10.30| 10.57| | | | 220 | |egg h9 |14.5 GiB| 5.46| 5.32| 5.35| | | |
| 177 | |H48 h6 | 1.8 GiB| 9.60| 10.39| 10.54| | | | 221 | |H48 h9 |14.1 GiB| 6.34| 10.07| 10.19| | | |
| 222 | |egg h8 | 7.2 GiB| 5.49| 5.50| 5.53| | | | ||
| 223 | |H48 h8 | 7.1 GiB| 7.51| 11.36| 10.43| | | | ||
| 224 | |egg h7 | 3.6 GiB| 5.33| 5.38| 5.48| | | | ||
| 225 | |H48 h7 | 3.5 GiB| 8.21| 11.75| 10.61| | | | ||
| 226 | |egg h6 | 1.8 GiB| 5.51| 5.42| 5.35| | | | ||
| 227 | |H48 h6 | 1.8 GiB| 9.38| 12.31| 10.80| | | | ||
| 178 | 228 | ||
| 179 | <img src="img/16threadsspeedupfactor.png"> | 229 | <img src="img/H48_16_threads_speedup_factor.png"> |
| 230 | <img src="img/egg_16_threads_speedup_factor.png"> | ||
| 180 | 231 | ||
| 181 | </details> | 232 | </details> |
| 182 | 233 | ||
| 183 | We can see that H48 scales pretty well with 4 threads, getting close | 234 | We can see that both egg-solver and H48 scale pretty well with 4 threads, |
| 184 | to the 4x theoretical maximum speedup in slower cases (small table or | 235 | getting close to the 4x theoretical maximum speedup in slower cases |
| 185 | long solutions). | 236 | (small table or long solutions). egg-solver managed to beat the 4x |
| 237 | speedup for the superflip, likely due to single-scramble variance, i.e. | ||
| 238 | the thread that found the solution stopped earlier. | ||
| 186 | 239 | ||
| 187 | In the 16 threads benchmark shows that, although the virtual threads | 240 | In the 16 threads benchmark shows that, although the virtual threads |
| 188 | help push us beyond the 8x theoretical speedup that would be provided | 241 | help push H48 beyond the 8x theoretical speedup that would be provided |
| 189 | by the 8 cores, we are nowhere near a 16x speedup. | 242 | by the 8 cores, it is nowhere near a 16x speedup. egg-solver seems |
| 243 | stuck around 5.5x speedup. | ||
| 190 | 244 | ||
| 191 | ### All solutions | 245 | ### All solutions |
| 192 | 246 | ||
| 193 | Finally, we ran a test on finding *all* optimal solutions which, as | 247 | Finally, we ran a test on finding *all* optimal solutions which, as |
| 194 | far as I know, is a use case not supported by vcube. For convenience, | 248 | far as I know, is a use case not supported by vcube or egg-solver. |
| 195 | this test is only run on 16 threads. | 249 | For convenience, this test is only run on 16 threads. |
| 196 | 250 | ||
| 197 | <!-- The following details block can be found in benchmarks/all_solutions.md --> | 251 | <!-- The following details block can be found in benchmarks/tables_all_solutions.md --> |
| 198 | <details><summary>Results: All solutions (16 threads)</summary> | 252 | <details><summary>Results: All solutions, 16 threads</summary> |
| 199 | 253 | ||
| 200 | Time per cube (in seconds, lower is better). | 254 | Time per cube (in seconds, lower is better). |
| 201 | 255 | ||
| 202 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 256 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 203 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 257 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 204 | |H48 h11 |56.5 GiB| 0.04| 0.26| 2.22| 18.96| 16.95| | 258 | |H48 h11 |56.5 GiB| 0.04| 0.24| 1.88| 3.88| 1.86| |
| 205 | |H48 h10 |28.3 GiB| 0.05| 0.42| 3.82| 34.42| 36.80| | 259 | |H48 h10 |28.3 GiB| 0.05| 0.39| 3.51| 7.54| 4.29| |
| 206 | |H48 h9 |14.1 GiB| 0.08| 0.73| 7.28| | | | 260 | |H48 h9 |14.1 GiB| 0.08| 0.73| 6.92| | | |
| 207 | |H48 h8 | 7.1 GiB| 0.15| 1.56| 15.41| | | | 261 | |H48 h8 | 7.1 GiB| 0.16| 1.54| 14.78| | | |
| 208 | |H48 h7 | 3.5 GiB| 0.21| 2.38| 26.52| | | | 262 | |H48 h7 | 3.5 GiB| 0.22| 2.37| 25.35| | | |
| 209 | |H48 h6 | 1.8 GiB| 0.39| 4.67| 53.00| | | | 263 | |H48 h6 | 1.8 GiB| 0.40| 4.58| 50.17| | | |
| 210 | 264 | ||
| 211 | Time per cube adjusted for table size (in seconds \* GiB, lower is better). | 265 | Time per cube adjusted for table size (in seconds \* GiB, lower is better). |
| 212 | 266 | ||
| 213 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 267 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 214 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 268 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 215 | |H48 h11 |56.5 GiB| 2.11| 14.55| 125.21| 1071.23| 957.47| | 269 | |H48 h11 |56.5 GiB| 2.00| 13.40| 106.21| 219.43| 105.10| |
| 216 | |H48 h10 |28.3 GiB| 1.48| 11.96| 107.83| 972.35| 1039.73| | 270 | |H48 h10 |28.3 GiB| 1.45| 11.13| 99.17| 212.94| 121.20| |
| 217 | |H48 h9 |14.1 GiB| 1.08| 10.29| 102.88| | | | 271 | |H48 h9 |14.1 GiB| 1.13| 10.25| 97.80| | | |
| 218 | |H48 h8 | 7.1 GiB| 1.03| 10.99| 108.87| | | | 272 | |H48 h8 | 7.1 GiB| 1.10| 10.85| 104.41| | | |
| 219 | |H48 h7 | 3.5 GiB| 0.74| 8.41| 93.69| | | | 273 | |H48 h7 | 3.5 GiB| 0.79| 8.38| 89.57| | | |
| 220 | |H48 h6 | 1.8 GiB| 0.70| 8.25| 93.68| | | | 274 | |H48 h6 | 1.8 GiB| 0.71| 8.10| 88.68| | | |
| 221 | 275 | ||
| 222 | </details> | 276 | </details> |
| 223 | 277 | ||
| 224 | ## Other notes | 278 | ## Other notes |
| 225 | 279 | ||
| 226 | * To repeat the benchmarks, use `./benchmarks/run-h48-benchmarks.sh`. | 280 | * To repeat the benchmarks for H48, use `./benchmarks/run-h48-benchmarks.sh`. |
| 281 | Similar scripts for vcube and egg-solver can be found in the `benchmarks` | ||
| 282 | folder. | ||
| 227 | * All the measurements above exclude the time needed to load the pruning | 283 | * All the measurements above exclude the time needed to load the pruning |
| 228 | tables into memory, which can be quite significant for large tables. | 284 | tables into memory, which can be quite significant for large tables. |
| 229 | * The measurements also excluded the one-off computation of the pruning | 285 | * The measurements also excluded the one-off computation of the pruning |
diff --git a/benchmarks/img/16threadsspeedupfactor.png b/benchmarks/img/16threadsspeedupfactor.png deleted file mode 100644 index 5dcaaef..0000000 --- a/benchmarks/img/16threadsspeedupfactor.png +++ /dev/null | |||
| Binary files differ | |||
diff --git a/benchmarks/img/17moves1thread.png b/benchmarks/img/17moves1thread.png index da78107..1ade3f3 100644 --- a/benchmarks/img/17moves1thread.png +++ b/benchmarks/img/17moves1thread.png | |||
| Binary files differ | |||
diff --git a/benchmarks/img/18moves1thread.png b/benchmarks/img/18moves1thread.png index c9406fa..0281d4f 100644 --- a/benchmarks/img/18moves1thread.png +++ b/benchmarks/img/18moves1thread.png | |||
| Binary files differ | |||
diff --git a/benchmarks/img/19moves1thread.png b/benchmarks/img/19moves1thread.png index 8400584..17c0d46 100644 --- a/benchmarks/img/19moves1thread.png +++ b/benchmarks/img/19moves1thread.png | |||
| Binary files differ | |||
diff --git a/benchmarks/img/20moves1thread.png b/benchmarks/img/20moves1thread.png index 879448d..7ed910f 100644 --- a/benchmarks/img/20moves1thread.png +++ b/benchmarks/img/20moves1thread.png | |||
| Binary files differ | |||
diff --git a/benchmarks/img/4threadsspeedupfactor.png b/benchmarks/img/4threadsspeedupfactor.png deleted file mode 100644 index 49badc4..0000000 --- a/benchmarks/img/4threadsspeedupfactor.png +++ /dev/null | |||
| Binary files differ | |||
diff --git a/benchmarks/img/H48_16_threads_speedup_factor.png b/benchmarks/img/H48_16_threads_speedup_factor.png new file mode 100644 index 0000000..1bbd2f8 --- /dev/null +++ b/benchmarks/img/H48_16_threads_speedup_factor.png | |||
| Binary files differ | |||
diff --git a/benchmarks/img/H48_4_threads_speedup_factor.png b/benchmarks/img/H48_4_threads_speedup_factor.png new file mode 100644 index 0000000..40cf8ec --- /dev/null +++ b/benchmarks/img/H48_4_threads_speedup_factor.png | |||
| Binary files differ | |||
diff --git a/benchmarks/img/egg_16_threads_speedup_factor.png b/benchmarks/img/egg_16_threads_speedup_factor.png new file mode 100644 index 0000000..3c4a81b --- /dev/null +++ b/benchmarks/img/egg_16_threads_speedup_factor.png | |||
| Binary files differ | |||
diff --git a/benchmarks/img/egg_4_threads_speedup_factor.png b/benchmarks/img/egg_4_threads_speedup_factor.png new file mode 100644 index 0000000..a00746a --- /dev/null +++ b/benchmarks/img/egg_4_threads_speedup_factor.png | |||
| Binary files differ | |||
diff --git a/benchmarks/plot-benchmarks.py b/benchmarks/plot-benchmarks.py index 1a6fc39..dfd1f90 100644 --- a/benchmarks/plot-benchmarks.py +++ b/benchmarks/plot-benchmarks.py | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | import matplotlib.pyplot as plt | 1 | import matplotlib.pyplot as plt |
| 2 | import results_h48 | 2 | import results_h48 |
| 3 | import results_vcube | 3 | import results_vcube |
| 4 | import results_egg | ||
| 4 | from pathlib import Path | 5 | from pathlib import Path |
| 5 | 6 | ||
| 6 | benchmarks_dir = Path("benchmarks") | 7 | benchmarks_dir = Path("benchmarks") |
| @@ -29,6 +30,15 @@ sizes_vcube = { | |||
| 29 | 212: 62474158080, | 30 | 212: 62474158080, |
| 30 | } | 31 | } |
| 31 | 32 | ||
| 33 | sizes_egg = { | ||
| 34 | 6: 1945686016, | ||
| 35 | 7: 3891367936, | ||
| 36 | 8: 7782731776, | ||
| 37 | 9: 15565459456, | ||
| 38 | 10: 31130914816, | ||
| 39 | 11: 62261825536, | ||
| 40 | } | ||
| 41 | |||
| 32 | # Printing tables in markdown format | 42 | # Printing tables in markdown format |
| 33 | 43 | ||
| 34 | def print_row(f, solver_name, solver_size, dict, mul_by_size, superflip_star): | 44 | def print_row(f, solver_name, solver_size, dict, mul_by_size, superflip_star): |
| @@ -46,48 +56,94 @@ def print_row(f, solver_name, solver_size, dict, mul_by_size, superflip_star): | |||
| 46 | sep = "|" | 56 | sep = "|" |
| 47 | f.write(sep + sep.join(cols) + sep + "\n") | 57 | f.write(sep + sep.join(cols) + sep + "\n") |
| 48 | 58 | ||
| 49 | def print_table(f, h48, vcube, ms, st): | 59 | def print_table(f, h48, vcube, egg, ms, st): |
| 50 | vcube = vcube or {} | 60 | vcube = vcube or {} |
| 51 | f.write("| Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip|\n") | 61 | egg = egg or {} |
| 52 | f.write("|:---------|:-------|-------:|-------:|-------:|-------:|--------:|\n") | 62 | f.write("|Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip|\n") |
| 63 | f.write("|:-----|:---|-------:|-------:|-------:|-------:|--------:|\n") | ||
| 53 | print_row(f, "vcube 212", sizes_vcube[212], vcube.get(212), ms, not st) | 64 | print_row(f, "vcube 212", sizes_vcube[212], vcube.get(212), ms, not st) |
| 65 | print_row(f, "egg h11", sizes_egg[11], egg.get(11), ms, False) | ||
| 54 | print_row(f, "H48 h11", sizes_h48[11], h48[11], ms, False) | 66 | print_row(f, "H48 h11", sizes_h48[11], h48[11], ms, False) |
| 55 | print_row(f, "vcube 404", sizes_vcube[404], vcube.get(404), ms, not st) | 67 | print_row(f, "vcube 404", sizes_vcube[404], vcube.get(404), ms, not st) |
| 68 | print_row(f, "egg h10", sizes_egg[10], egg.get(10), ms, False) | ||
| 56 | print_row(f, "H48 h10", sizes_h48[10], h48[10], ms, False) | 69 | print_row(f, "H48 h10", sizes_h48[10], h48[10], ms, False) |
| 57 | print_row(f, "vcube 308", sizes_vcube[308], vcube.get(308), ms, not st) | 70 | print_row(f, "vcube 308", sizes_vcube[308], vcube.get(308), ms, not st) |
| 71 | print_row(f, "egg h9", sizes_egg[9], egg.get(9), ms, False) | ||
| 58 | print_row(f, "H48 h9", sizes_h48[9], h48[9], ms, False) | 72 | print_row(f, "H48 h9", sizes_h48[9], h48[9], ms, False) |
| 59 | print_row(f, "vcube 208", sizes_vcube[208], vcube.get(208), ms, not st) | 73 | print_row(f, "vcube 208", sizes_vcube[208], vcube.get(208), ms, not st) |
| 74 | print_row(f, "egg h8", sizes_egg[8], egg.get(8), ms, False) | ||
| 60 | print_row(f, "H48 h8", sizes_h48[8], h48[8], ms, False) | 75 | print_row(f, "H48 h8", sizes_h48[8], h48[8], ms, False) |
| 76 | print_row(f, "egg h7", sizes_egg[7], egg.get(7), ms, False) | ||
| 61 | print_row(f, "H48 h7", sizes_h48[7], h48[7], ms, False) | 77 | print_row(f, "H48 h7", sizes_h48[7], h48[7], ms, False) |
| 62 | print_row(f, "vcube 112", sizes_vcube[112], vcube.get(112), ms, not st) | 78 | print_row(f, "vcube 112", sizes_vcube[112], vcube.get(112), ms, not st) |
| 79 | print_row(f, "egg h6", sizes_egg[6], egg.get(6), ms, False) | ||
| 63 | print_row(f, "H48 h6", sizes_h48[6], h48[6], ms, False) | 80 | print_row(f, "H48 h6", sizes_h48[6], h48[6], ms, False) |
| 64 | 81 | ||
| 65 | def print_factor_table(f, slow, fast): | 82 | def print_factor_table(f, slow_h48, fast_h48, slow_egg, fast_egg): |
| 66 | ratio = {} | 83 | ratio_h48 = {} |
| 84 | ratio_egg = {} | ||
| 67 | for m in [6, 7, 8, 9, 10, 11]: | 85 | for m in [6, 7, 8, 9, 10, 11]: |
| 68 | ratio[m] = {} | 86 | ratio_h48[m] = {} |
| 69 | for k in slow[m]: | 87 | ratio_egg[m] = {} |
| 70 | ratio[m][k] = (slow[m][k] / fast[m][k]) * (25 if k != "superflip" else 1) | 88 | for k in slow_h48[m]: |
| 71 | f.write("| Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip|\n") | 89 | ratio_h48[m][k] = ( |
| 72 | f.write("|:---------|:-------|-------:|-------:|-------:|-------:|--------:|\n") | 90 | (slow_h48[m][k] / fast_h48[m][k]) * |
| 73 | print_row(f, "H48 h11", sizes_h48[11], ratio[11], False, False) | 91 | (25 if k != "superflip" else 1) |
| 74 | print_row(f, "H48 h10", sizes_h48[10], ratio[10], False, False) | 92 | ) |
| 75 | print_row(f, "H48 h9", sizes_h48[9], ratio[9], False, False) | 93 | for k in slow_egg[m]: |
| 76 | print_row(f, "H48 h8", sizes_h48[8], ratio[8], False, False) | 94 | ratio_egg[m][k] = ( |
| 77 | print_row(f, "H48 h7", sizes_h48[7], ratio[7], False, False) | 95 | (slow_egg[m][k] / fast_egg[m][k]) * |
| 78 | print_row(f, "H48 h6", sizes_h48[6], ratio[6], False, False) | 96 | (25 if k != "superflip" else 1) |
| 97 | ) | ||
| 98 | f.write("|Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip|\n") | ||
| 99 | f.write("|:-----|:---|-------:|-------:|-------:|-------:|--------:|\n") | ||
| 100 | print_row(f, "egg h11", sizes_egg[11], ratio_egg[11], False, False) | ||
| 101 | print_row(f, "H48 h11", sizes_h48[11], ratio_h48[11], False, False) | ||
| 102 | print_row(f, "egg h10", sizes_egg[10], ratio_egg[10], False, False) | ||
| 103 | print_row(f, "H48 h10", sizes_h48[10], ratio_h48[10], False, False) | ||
| 104 | print_row(f, "egg h9", sizes_egg[9], ratio_egg[9], False, False) | ||
| 105 | print_row(f, "H48 h9", sizes_h48[9], ratio_h48[9], False, False) | ||
| 106 | print_row(f, "egg h8", sizes_egg[8], ratio_egg[8], False, False) | ||
| 107 | print_row(f, "H48 h8", sizes_h48[8], ratio_h48[8], False, False) | ||
| 108 | print_row(f, "egg h7", sizes_egg[7], ratio_egg[7], False, False) | ||
| 109 | print_row(f, "H48 h7", sizes_h48[7], ratio_h48[7], False, False) | ||
| 110 | print_row(f, "egg h6", sizes_egg[6], ratio_egg[6], False, False) | ||
| 111 | print_row(f, "H48 h6", sizes_h48[6], ratio_h48[6], False, False) | ||
| 79 | 112 | ||
| 80 | with open(benchmarks_single_thread, "w") as f: | 113 | with open(benchmarks_single_thread, "w") as f: |
| 81 | f.write(f"<!-- The following details block can be found in {benchmarks_single_thread} -->\n") | 114 | f.write( |
| 82 | f.write("<details><summary>Results: Single solution, single thread</summary>\n") | 115 | "<!-- The following details block can " |
| 116 | f"be found in {benchmarks_single_thread} -->\n" | ||
| 117 | ) | ||
| 118 | f.write( | ||
| 119 | "<details><summary>Results: Single solution, " | ||
| 120 | "single thread</summary>\n" | ||
| 121 | ) | ||
| 83 | f.write("\n") | 122 | f.write("\n") |
| 84 | f.write("Time per cube (in seconds, lower is better).\n") | 123 | f.write("Time per cube (in seconds, lower is better).\n") |
| 85 | f.write("\n") | 124 | f.write("\n") |
| 86 | print_table(f, results_h48.h48_single_thread, results_vcube.vcube_single_thread, False, True) | 125 | print_table( |
| 126 | f, | ||
| 127 | results_h48.h48_single_thread, | ||
| 128 | results_vcube.vcube_single_thread, | ||
| 129 | results_egg.egg_single_thread, | ||
| 130 | False, | ||
| 131 | True, | ||
| 132 | ) | ||
| 87 | f.write("\n") | 133 | f.write("\n") |
| 88 | f.write("Time per cube adjusted for table size (in seconds \\* GiB, lower is better).\n") | 134 | f.write( |
| 135 | "Time per cube adjusted for table size " | ||
| 136 | "(in seconds \\* GiB, lower is better).\n" | ||
| 137 | ) | ||
| 89 | f.write("\n") | 138 | f.write("\n") |
| 90 | print_table(f, results_h48.h48_single_thread, results_vcube.vcube_single_thread, True, True) | 139 | print_table( |
| 140 | f, | ||
| 141 | results_h48.h48_single_thread, | ||
| 142 | results_vcube.vcube_single_thread, | ||
| 143 | results_egg.egg_single_thread, | ||
| 144 | True, | ||
| 145 | True, | ||
| 146 | ) | ||
| 91 | f.write("\n") | 147 | f.write("\n") |
| 92 | f.write( | 148 | f.write( |
| 93 | '<img src="img/17moves1thread.png">\n' | 149 | '<img src="img/17moves1thread.png">\n' |
| @@ -98,59 +154,114 @@ with open(benchmarks_single_thread, "w") as f: | |||
| 98 | f.write("</details>\n") | 154 | f.write("</details>\n") |
| 99 | 155 | ||
| 100 | with open(benchmarks_4_threads, "w") as f: | 156 | with open(benchmarks_4_threads, "w") as f: |
| 101 | f.write(f"<!-- The following details block can be found in {benchmarks_4_threads} -->\n") | 157 | f.write( |
| 102 | f.write("<details><summary>Results: Single solution, 4 threads</summary>\n") | 158 | "<!-- The following details block can " |
| 159 | f"be found in {benchmarks_4_threads} -->\n" | ||
| 160 | ) | ||
| 161 | f.write( | ||
| 162 | "<details><summary>Results: Single solution, " | ||
| 163 | "4 threads</summary>\n" | ||
| 164 | ) | ||
| 103 | f.write("\n") | 165 | f.write("\n") |
| 104 | f.write("Time per cube (in seconds, lower is better).\n") | 166 | f.write("Time per cube (in seconds, lower is better).\n") |
| 105 | f.write("\n") | 167 | f.write("\n") |
| 106 | print_table(f, results_h48.h48_4_threads, None, False, False) | 168 | print_table( |
| 169 | f, | ||
| 170 | results_h48.h48_4_threads, | ||
| 171 | None, | ||
| 172 | results_egg.egg_4_threads, | ||
| 173 | False, | ||
| 174 | False, | ||
| 175 | ) | ||
| 107 | f.write("\n") | 176 | f.write("\n") |
| 108 | f.write("Speed-up factor (higher is better).\n") | 177 | f.write("Speed-up factor (higher is better).\n") |
| 109 | f.write("\n") | 178 | f.write("\n") |
| 110 | print_factor_table(f, results_h48.h48_single_thread, results_h48.h48_4_threads) | 179 | print_factor_table( |
| 180 | f, | ||
| 181 | results_h48.h48_single_thread, | ||
| 182 | results_h48.h48_4_threads, | ||
| 183 | results_egg.egg_single_thread, | ||
| 184 | results_egg.egg_4_threads, | ||
| 185 | ) | ||
| 111 | f.write("\n") | 186 | f.write("\n") |
| 112 | f.write('<img src="img/4threadsspeedupfactor.png">\n') | 187 | f.write( |
| 188 | '<img src="img/H48_4_threads_speedup_factor.png">\n' | ||
| 189 | '<img src="img/egg_4_threads_speedup_factor.png">\n' | ||
| 190 | ) | ||
| 113 | f.write("\n") | 191 | f.write("\n") |
| 114 | f.write("</details>\n") | 192 | f.write("</details>\n") |
| 115 | 193 | ||
| 116 | with open(benchmarks_16_threads, "w") as f: | 194 | with open(benchmarks_16_threads, "w") as f: |
| 117 | f.write(f"<!-- The following details block can be found in {benchmarks_16_threads} -->\n") | 195 | f.write( |
| 118 | f.write("<details><summary>Results: Single solution, 16 threads</summary>\n") | 196 | "<!-- The following details block can " |
| 197 | f"be found in {benchmarks_16_threads} -->\n" | ||
| 198 | ) | ||
| 199 | f.write( | ||
| 200 | "<details><summary>Results: Single solution, " | ||
| 201 | "16 threads</summary>\n" | ||
| 202 | ) | ||
| 119 | f.write("\n") | 203 | f.write("\n") |
| 120 | f.write("Time per cube (in seconds, lower is better).\n") | 204 | f.write("Time per cube (in seconds, lower is better).\n") |
| 121 | f.write("\n") | 205 | f.write("\n") |
| 122 | print_table(f, results_h48.h48_16_threads, None, False, False) | 206 | print_table( |
| 207 | f, | ||
| 208 | results_h48.h48_16_threads, | ||
| 209 | None, | ||
| 210 | results_egg.egg_16_threads, | ||
| 211 | False, | ||
| 212 | False, | ||
| 213 | ) | ||
| 123 | f.write("\n") | 214 | f.write("\n") |
| 124 | f.write("Speed-up factor (higher is better).\n") | 215 | f.write("Speed-up factor (higher is better).\n") |
| 125 | f.write("\n") | 216 | f.write("\n") |
| 126 | print_factor_table(f, results_h48.h48_single_thread, results_h48.h48_16_threads) | 217 | print_factor_table( |
| 218 | f, | ||
| 219 | results_h48.h48_single_thread, | ||
| 220 | results_h48.h48_16_threads, | ||
| 221 | results_egg.egg_single_thread, | ||
| 222 | results_egg.egg_16_threads, | ||
| 223 | ) | ||
| 127 | f.write("\n") | 224 | f.write("\n") |
| 128 | f.write('<img src="img/16threadsspeedupfactor.png">\n') | 225 | f.write( |
| 226 | '<img src="img/H48_16_threads_speedup_factor.png">\n' | ||
| 227 | '<img src="img/egg_16_threads_speedup_factor.png">\n' | ||
| 228 | ) | ||
| 129 | f.write("\n") | 229 | f.write("\n") |
| 130 | f.write("</details>\n") | 230 | f.write("</details>\n") |
| 131 | 231 | ||
| 132 | with open(benchmarks_all_solutions, "w") as f: | 232 | with open(benchmarks_all_solutions, "w") as f: |
| 133 | f.write(f"<!-- The following details block can be found in {benchmarks_all_solutions} -->\n") | 233 | f.write( |
| 134 | f.write("<details><summary>Results: All solutions, 16 threads</summary>\n") | 234 | "<!-- The following details block can " |
| 235 | f"be found in {benchmarks_all_solutions} -->\n" | ||
| 236 | ) | ||
| 237 | f.write( | ||
| 238 | "<details><summary>Results: All solutions, " | ||
| 239 | "16 threads</summary>\n" | ||
| 240 | ) | ||
| 135 | f.write("\n") | 241 | f.write("\n") |
| 136 | f.write("Time per cube (in seconds, lower is better).\n") | 242 | f.write("Time per cube (in seconds, lower is better).\n") |
| 137 | f.write("\n") | 243 | f.write("\n") |
| 138 | print_table(f, results_h48.h48_all_solutions, None, False, False) | 244 | print_table(f, results_h48.h48_all_solutions, None, None, False, False) |
| 139 | f.write("\n") | 245 | f.write("\n") |
| 140 | f.write("Time per cube adjusted for table size (in seconds \\* GiB, lower is better).\n") | 246 | f.write( |
| 247 | "Time per cube adjusted for table size " | ||
| 248 | "(in seconds \\* GiB, lower is better).\n" | ||
| 249 | ) | ||
| 141 | f.write("\n") | 250 | f.write("\n") |
| 142 | print_table(f, results_h48.h48_all_solutions, None, True, False) | 251 | print_table(f, results_h48.h48_all_solutions, None, None, True, False) |
| 143 | f.write("\n") | 252 | f.write("\n") |
| 144 | f.write("</details>\n") | 253 | f.write("</details>\n") |
| 145 | 254 | ||
| 146 | # Plotting | 255 | # Plotting |
| 147 | 256 | ||
| 148 | def plot_comparison(title, hd, vd, key): | 257 | def plot_comparison(title, hd, vd, ed, key): |
| 149 | d = 1 if key == "superflip" else 25 | 258 | d = 1 if key == "superflip" else 25 |
| 150 | h48x = [sizes_h48[m]/(2**30) for m in hd.keys() if key in hd[m]] | 259 | h48x = [sizes_h48[m]/(2**30) for m in hd.keys() if key in hd[m]] |
| 151 | vcubex = [sizes_vcube[m]/(2**30) for m in vd.keys() if key in vd[m]] | 260 | vcubex = [sizes_vcube[m]/(2**30) for m in vd.keys() if key in vd[m]] |
| 261 | eggx = [sizes_egg[m]/(2**30) for m in ed.keys() if key in ed[m]] | ||
| 152 | h48y = [d[key] for _, d in hd.items() if key in d] | 262 | h48y = [d[key] for _, d in hd.items() if key in d] |
| 153 | vcubey = [d[key] for _, d in vd.items() if key in d] | 263 | vcubey = [d[key] for _, d in vd.items() if key in d] |
| 264 | eggy = [d[key] for _, d in ed.items() if key in d] | ||
| 154 | 265 | ||
| 155 | plt.clf() | 266 | plt.clf() |
| 156 | plt.title(title) | 267 | plt.title(title) |
| @@ -158,14 +269,17 @@ def plot_comparison(title, hd, vd, key): | |||
| 158 | plt.ylabel("Time to solve (s / cube)") | 269 | plt.ylabel("Time to solve (s / cube)") |
| 159 | plt.plot(h48x, h48y, "o--", label = "H48") | 270 | plt.plot(h48x, h48y, "o--", label = "H48") |
| 160 | plt.plot(vcubex, vcubey, "o--", label = "vcube") | 271 | plt.plot(vcubex, vcubey, "o--", label = "vcube") |
| 272 | plt.plot(eggx, eggy, "o--", label = "egg") | ||
| 161 | plt.legend(loc = "right") | 273 | plt.legend(loc = "right") |
| 162 | filename = title.replace(" ", "").replace(",", "") + ".png" | 274 | filename = title.replace(" ", "").replace(",", "") + ".png" |
| 163 | plt.savefig(benchmarks_img_dir / filename, dpi=300) | 275 | plt.savefig(benchmarks_img_dir / filename, dpi=300) |
| 164 | #plt.show() | 276 | #plt.show() |
| 165 | 277 | ||
| 166 | rh, rv = results_h48.h48_single_thread, results_vcube.vcube_single_thread | 278 | rh = results_h48.h48_single_thread |
| 279 | rv = results_vcube.vcube_single_thread | ||
| 280 | re = results_egg.egg_single_thread | ||
| 167 | for m in [17, 18, 19, 20]: | 281 | for m in [17, 18, 19, 20]: |
| 168 | plot_comparison(f"{m} moves 1 thread", rh, rv, m) | 282 | plot_comparison(f"{m} moves 1 thread", rh, rv, re, m) |
| 169 | 283 | ||
| 170 | def plot_multithread_scatter(title, slow, fast): | 284 | def plot_multithread_scatter(title, slow, fast): |
| 171 | plt.clf() | 285 | plt.clf() |
| @@ -176,11 +290,29 @@ def plot_multithread_scatter(title, slow, fast): | |||
| 176 | plt.xticks(x) | 290 | plt.xticks(x) |
| 177 | for h in [11, 10, 9, 8, 7, 6]: | 291 | for h in [11, 10, 9, 8, 7, 6]: |
| 178 | y = [slow[h][i] / fast[h][i] for i in x] | 292 | y = [slow[h][i] / fast[h][i] for i in x] |
| 179 | plt.scatter(x, y, label=f"H48 h{h}") | 293 | plt.scatter(x, y, label=f"h{h}") |
| 180 | plt.legend(loc = "right") | 294 | plt.legend(loc = "right") |
| 181 | filename = title.replace(" ", "").replace(",", "") + ".png" | 295 | filename = title.replace(" ", "_") + ".png" |
| 182 | plt.savefig(benchmarks_img_dir / filename, dpi=300) | 296 | plt.savefig(benchmarks_img_dir / filename, dpi=300) |
| 183 | #plt.show() | 297 | #plt.show() |
| 184 | 298 | ||
| 185 | plot_multithread_scatter("4 threads speedup factor", results_h48.h48_single_thread, results_h48.h48_4_threads) | 299 | plot_multithread_scatter( |
| 186 | plot_multithread_scatter("16 threads speedup factor", results_h48.h48_single_thread, results_h48.h48_16_threads) | 300 | "H48 4 threads speedup factor", |
| 301 | results_h48.h48_single_thread, | ||
| 302 | results_h48.h48_4_threads, | ||
| 303 | ) | ||
| 304 | plot_multithread_scatter( | ||
| 305 | "H48 16 threads speedup factor", | ||
| 306 | results_h48.h48_single_thread, | ||
| 307 | results_h48.h48_16_threads, | ||
| 308 | ) | ||
| 309 | plot_multithread_scatter( | ||
| 310 | "egg 4 threads speedup factor", | ||
| 311 | results_egg.egg_single_thread, | ||
| 312 | results_egg.egg_4_threads, | ||
| 313 | ) | ||
| 314 | plot_multithread_scatter( | ||
| 315 | "egg 16 threads speedup factor", | ||
| 316 | results_egg.egg_single_thread, | ||
| 317 | results_egg.egg_16_threads, | ||
| 318 | ) | ||
diff --git a/benchmarks/results_egg.py b/benchmarks/results_egg.py new file mode 100644 index 0000000..3018cf4 --- /dev/null +++ b/benchmarks/results_egg.py | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | egg_single_thread = { | ||
| 2 | 6: {17: 5.032832, 18: 38.135722, 19: 204.652846}, | ||
| 3 | 7: {17: 2.669533, 18: 20.281338, 19: 108.782419}, | ||
| 4 | 8: {17: 1.651355, 18: 9.714498, 19: 45.383547}, | ||
| 5 | 9: {17: 0.803654, 18: 4.725768, 19: 22.741144}, | ||
| 6 | 10: {17: 0.429919, 18: 2.498317, 19: 11.803061, 20: 99.918920, "superflip": 0.234443}, | ||
| 7 | 11: {17: 0.237963, 18: 1.428538, 19: 6.031292, 20: 53.963847, "superflip": 0.138605}, | ||
| 8 | } | ||
| 9 | |||
| 10 | egg_4_threads = { | ||
| 11 | 6: {17: 1.265374, 18: 9.782992, 19: 52.818767}, | ||
| 12 | 7: {17: 0.688996, 18: 5.239901, 19: 27.651903}, | ||
| 13 | 8: {17: 0.426688, 18: 2.487043, 19: 11.904544}, | ||
| 14 | 9: {17: 0.206107, 18: 1.220541, 19: 5.867951}, | ||
| 15 | 10: {17: 0.110690, 18: 0.662000, 19: 2.965403, 20: 26.244233, "superflip": 0.086182}, | ||
| 16 | 11: {17: 0.063179, 18: 0.366318, 19: 1.552111, 20: 13.738317, "superflip": 0.025594}, | ||
| 17 | } | ||
| 18 | |||
| 19 | egg_16_threads = { | ||
| 20 | 6: {17: 0.913331, 18: 7.036477, 19: 38.217758}, | ||
| 21 | 7: {17: 0.501139, 18: 3.771112, 19: 19.841116}, | ||
| 22 | 8: {17: 0.301029, 18: 1.764851, 19: 8.205679}, | ||
| 23 | 9: {17: 0.147238, 18: 0.887650, 19: 4.249228}, | ||
| 24 | 10: {17: 0.076401, 18: 0.447673, 19: 2.135498, 20: 19.303369, "superflip": 0.038754}, | ||
| 25 | 11: {17: 0.042768, 18: 0.177966, 19: 0.754095, 20: 6.700410, "superflip": 0.016397}, | ||
| 26 | } | ||
| 27 | |||
diff --git a/benchmarks/results_h48.py b/benchmarks/results_h48.py index 625b2c5..db3f61d 100644 --- a/benchmarks/results_h48.py +++ b/benchmarks/results_h48.py | |||
| @@ -1,36 +1,36 @@ | |||
| 1 | h48_single_thread = { | 1 | h48_single_thread = { |
| 2 | 6: {17: 31.2308, 18: 236.1986, 19: 1157.7502}, | 2 | 6: {17: 31.6146, 18: 237.6538, 19: 1178.5629}, |
| 3 | 7: {17: 15.7227, 18: 121.1488, 19: 581.2004}, | 3 | 7: {17: 15.7297, 18: 121.1100, 19: 582.6646}, |
| 4 | 8: {17: 11.5065, 18: 84.0366, 19: 353.2224}, | 4 | 8: {17: 11.4289, 18: 85.8390, 19: 354.3900}, |
| 5 | 9: {17: 5.9123, 18: 37.1034, 19: 167.3496}, | 5 | 9: {17: 5.4948, 18: 35.7112, 19: 164.0113}, |
| 6 | 10: {17: 3.7338, 18: 18.9061, 19: 83.9382, 20: 587.7489, "superflip": 38.0522}, | 6 | 10: {17: 3.2011, 18: 17.2078, 19: 84.1986, 20: 578.7479, "superflip": 38.0028}, |
| 7 | 11: {17: 2.3070, 18: 12.5145, 19: 56.0479, 20: 393.3391, "superflip": 15.5523}, | 7 | 11: {17: 2.0178, 18: 10.8605, 19: 46.4395, 20: 304.9428, "superflip": 15.3861}, |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | h48_4_threads = { | 10 | h48_4_threads = { |
| 11 | 6: {17: 8.2859, 18: 61.8403, 19: 305.5934}, | 11 | 6: {17: 8.4831, 18: 61.8787, 19: 308.3152}, |
| 12 | 7: {17: 4.3713, 18: 32.0550, 19: 152.9403}, | 12 | 7: {17: 4.5843, 18: 32.2699, 19: 154.6502}, |
| 13 | 8: {17: 3.2607, 18: 22.6002, 19: 92.7235}, | 13 | 8: {17: 3.2842, 18: 22.7150, 19: 92.6903}, |
| 14 | 9: {17: 1.8164, 18: 9.6520, 19: 43.5002, 20: 313.5156, "superflip": 18.9551}, | 14 | 9: {17: 1.7301, 18: 9.7587, 19: 43.2178, 20: 312.5222, "superflip": 18.9704}, |
| 15 | 10: {17: 1.2098, 18: 5.1007, 19: 22.8530, 20: 166.2468, "superflip": 9.8108}, | 15 | 10: {17: 1.1491, 18: 4.4016, 19: 22.4448, 20: 155.2350, "superflip": 9.8506}, |
| 16 | 11: {17: 0.9047, 18: 3.6152, 19: 14.9408, 20: 99.3673, "superflip": 4.1930}, | 16 | 11: {17: 0.8027, 18: 3.1583, 19: 12.3942, 20: 80.9024, "superflip": 4.1653}, |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | h48_16_threads = { | 19 | h48_16_threads = { |
| 20 | 6: {17: 3.2536, 18: 22.7283, 19: 109.8073}, | 20 | 6: {17: 3.3695, 18: 19.3030, 19: 109.1256}, |
| 21 | 7: {17: 1.8312, 18: 11.7609, 19: 54.9974}, | 21 | 7: {17: 1.9154, 18: 10.3030, 19: 54.8909}, |
| 22 | 8: {17: 1.4242, 18: 8.4798, 19: 33.9483}, | 22 | 8: {17: 1.5225, 18: 7.5543, 19: 33.9840}, |
| 23 | 9: {17: 0.9010, 18: 3.8064, 19: 15.8985, 20: 111.3421, "superflip": 8.0916}, | 23 | 9: {17: 0.8672, 18: 3.5479, 19: 16.0906, 20: 110.7977, "superflip": 8.0406}, |
| 24 | 10: {17: 0.6528, 18: 2.1009, 19: 8.3680, 20: 58.5190, "superflip": 4.1848}, | 24 | 10: {17: 0.6723, 18: 1.9998, 19: 8.5537, 20: 55.9818, "superflip": 4.2065}, |
| 25 | 11: {17: 0.5918, 18: 1.5379, 19: 5.3942, 20: 33.1522, "superflip": 1.8402}, | 25 | 11: {17: 0.5403, 18: 1.4842, 19: 5.2328, 20: 28.9226, "superflip": 1.8435}, |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | h48_all_solutions = { | 28 | h48_all_solutions = { |
| 29 | 6: {17: 9.8554, 18: 116.6374, 19: 1324.9303}, | 29 | 6: {17: 10.1111, 18: 114.6104, 19: 1254.2822}, |
| 30 | 7: {17: 5.2495, 18: 59.4768, 19: 662.9106}, | 30 | 7: {17: 5.5958, 18: 59.2615, 19: 633.7330}, |
| 31 | 8: {17: 3.6359, 18: 38.8943, 19: 385.2452}, | 31 | 8: {17: 3.9038, 18: 38.3942, 19: 369.4771}, |
| 32 | 9: {17: 1.9026, 18: 18.2076, 19: 182.0522}, | 32 | 9: {17: 1.9935, 18: 18.1457, 19: 173.0701}, |
| 33 | 10: {17: 1.3117, 18: 10.5836, 19: 95.4136, 20: 860.4004, "superflip": 36.8007}, | 33 | 10: {17: 1.2822, 18: 9.8484, 19: 87.7510, 20: 188.4217, "superflip": 4.2900}, |
| 34 | 11: {17: 0.9357, 18: 6.4383, 19: 55.3969, 20: 473.9622, "superflip": 16.9452}, | 34 | 11: {17: 0.8868, 18: 5.9268, 19: 46.9945, 20: 97.0853, "superflip": 1.8600}, |
| 35 | } | 35 | } |
| 36 | 36 | ||
diff --git a/benchmarks/run-egg-benchmarks.sh b/benchmarks/run-egg-benchmarks.sh new file mode 100755 index 0000000..d29db27 --- /dev/null +++ b/benchmarks/run-egg-benchmarks.sh | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | scr="../nissy-core/benchmarks/scrambles" | ||
| 2 | out="../nissy-core/benchmarks/results_egg.py" | ||
| 3 | |||
| 4 | get_solve_time() { | ||
| 5 | ./target/release/solve -t "$1" --table "tables/h$2" <"$3" \ | ||
| 6 | | tail -1 | sed 's/.*cubes wall //; s/ wall.*//' | ||
| 7 | } | ||
| 8 | |||
| 9 | do_all() { | ||
| 10 | echo "doing all $1 $2" | ||
| 11 | t=$1 | ||
| 12 | name=$2 | ||
| 13 | printf '%s = {\n' "$name" >> "$out" | ||
| 14 | for i in 6 7 8 9 10 11 ; do | ||
| 15 | echo "Doing 17 moves for h$i with $t threads..." | ||
| 16 | t17="$(get_solve_time $t $i "$scr/scrambles-17.txt")" | ||
| 17 | echo "Doing 18 moves for h$i with $t threads..." | ||
| 18 | t18="$(get_solve_time $t $i "$scr/scrambles-18.txt")" | ||
| 19 | echo "Doing 19 moves for h$i with $t threads..." | ||
| 20 | t19="$(get_solve_time $t $i "$scr/scrambles-19.txt")" | ||
| 21 | printf '\t%s: {17: %s, 18: %s, 19: %s' $i $t17 $t18 $t19 >> "$out" | ||
| 22 | if [ "$i" -ge 10 ]; then | ||
| 23 | echo "Doing 20 moves for h$i with $t threads..." | ||
| 24 | t20="$(get_solve_time $t $i "$scr/scrambles-20.txt")" | ||
| 25 | printf ', 20: %s' $t20 >> "$out" | ||
| 26 | echo "Doing superflip moves for h$i with $t threads..." | ||
| 27 | tsf="$(get_solve_time $t $i "$scr/superflip.txt")" | ||
| 28 | printf ', "superflip": %s},\n' $tsf >> "$out" | ||
| 29 | else | ||
| 30 | printf '},\n' >> "$out" | ||
| 31 | fi | ||
| 32 | done | ||
| 33 | printf '}\n\n' >> "$out" | ||
| 34 | } | ||
| 35 | |||
| 36 | printf '' > "$out" | ||
| 37 | |||
| 38 | do_all 1 "egg_single_thread" | ||
| 39 | do_all 4 "egg_4_threads" | ||
| 40 | do_all 16 "egg_16_threads" | ||
diff --git a/benchmarks/tables_16_threads.md b/benchmarks/tables_16_threads.md index 49d391a..ab5f03a 100644 --- a/benchmarks/tables_16_threads.md +++ b/benchmarks/tables_16_threads.md | |||
| @@ -3,26 +3,39 @@ | |||
| 3 | 3 | ||
| 4 | Time per cube (in seconds, lower is better). | 4 | Time per cube (in seconds, lower is better). |
| 5 | 5 | ||
| 6 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 6 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 7 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 7 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 8 | |H48 h11 |56.5 GiB| 0.02| 0.06| 0.22| 1.33| 1.84| | 8 | |egg h11 |58.0 GiB| 0.00| 0.01| 0.03| 0.27| 0.02| |
| 9 | |H48 h10 |28.3 GiB| 0.03| 0.08| 0.33| 2.34| 4.18| | 9 | |H48 h11 |56.5 GiB| 0.02| 0.06| 0.21| 1.16| 1.84| |
| 10 | |H48 h9 |14.1 GiB| 0.04| 0.15| 0.64| 4.45| 8.09| | 10 | |egg h10 |29.0 GiB| 0.00| 0.02| 0.09| 0.77| 0.04| |
| 11 | |H48 h8 | 7.1 GiB| 0.06| 0.34| 1.36| | | | 11 | |H48 h10 |28.3 GiB| 0.03| 0.08| 0.34| 2.24| 4.21| |
| 12 | |H48 h7 | 3.5 GiB| 0.07| 0.47| 2.20| | | | 12 | |egg h9 |14.5 GiB| 0.01| 0.04| 0.17| | | |
| 13 | |H48 h6 | 1.8 GiB| 0.13| 0.91| 4.39| | | | 13 | |H48 h9 |14.1 GiB| 0.03| 0.14| 0.64| 4.43| 8.04| |
| 14 | |egg h8 | 7.2 GiB| 0.01| 0.07| 0.33| | | | ||
| 15 | |H48 h8 | 7.1 GiB| 0.06| 0.30| 1.36| | | | ||
| 16 | |egg h7 | 3.6 GiB| 0.02| 0.15| 0.79| | | | ||
| 17 | |H48 h7 | 3.5 GiB| 0.08| 0.41| 2.20| | | | ||
| 18 | |egg h6 | 1.8 GiB| 0.04| 0.28| 1.53| | | | ||
| 19 | |H48 h6 | 1.8 GiB| 0.13| 0.77| 4.37| | | | ||
| 14 | 20 | ||
| 15 | Speed-up factor (higher is better). | 21 | Speed-up factor (higher is better). |
| 16 | 22 | ||
| 17 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 23 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 18 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 24 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 19 | |H48 h11 |56.5 GiB| 3.90| 8.14| 10.39| 11.86| 8.45| | 25 | |egg h11 |58.0 GiB| 5.56| 8.03| 8.00| 8.05| 8.45| |
| 20 | |H48 h10 |28.3 GiB| 5.72| 9.00| 10.03| 10.04| 9.09| | 26 | |H48 h11 |56.5 GiB| 3.73| 7.32| 8.87| 10.54| 8.35| |
| 21 | |H48 h9 |14.1 GiB| 6.56| 9.75| 10.53| | | | 27 | |egg h10 |29.0 GiB| 5.63| 5.58| 5.53| 5.18| 6.05| |
| 22 | |H48 h8 | 7.1 GiB| 8.08| 9.91| 10.40| | | | 28 | |H48 h10 |28.3 GiB| 4.76| 8.60| 9.84| 10.34| 9.03| |
| 23 | |H48 h7 | 3.5 GiB| 8.59| 10.30| 10.57| | | | 29 | |egg h9 |14.5 GiB| 5.46| 5.32| 5.35| | | |
| 24 | |H48 h6 | 1.8 GiB| 9.60| 10.39| 10.54| | | | 30 | |H48 h9 |14.1 GiB| 6.34| 10.07| 10.19| | | |
| 31 | |egg h8 | 7.2 GiB| 5.49| 5.50| 5.53| | | | ||
| 32 | |H48 h8 | 7.1 GiB| 7.51| 11.36| 10.43| | | | ||
| 33 | |egg h7 | 3.6 GiB| 5.33| 5.38| 5.48| | | | ||
| 34 | |H48 h7 | 3.5 GiB| 8.21| 11.75| 10.61| | | | ||
| 35 | |egg h6 | 1.8 GiB| 5.51| 5.42| 5.35| | | | ||
| 36 | |H48 h6 | 1.8 GiB| 9.38| 12.31| 10.80| | | | ||
| 25 | 37 | ||
| 26 | <img src="img/16threadsspeedupfactor.png"> | 38 | <img src="img/H48_16_threads_speedup_factor.png"> |
| 39 | <img src="img/egg_16_threads_speedup_factor.png"> | ||
| 27 | 40 | ||
| 28 | </details> | 41 | </details> |
diff --git a/benchmarks/tables_1_thread.md b/benchmarks/tables_1_thread.md index c0abb50..bf2e0ab 100644 --- a/benchmarks/tables_1_thread.md +++ b/benchmarks/tables_1_thread.md | |||
| @@ -3,35 +3,47 @@ | |||
| 3 | 3 | ||
| 4 | Time per cube (in seconds, lower is better). | 4 | Time per cube (in seconds, lower is better). |
| 5 | 5 | ||
| 6 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 6 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 7 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 7 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 8 | |vcube 212 |58.2 GiB| 0.11| 0.75| 3.43| 27.28| 19.30| | 8 | |vcube 212 |58.2 GiB| 0.11| 0.75| 3.43| 27.28| 19.30| |
| 9 | |H48 h11 |56.5 GiB| 0.09| 0.50| 2.24| 15.73| 15.55| | 9 | |egg h11 |58.0 GiB| 0.01| 0.06| 0.24| 2.16| 0.14| |
| 10 | |H48 h11 |56.5 GiB| 0.08| 0.43| 1.86| 12.20| 15.39| | ||
| 10 | |vcube 404 |31.8 GiB| 0.23| 1.24| 6.10| 59.33| 268.26| | 11 | |vcube 404 |31.8 GiB| 0.23| 1.24| 6.10| 59.33| 268.26| |
| 11 | |H48 h10 |28.3 GiB| 0.15| 0.76| 3.36| 23.51| 38.05| | 12 | |egg h10 |29.0 GiB| 0.02| 0.10| 0.47| 4.00| 0.23| |
| 13 | |H48 h10 |28.3 GiB| 0.13| 0.69| 3.37| 23.15| 38.00| | ||
| 12 | |vcube 308 |21.2 GiB| 0.17| 1.02| 6.20| 58.70| 604.35| | 14 | |vcube 308 |21.2 GiB| 0.17| 1.02| 6.20| 58.70| 604.35| |
| 13 | |H48 h9 |14.1 GiB| 0.24| 1.48| 6.69| | | | 15 | |egg h9 |14.5 GiB| 0.03| 0.19| 0.91| | | |
| 16 | |H48 h9 |14.1 GiB| 0.22| 1.43| 6.56| | | | ||
| 14 | |vcube 208 | 7.3 GiB| 0.56| 4.36| 20.58| | | | 17 | |vcube 208 | 7.3 GiB| 0.56| 4.36| 20.58| | | |
| 15 | |H48 h8 | 7.1 GiB| 0.46| 3.36| 14.13| | | | 18 | |egg h8 | 7.2 GiB| 0.07| 0.39| 1.82| | | |
| 16 | |H48 h7 | 3.5 GiB| 0.63| 4.85| 23.25| | | | 19 | |H48 h8 | 7.1 GiB| 0.46| 3.43| 14.18| | | |
| 20 | |egg h7 | 3.6 GiB| 0.11| 0.81| 4.35| | | | ||
| 21 | |H48 h7 | 3.5 GiB| 0.63| 4.84| 23.31| | | | ||
| 17 | |vcube 112 | 2.4 GiB| 0.96| 9.29| 40.52| | | | 22 | |vcube 112 | 2.4 GiB| 0.96| 9.29| 40.52| | | |
| 18 | |H48 h6 | 1.8 GiB| 1.25| 9.45| 46.31| | | | 23 | |egg h6 | 1.8 GiB| 0.20| 1.53| 8.19| | | |
| 24 | |H48 h6 | 1.8 GiB| 1.26| 9.51| 47.14| | | | ||
| 19 | 25 | ||
| 20 | Time per cube adjusted for table size (in seconds \* GiB, lower is better). | 26 | Time per cube adjusted for table size (in seconds \* GiB, lower is better). |
| 21 | 27 | ||
| 22 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 28 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 23 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 29 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 24 | |vcube 212 |58.2 GiB| 6.43| 43.80| 199.38| 1587.43| 1122.73| | 30 | |vcube 212 |58.2 GiB| 6.43| 43.80| 199.38| 1587.43| 1122.73| |
| 25 | |H48 h11 |56.5 GiB| 5.21| 28.28| 126.68| 889.01| 878.77| | 31 | |egg h11 |58.0 GiB| 0.55| 3.31| 13.99| 125.17| 8.04| |
| 32 | |H48 h11 |56.5 GiB| 4.56| 24.55| 104.96| 689.22| 869.37| | ||
| 26 | |vcube 404 |31.8 GiB| 7.40| 39.47| 194.01| 1887.94| 8535.87| | 33 | |vcube 404 |31.8 GiB| 7.40| 39.47| 194.01| 1887.94| 8535.87| |
| 27 | |H48 h10 |28.3 GiB| 4.22| 21.37| 94.86| 664.22| 1075.08| | 34 | |egg h10 |29.0 GiB| 0.50| 2.90| 13.69| 115.88| 6.80| |
| 35 | |H48 h10 |28.3 GiB| 3.62| 19.45| 95.15| 654.05| 1073.69| | ||
| 28 | |vcube 308 |21.2 GiB| 3.51| 21.71| 131.50| 1245.26| 12819.94| | 36 | |vcube 308 |21.2 GiB| 3.51| 21.71| 131.50| 1245.26| 12819.94| |
| 29 | |H48 h9 |14.1 GiB| 3.34| 20.97| 94.57| | | | 37 | |egg h9 |14.5 GiB| 0.47| 2.74| 13.19| | | |
| 38 | |H48 h9 |14.1 GiB| 3.11| 20.18| 92.68| | | | ||
| 30 | |vcube 208 | 7.3 GiB| 4.08| 31.74| 149.68| | | | 39 | |vcube 208 | 7.3 GiB| 4.08| 31.74| 149.68| | | |
| 31 | |H48 h8 | 7.1 GiB| 3.25| 23.75| 99.82| | | | 40 | |egg h8 | 7.2 GiB| 0.48| 2.82| 13.16| | | |
| 32 | |H48 h7 | 3.5 GiB| 2.22| 17.12| 82.14| | | | 41 | |H48 h8 | 7.1 GiB| 3.23| 24.26| 100.15| | | |
| 42 | |egg h7 | 3.6 GiB| 0.39| 2.94| 15.77| | | | ||
| 43 | |H48 h7 | 3.5 GiB| 2.22| 17.12| 82.35| | | | ||
| 33 | |vcube 112 | 2.4 GiB| 2.33| 22.53| 98.23| | | | 44 | |vcube 112 | 2.4 GiB| 2.33| 22.53| 98.23| | | |
| 34 | |H48 h6 | 1.8 GiB| 2.21| 16.70| 81.86| | | | 45 | |egg h6 | 1.8 GiB| 0.36| 2.76| 14.83| | | |
| 46 | |H48 h6 | 1.8 GiB| 2.24| 16.80| 83.33| | | | ||
| 35 | 47 | ||
| 36 | <img src="img/17moves1thread.png"> | 48 | <img src="img/17moves1thread.png"> |
| 37 | <img src="img/18moves1thread.png"> | 49 | <img src="img/18moves1thread.png"> |
diff --git a/benchmarks/tables_4_threads.md b/benchmarks/tables_4_threads.md index 95ec22c..b1bf9c5 100644 --- a/benchmarks/tables_4_threads.md +++ b/benchmarks/tables_4_threads.md | |||
| @@ -3,26 +3,39 @@ | |||
| 3 | 3 | ||
| 4 | Time per cube (in seconds, lower is better). | 4 | Time per cube (in seconds, lower is better). |
| 5 | 5 | ||
| 6 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 6 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 7 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 7 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 8 | |H48 h11 |56.5 GiB| 0.04| 0.14| 0.60| 3.97| 4.19| | 8 | |egg h11 |58.0 GiB| 0.00| 0.01| 0.06| 0.55| 0.03| |
| 9 | |H48 h10 |28.3 GiB| 0.05| 0.20| 0.91| 6.65| 9.81| | 9 | |H48 h11 |56.5 GiB| 0.03| 0.13| 0.50| 3.24| 4.17| |
| 10 | |H48 h9 |14.1 GiB| 0.07| 0.39| 1.74| 12.54| 18.96| | 10 | |egg h10 |29.0 GiB| 0.00| 0.03| 0.12| 1.05| 0.09| |
| 11 | |H48 h8 | 7.1 GiB| 0.13| 0.90| 3.71| | | | 11 | |H48 h10 |28.3 GiB| 0.05| 0.18| 0.90| 6.21| 9.85| |
| 12 | |H48 h7 | 3.5 GiB| 0.17| 1.28| 6.12| | | | 12 | |egg h9 |14.5 GiB| 0.01| 0.05| 0.23| | | |
| 13 | |H48 h6 | 1.8 GiB| 0.33| 2.47| 12.22| | | | 13 | |H48 h9 |14.1 GiB| 0.07| 0.39| 1.73| 12.50| 18.97| |
| 14 | |egg h8 | 7.2 GiB| 0.02| 0.10| 0.48| | | | ||
| 15 | |H48 h8 | 7.1 GiB| 0.13| 0.91| 3.71| | | | ||
| 16 | |egg h7 | 3.6 GiB| 0.03| 0.21| 1.11| | | | ||
| 17 | |H48 h7 | 3.5 GiB| 0.18| 1.29| 6.19| | | | ||
| 18 | |egg h6 | 1.8 GiB| 0.05| 0.39| 2.11| | | | ||
| 19 | |H48 h6 | 1.8 GiB| 0.34| 2.48| 12.33| | | | ||
| 14 | 20 | ||
| 15 | Speed-up factor (higher is better). | 21 | Speed-up factor (higher is better). |
| 16 | 22 | ||
| 17 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 23 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 18 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 24 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 19 | |H48 h11 |56.5 GiB| 2.55| 3.46| 3.75| 3.96| 3.71| | 25 | |egg h11 |58.0 GiB| 3.77| 3.90| 3.89| 3.93| 5.42| |
| 20 | |H48 h10 |28.3 GiB| 3.09| 3.71| 3.67| 3.54| 3.88| | 26 | |H48 h11 |56.5 GiB| 2.51| 3.44| 3.75| 3.77| 3.69| |
| 21 | |H48 h9 |14.1 GiB| 3.25| 3.84| 3.85| | | | 27 | |egg h10 |29.0 GiB| 3.88| 3.77| 3.98| 3.81| 2.72| |
| 22 | |H48 h8 | 7.1 GiB| 3.53| 3.72| 3.81| | | | 28 | |H48 h10 |28.3 GiB| 2.79| 3.91| 3.75| 3.73| 3.86| |
| 23 | |H48 h7 | 3.5 GiB| 3.60| 3.78| 3.80| | | | 29 | |egg h9 |14.5 GiB| 3.90| 3.87| 3.88| | | |
| 24 | |H48 h6 | 1.8 GiB| 3.77| 3.82| 3.79| | | | 30 | |H48 h9 |14.1 GiB| 3.18| 3.66| 3.79| | | |
| 31 | |egg h8 | 7.2 GiB| 3.87| 3.91| 3.81| | | | ||
| 32 | |H48 h8 | 7.1 GiB| 3.48| 3.78| 3.82| | | | ||
| 33 | |egg h7 | 3.6 GiB| 3.87| 3.87| 3.93| | | | ||
| 34 | |H48 h7 | 3.5 GiB| 3.43| 3.75| 3.77| | | | ||
| 35 | |egg h6 | 1.8 GiB| 3.98| 3.90| 3.87| | | | ||
| 36 | |H48 h6 | 1.8 GiB| 3.73| 3.84| 3.82| | | | ||
| 25 | 37 | ||
| 26 | <img src="img/4threadsspeedupfactor.png"> | 38 | <img src="img/H48_4_threads_speedup_factor.png"> |
| 39 | <img src="img/egg_4_threads_speedup_factor.png"> | ||
| 27 | 40 | ||
| 28 | </details> | 41 | </details> |
diff --git a/benchmarks/tables_all_solutions.md b/benchmarks/tables_all_solutions.md index 2959e0b..6535b60 100644 --- a/benchmarks/tables_all_solutions.md +++ b/benchmarks/tables_all_solutions.md | |||
| @@ -3,24 +3,24 @@ | |||
| 3 | 3 | ||
| 4 | Time per cube (in seconds, lower is better). | 4 | Time per cube (in seconds, lower is better). |
| 5 | 5 | ||
| 6 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 6 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 7 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 7 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 8 | |H48 h11 |56.5 GiB| 0.04| 0.26| 2.22| 18.96| 16.95| | 8 | |H48 h11 |56.5 GiB| 0.04| 0.24| 1.88| 3.88| 1.86| |
| 9 | |H48 h10 |28.3 GiB| 0.05| 0.42| 3.82| 34.42| 36.80| | 9 | |H48 h10 |28.3 GiB| 0.05| 0.39| 3.51| 7.54| 4.29| |
| 10 | |H48 h9 |14.1 GiB| 0.08| 0.73| 7.28| | | | 10 | |H48 h9 |14.1 GiB| 0.08| 0.73| 6.92| | | |
| 11 | |H48 h8 | 7.1 GiB| 0.15| 1.56| 15.41| | | | 11 | |H48 h8 | 7.1 GiB| 0.16| 1.54| 14.78| | | |
| 12 | |H48 h7 | 3.5 GiB| 0.21| 2.38| 26.52| | | | 12 | |H48 h7 | 3.5 GiB| 0.22| 2.37| 25.35| | | |
| 13 | |H48 h6 | 1.8 GiB| 0.39| 4.67| 53.00| | | | 13 | |H48 h6 | 1.8 GiB| 0.40| 4.58| 50.17| | | |
| 14 | 14 | ||
| 15 | Time per cube adjusted for table size (in seconds \* GiB, lower is better). | 15 | Time per cube adjusted for table size (in seconds \* GiB, lower is better). |
| 16 | 16 | ||
| 17 | | Solver | Size |17 moves|18 moves|19 moves|20 moves|Superflip| | 17 | |Solver|Size|17 moves|18 moves|19 moves|20 moves|Superflip| |
| 18 | |:---------|:-------|-------:|-------:|-------:|-------:|--------:| | 18 | |:-----|:---|-------:|-------:|-------:|-------:|--------:| |
| 19 | |H48 h11 |56.5 GiB| 2.11| 14.55| 125.21| 1071.23| 957.47| | 19 | |H48 h11 |56.5 GiB| 2.00| 13.40| 106.21| 219.43| 105.10| |
| 20 | |H48 h10 |28.3 GiB| 1.48| 11.96| 107.83| 972.35| 1039.73| | 20 | |H48 h10 |28.3 GiB| 1.45| 11.13| 99.17| 212.94| 121.20| |
| 21 | |H48 h9 |14.1 GiB| 1.08| 10.29| 102.88| | | | 21 | |H48 h9 |14.1 GiB| 1.13| 10.25| 97.80| | | |
| 22 | |H48 h8 | 7.1 GiB| 1.03| 10.99| 108.87| | | | 22 | |H48 h8 | 7.1 GiB| 1.10| 10.85| 104.41| | | |
| 23 | |H48 h7 | 3.5 GiB| 0.74| 8.41| 93.69| | | | 23 | |H48 h7 | 3.5 GiB| 0.79| 8.38| 89.57| | | |
| 24 | |H48 h6 | 1.8 GiB| 0.70| 8.25| 93.68| | | | 24 | |H48 h6 | 1.8 GiB| 0.71| 8.10| 88.68| | | |
| 25 | 25 | ||
| 26 | </details> | 26 | </details> |
