aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2022-03-03 19:02:08 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2022-03-03 19:02:08 +0100
commitecd8bbf2c0b7a4ca20c9cdc5f8f26836d4082c36 (patch)
tree59017867a467b496c1ae6f8133d7122e22819693
parentb5a692702643c8f3e77765ca38677e076bce2b59 (diff)
downloadnissy-ecd8bbf2c0b7a4ca20c9cdc5f8f26836d4082c36.tar.gz
nissy-ecd8bbf2c0b7a4ca20c9cdc5f8f26836d4082c36.zip
Added messages about generating pruning tables
-rw-r--r--TODO.md8
-rw-r--r--src/pruning.c13
-rw-r--r--src/shell.c34
-rw-r--r--src/shell.h1
-rw-r--r--src/symcoord.c4
5 files changed, 51 insertions, 9 deletions
diff --git a/TODO.md b/TODO.md
index a21c903..553207f 100644
--- a/TODO.md
+++ b/TODO.md
@@ -4,16 +4,11 @@ This is a list of things that I would like to add or change at some point.
4It's more of a personal reminder than anything else. 4It's more of a personal reminder than anything else.
5 5
6## For version 2.1 6## For version 2.1
7### Scrambles
8* dr and htr scrambles
9### Memory management 7### Memory management
10* Free large tables from memory before exit (this is not strictly necessary, 8* Free large tables from memory before exit (this is not strictly necessary,
11 but can help with WSL bugs) 9 but can help with WSL bugs)
12### Installation 10### Installation
13* At startup, check if tables are all there; if not, print an error message 11* Is it possible to make table generation at least 3x faster?
14 suggesting to run `nissy gen -t 8` (or more than 8). Is it
15 possible to make table generation at least 3x faster?
16* make 8 threads default for gen?
17### Documentation 12### Documentation
18* Write an examples.md file 13* Write an examples.md file
19* More screenshots! 14* More screenshots!
@@ -85,7 +80,6 @@ including e.g. solutions that were not shown because -c)
85 open up the door for a web-based version or graphical clients 80 open up the door for a web-based version or graphical clients
86 81
87### Cleanup 82### Cleanup
88* Remove khuge from everywhere
89* sort again functions alphabetically in their files 83* sort again functions alphabetically in their files
90* more stuff to load at start (or when suitable command is called) rather 84* more stuff to load at start (or when suitable command is called) rather
91 than when called directly, to avoid nasty problems with threading 85 than when called directly, to avoid nasty problems with threading
diff --git a/src/pruning.c b/src/pruning.c
index d484a12..869110f 100644
--- a/src/pruning.c
+++ b/src/pruning.c
@@ -135,6 +135,18 @@ genptable(PruneData *pd, int nthreads)
135 return; 135 return;
136 } 136 }
137 137
138 if (nthreads < 4) {
139 fprintf(stderr,
140 "--- Warning ---\n"
141 "You are using only %d threads to generate the pruning"
142 "tables. This can take a while."
143 "Unless you did this intentionally, you should re-run"
144 "this command with `-t 4' or more.\n"
145 "---------------\n\n", nthreads
146 );
147 }
148
149
138 /* For the first steps we proceed the same way for compact and not */ 150 /* For the first steps we proceed the same way for compact and not */
139 compact = pd->compact; 151 compact = pd->compact;
140 pd->compact = false; 152 pd->compact = false;
@@ -144,6 +156,7 @@ genptable(PruneData *pd, int nthreads)
144 fprintf(stderr, "Cannot load %s, generating it with %d threads\n", 156 fprintf(stderr, "Cannot load %s, generating it with %d threads\n",
145 pd->filename, nthreads); 157 pd->filename, nthreads);
146 158
159
147 memset(pd->ptable, ~(uint8_t)0, ptablesize(pd)*sizeof(entry_group_t)); 160 memset(pd->ptable, ~(uint8_t)0, ptablesize(pd)*sizeof(entry_group_t));
148 161
149 ptable_update(pd, (Cube){0}, 0); 162 ptable_update(pd, (Cube){0}, 0);
diff --git a/src/shell.c b/src/shell.c
index 6e67e0a..31dde0e 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -3,6 +3,27 @@
3static void cleanwhitespaces(char *line); 3static void cleanwhitespaces(char *line);
4static int parseline(char *line, char **v); 4static int parseline(char *line, char **v);
5 5
6bool
7checkfiles()
8{
9 /* TODO: add more checks (other files, use checksum...) */
10 FILE *f;
11 char fname[strlen(tabledir)+100];
12 int i;
13
14 for (i = 0; allpd[i] != NULL; i++) {
15 strcpy(fname, tabledir);
16 strcpy(fname, "/");
17 strcpy(fname, allpd[i]->filename);
18 if ((f = fopen(fname, "rb")) == NULL)
19 return false;
20 else
21 fclose(f);
22 }
23
24 return true;
25}
26
6static void 27static void
7cleanwhitespaces(char *line) 28cleanwhitespaces(char *line)
8{ 29{
@@ -119,6 +140,19 @@ launch(bool batchmode)
119int 140int
120main(int argc, char *argv[]) 141main(int argc, char *argv[])
121{ 142{
143 init_env();
144
145 if (!checkfiles()) {
146 fprintf(stderr,
147 "--- Warning ---\n"
148 "Some pruning tables are missing or unreadable."
149 "You can generate them with `nissy gen -t 4'\n"
150 "Here `4' is the number of threads. Use more if your"
151 "CPU has them, or expect it to take a while.\n"
152 "---------------\n\n"
153 );
154 }
155
122 if (argc > 1) { 156 if (argc > 1) {
123 if (!strcmp(argv[1], "-b")) { 157 if (!strcmp(argv[1], "-b")) {
124 launch(true); 158 launch(true);
diff --git a/src/shell.h b/src/shell.h
index 80f86ba..7e4f785 100644
--- a/src/shell.h
+++ b/src/shell.h
@@ -7,6 +7,7 @@
7#define MAXTOKENLEN 255 7#define MAXTOKENLEN 255
8#define MAXNTOKENS 255 8#define MAXNTOKENS 255
9 9
10bool checkfiles();
10void exec_args(int c, char **v); 11void exec_args(int c, char **v);
11void launch(bool batchmode); 12void launch(bool batchmode);
12 13
diff --git a/src/symcoord.c b/src/symcoord.c
index b2099a7..4a737af 100644
--- a/src/symcoord.c
+++ b/src/symcoord.c
@@ -53,10 +53,10 @@ sd_eofbepos_16 = {
53 .trans = trans_group_udfix 53 .trans = trans_group_udfix
54}; 54};
55 55
56static int nsymdata = 2;
57static SymData * all_sd[] = { 56static SymData * all_sd[] = {
58 &sd_cp_16, 57 &sd_cp_16,
59 &sd_eofbepos_16, 58 &sd_eofbepos_16,
59 NULL
60}; 60};
61 61
62 62
@@ -403,7 +403,7 @@ init_symcoord()
403 403
404 init_coord(); 404 init_coord();
405 405
406 for (i = 0; i < nsymdata; i++) 406 for (i = 0; all_sd[i] != NULL; i++)
407 gensym(all_sd[i]); 407 gensym(all_sd[i]);
408} 408}
409 409

Generated with cgit - Back to sebastiano.tronto.net