aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL29
-rw-r--r--README.md39
-rw-r--r--TODO.md8
-rw-r--r--doc/nissy.18
-rwxr-xr-xnissybin169184 -> 0 bytes
-rw-r--r--nissy-2.0beta5.tar.gzbin54368 -> 55883 bytes
-rwxr-xr-xnissy.exebin686582 -> 691884 bytes
-rw-r--r--src/commands.c55
-rw-r--r--src/pruning.c15
-rw-r--r--src/pruning.h4
10 files changed, 133 insertions, 25 deletions
diff --git a/INSTALL b/INSTALL
index 0717a0a..f8bef02 100644
--- a/INSTALL
+++ b/INSTALL
@@ -11,7 +11,7 @@ pruning table. If so, about 200Mb should be enough.
11## On Windows 11## On Windows
12 12
13Try downloading and executing in a terminal the file nissy.exe, then 13Try downloading and executing in a terminal the file nissy.exe, then
14follow the instructions in the UNIX section below for downloading and 14follow the instructions in the Tables section below for
15installing the pruning tables. 15installing the pruning tables.
16If nissy.exe does not work, you can try following the UNIX instructions 16If nissy.exe does not work, you can try following the UNIX instructions
17in WSL (Windows Subsystem for Linux) or in a similar environment. 17in WSL (Windows Subsystem for Linux) or in a similar environment.
@@ -22,11 +22,28 @@ Sorry for the inconvenience, I don't have a Windows machine to test this on.
22 22
23Edit the Makefile to match your local configuration (usually not necessary, but you 23Edit the Makefile to match your local configuration (usually not necessary, but you
24may want to change the PREFIX variable) and run make, followed by make install. 24may want to change the PREFIX variable) and run make, followed by make install.
25After that, you need to download some files and manually save them to your NISSYDATA 25Follows the instructions below to install the pruning tables.
26folder (se manual page, ENVIRONMENT section). If you don't do it nissy can compute 26
27these files when needed and save them in the correct folders, but some of them 27## Tables
28take hours to generate even for a powerful computer (for reference, the huge pruning 28Nissy needs to generate certain large tables to work. These tables are by default
29table takes about 20 hours on my laptop). 29generated the first time they are needed (e.g the first time you ask to solve a
30certain step) and then saved to a file. The following times nissy simply loads the
31corresponding file from the hard disk.
32
33The very large table for optimal solving can take some time to generate (about 20
34minutes on my fairly old but decent laptop, using 8 CPU threads). All other
35tables are much faster.
36
37You can ask nissy to generate all the tables it will ever need with the gen
38command. It is recommended to use more than one thread, if your CPU has them.
39For example, you can run:
40
41nissy gen -t 8
42
43to generate all tables using 8 threads.
44
45Alternatively, you can simply download all the tables and copy them into the
46correct folder (see manual page, ENVIRONMENT section).
30Choose one of the following: 47Choose one of the following:
31 https://math.uni.lu/tronto/nissy/nissy-tables-full.zip 48 https://math.uni.lu/tronto/nissy/nissy-tables-full.zip
32 https://math.uni.lu/tronto/nissy/nissy-tables-full.tar.gz 49 https://math.uni.lu/tronto/nissy/nissy-tables-full.tar.gz
diff --git a/README.md b/README.md
index c6b3690..4ddbe66 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,7 @@ pruning table. If so, about 200Mb should be enough.
31### On Windows 31### On Windows
32 32
33Try downloading and executing in a terminal the file nissy.exe, then 33Try downloading and executing in a terminal the file nissy.exe, then
34follow the instructions in the UNIX section below for downloading and 34follow the instructions in the **Tables** section below for
35installing the pruning tables. 35installing the pruning tables.
36If nissy.exe does not work, you can try following the UNIX instructions 36If nissy.exe does not work, you can try following the UNIX instructions
37in WSL (Windows Subsystem for Linux) or in a similar environment. 37in WSL (Windows Subsystem for Linux) or in a similar environment.
@@ -40,17 +40,32 @@ Sorry for the inconvenience, I don't have a Windows machine to test this on.
40 40
41### On a UNIX system: 41### On a UNIX system:
42 42
43You can download the source code for the latest version from git or simply clone
44the repo with `git clone https://github.com/sebastianotronto/nissy`.
45
46Edit the Makefile to match your local configuration (usually not necessary, but you 43Edit the Makefile to match your local configuration (usually not necessary, but you
47may want to change the `PREFIX` variable) and run `make`, followed by `make install`. 44may want to change the `PREFIX` variable) and run `make`, followed by `make install`.
48After that, you need to download some files and manually save them to your `NISSYDATA` 45Follows the instructions below to install the pruning tables.
49folder (see manual page, ENVIRONMENT section). If you don't do it nissy can compute 46
50these files when needed and save them in the correct folders, but some of them 47### Tables
51take hours to generate even for a powerful computer (for reference, the huge pruning 48Nissy needs to generate certain large tables to work. These tables are by default
52table takes about 20 hours on my laptop). 49generated the first time they are needed (e.g the first time you ask to solve a
50certain step) and then saved to a file. The following times nissy simply loads the
51corresponding file from the hard disk.
52
53The very large table for optimal solving can take some time to generate (about 20
54minutes on my fairly old but decent laptop, using 8 CPU threads). All other
55tables are much faster.
56
57You can ask nissy to generate all the tables it will ever need with the **gen**
58command. It is recommended to use more than one thread, if your CPU has them.
59For example, you can run:
60
61```
62nissy gen -t 8
63```
64
65to generate all tables using 8 threads.
53 66
67Alternatively, you can simply download all the tables and copy them into the
68correct folder (see manual page, `ENVIRONMENT` section).
54Choose one of the following: 69Choose one of the following:
55 70
56| |.zip|.tar.gz| 71| |.zip|.tar.gz|
@@ -58,9 +73,9 @@ Choose one of the following:
58|Full (~720Mb)|[full.zip](https://math.uni.lu/tronto/nissy/nissy-tables-full.zip)|[full.tar.gz](https://math.uni.lu/tronto/nissy/nissy-tables-full.tar.gz)| 73|Full (~720Mb)|[full.zip](https://math.uni.lu/tronto/nissy/nissy-tables-full.zip)|[full.tar.gz](https://math.uni.lu/tronto/nissy/nissy-tables-full.tar.gz)|
59|No huge table (~90Mb)|[nohuge.zip](https://math.uni.lu/tronto/nissy/nissy-tables-nohuge.zip)|[nohuge.tar.gz](https://math.uni.lu/tronto/nissy/nissy-tables-nohuge.tar.gz)| 74|No huge table (~90Mb)|[nohuge.zip](https://math.uni.lu/tronto/nissy/nissy-tables-nohuge.zip)|[nohuge.tar.gz](https://math.uni.lu/tronto/nissy/nissy-tables-nohuge.tar.gz)|
60 75
61extract the archive and copy the `tables` folder into `NISSIDATA` (paste there 76extract the archive and copy the tables folder into `NISSIDATA` (paste there
62the whole folder, not the single files). The `nohuge` files are much smaller and 77the whole folder, not file by file). The "nohuge" files are much smaller and do not
63do not contain the huge pruning table for the optimal solver. 78contain the huge pruning table for the optimal solver.
64 79
65## Structure of the code 80## Structure of the code
66 81
diff --git a/TODO.md b/TODO.md
index 1776891..2cabaf0 100644
--- a/TODO.md
+++ b/TODO.md
@@ -54,16 +54,10 @@ and just use previous values for all 3 axes.
54## Coordinates, symmetries, pruning tables 54## Coordinates, symmetries, pruning tables
55* Cleanup symcoord.c: some coordinates and symdata are never actually used; 55* Cleanup symcoord.c: some coordinates and symdata are never actually used;
56remove also sd_eofbepos and just use sd_coud for khuge (this changes the 56remove also sd_eofbepos and just use sd_coud for khuge (this changes the
57coordinate so the whole table must be generated again!) 57coordinate so the whole table must be generated again!) or viceversa
58* Use pruning values mod 4 instead of mod 16 (or maybe not, I like the 58* Use pruning values mod 4 instead of mod 16 (or maybe not, I like the
59current system) 59current system)
60 60
61### Memory management
62* fail gracefully when there is not enough memory to load a large table
63* free tables from memory when not used
64* optionally run in low-memory friendly version (no tables above a few Mb);
65 this can be useful e.g. for embedded devices
66
67### Structural changes 61### Structural changes
68* client/server architecture: run a server process in the background so that 62* client/server architecture: run a server process in the background so that
69 multiple client processess can send it queries and get results; this would 63 multiple client processess can send it queries and get results; this would
diff --git a/doc/nissy.1 b/doc/nissy.1
index e8ce7ea..992745d 100644
--- a/doc/nissy.1
+++ b/doc/nissy.1
@@ -36,6 +36,14 @@ are the following:
36.It Nm commands 36.It Nm commands
37List all available commands. 37List all available commands.
38. 38.
39.It Nm gen Op Fl t Ar N
40Generate all tables used by nissy. Run this to complete your installation.
41If
42.Ar N
43is specified,
44.Ar N
45CPU threads will be used (defaults to 1).
46.
39.It Nm help Op Ar command 47.It Nm help Op Ar command
40Display help. If no 48Display help. If no
41.Ar command 49.Ar command
diff --git a/nissy b/nissy
deleted file mode 100755
index 6f3c748..0000000
--- a/nissy
+++ /dev/null
Binary files differ
diff --git a/nissy-2.0beta5.tar.gz b/nissy-2.0beta5.tar.gz
index 7c63ba5..1fa13b3 100644
--- a/nissy-2.0beta5.tar.gz
+++ b/nissy-2.0beta5.tar.gz
Binary files differ
diff --git a/nissy.exe b/nissy.exe
index 8148885..007f838 100755
--- a/nissy.exe
+++ b/nissy.exe
Binary files differ
diff --git a/src/commands.c b/src/commands.c
index 5e01e67..287ee67 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -3,12 +3,14 @@
3/* Arg parsing functions *****************************************************/ 3/* Arg parsing functions *****************************************************/
4 4
5CommandArgs * solve_parse_args(int c, char **v); 5CommandArgs * solve_parse_args(int c, char **v);
6CommandArgs * gen_parse_args(int c, char **v);
6CommandArgs * help_parse_args(int c, char **v); 7CommandArgs * help_parse_args(int c, char **v);
7CommandArgs * print_parse_args(int c, char **v); 8CommandArgs * print_parse_args(int c, char **v);
8CommandArgs * parse_no_arg(int c, char **v); 9CommandArgs * parse_no_arg(int c, char **v);
9 10
10/* Exec functions ************************************************************/ 11/* Exec functions ************************************************************/
11 12
13static void gen_exec(CommandArgs *args);
12static void solve_exec(CommandArgs *args); 14static void solve_exec(CommandArgs *args);
13static void steps_exec(CommandArgs *args); 15static void steps_exec(CommandArgs *args);
14static void commands_exec(CommandArgs *args); 16static void commands_exec(CommandArgs *args);
@@ -34,6 +36,15 @@ solve_cmd = {
34}; 36};
35 37
36Command 38Command
39gen_cmd = {
40 .name = "gen",
41 .usage = "gen [-t N]",
42 .description = "Generate all tables [using N threads]",
43 .parse_args = gen_parse_args,
44 .exec = gen_exec
45};
46
47Command
37steps_cmd = { 48steps_cmd = {
38 .name = "steps", 49 .name = "steps",
39 .usage = "steps", 50 .usage = "steps",
@@ -89,6 +100,7 @@ version_cmd = {
89 100
90Command *commands[NCOMMANDS] = { 101Command *commands[NCOMMANDS] = {
91 &commands_cmd, 102 &commands_cmd,
103 &gen_cmd,
92 &help_cmd, 104 &help_cmd,
93 &print_cmd, 105 &print_cmd,
94 &quit_cmd, 106 &quit_cmd,
@@ -173,6 +185,34 @@ solve_parse_args(int c, char **v)
173} 185}
174 186
175CommandArgs * 187CommandArgs *
188gen_parse_args(int c, char **v)
189{
190 int val;
191 CommandArgs *a = new_args();
192
193 a->opts->nthreads = 1;
194 a->success = false;
195
196 if (c == 0) {
197 a->success = true;
198 } else {
199 if (!strcmp(v[0], "-t") && c > 1) {
200 val = strtol(v[1], NULL, 10);
201 if (val < 1 || val > 64) {
202 fprintf(stderr,
203 "Invalid number of threads."
204 "1 <= t <= 64\n");
205 return a;
206 }
207 a->opts->nthreads = val;
208 a->success = true;
209 }
210 }
211
212 return a;
213}
214
215CommandArgs *
176help_parse_args(int c, char **v) 216help_parse_args(int c, char **v)
177{ 217{
178 int i; 218 int i;
@@ -229,6 +269,21 @@ solve_exec(CommandArgs *args)
229} 269}
230 270
231static void 271static void
272gen_exec(CommandArgs *args)
273{
274 int i;
275
276 fprintf(stderr, "Generating coordinates...\n");
277 init_symcoord();
278
279 fprintf(stderr, "Generating pruning tables...\n");
280 for (i = 0; i < NPTABLES && allpd[i] != NULL; i++)
281 genptable(allpd[i], args->opts->nthreads);
282
283 fprintf(stderr, "Done!\n");
284}
285
286static void
232steps_exec(CommandArgs *args) 287steps_exec(CommandArgs *args)
233{ 288{
234 int i; 289 int i;
diff --git a/src/pruning.c b/src/pruning.c
index 8cfa582..b305a89 100644
--- a/src/pruning.c
+++ b/src/pruning.c
@@ -84,6 +84,21 @@ pd_khuge_HTM = {
84 .moveset = moveset_HTM, 84 .moveset = moveset_HTM,
85}; 85};
86 86
87PruneData * allpd[NPTABLES] = {
88 &pd_eofb_HTM,
89 &pd_coud_HTM,
90 &pd_cornershtr_HTM,
91 &pd_corners_HTM,
92 &pd_drud_sym16_HTM,
93 &pd_drud_eofb,
94 &pd_drudfin_noE_sym16_drud,
95 &pd_htr_drud,
96 &pd_htrfin_htr,
97 &pd_khuge_HTM,
98};
99
100/* Functions *****************************************************************/
101
87int 102int
88findchunk(PruneData *pd, int nchunks, uint64_t i) 103findchunk(PruneData *pd, int nchunks, uint64_t i)
89{ 104{
diff --git a/src/pruning.h b/src/pruning.h
index d337fd8..da9e58a 100644
--- a/src/pruning.h
+++ b/src/pruning.h
@@ -3,6 +3,8 @@
3 3
4#include "symcoord.h" 4#include "symcoord.h"
5 5
6#define NPTABLES 20
7
6extern PruneData pd_eofb_HTM; 8extern PruneData pd_eofb_HTM;
7extern PruneData pd_coud_HTM; 9extern PruneData pd_coud_HTM;
8extern PruneData pd_corners_HTM; 10extern PruneData pd_corners_HTM;
@@ -14,6 +16,8 @@ extern PruneData pd_htr_drud;
14extern PruneData pd_htrfin_htr; 16extern PruneData pd_htrfin_htr;
15extern PruneData pd_khuge_HTM; 17extern PruneData pd_khuge_HTM;
16 18
19extern PruneData * allpd[NPTABLES];
20
17void genptable(PruneData *pd, int nthreads); 21void genptable(PruneData *pd, int nthreads);
18void print_ptable(PruneData *pd); 22void print_ptable(PruneData *pd);
19uint64_t ptablesize(PruneData *pd); 23uint64_t ptablesize(PruneData *pd);

Generated with cgit - Back to sebastiano.tronto.net