chiark
/
gitweb
/
~ianmdlvl
/
matchsticks-search.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0169095
)
wip multicore: add argument parsing; currently -j option is actually ignored
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sat, 8 Mar 2014 16:01:04 +0000
(16:01 +0000)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sat, 8 Mar 2014 16:01:04 +0000
(16:01 +0000)
main.c
patch
|
blob
|
history
diff --git
a/main.c
b/main.c
index 6f0df725949c9b26fccb613768f74c283bc9e591..307eea926963c34c85e40ff4adfc9f5013498cd6 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-27,6
+27,7
@@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
+#include <unistd.h>
#include <stdbool.h>
#include <inttypes.h>
#include <stdbool.h>
#include <inttypes.h>
@@
-88,6
+89,8
@@
static AdjWord *best_adjmatrix;
static unsigned printcounter;
static unsigned printcounter;
+static int ncpus = 1;
+
static AdjWord *xalloc_adjmatrix(void) {
return xmalloc(sizeof(*adjmatrix)*n);
}
static AdjWord *xalloc_adjmatrix(void) {
return xmalloc(sizeof(*adjmatrix)*n);
}
@@
-351,9
+354,20
@@
static void iterate(void) {
}
int main(int argc, char **argv) {
}
int main(int argc, char **argv) {
+ int opt;
+ while ((opt = getopt(argc,argv,"j:")) >= 0) {
+ switch (opt) {
+ case 'j': ncpus = atoi(optarg); break;
+ case '+': assert(!"bad option");
+ default: abort();
+ }
+ }
+ argc -= optind-1;
+ argv += optind-1;
assert(argc==3);
n = atoi(argv[1]);
m = atoi(argv[2]);
assert(argc==3);
n = atoi(argv[1]);
m = atoi(argv[2]);
+
prep();
iterate();
fprintf(stderr, "\n");
prep();
iterate();
fprintf(stderr, "\n");