From a2ec137b56cf73b4bd6b4693c9750e077ec2edf4 Mon Sep 17 00:00:00 2001 From: Vasco Pedro Date: Wed, 13 Apr 2016 00:38:17 +0100 Subject: [PATCH] updated to PaCCS version 0.90d --- README | 23 ++++++++++++++++++++--- TUNING | 2 ++ bench/costas.c | 12 ++++++++++-- bench/queens.c | 12 ++++++++++-- src/VERSION | 2 +- src/agents-splitgo-mpi.c | 6 +++--- src/agents-splitgo.c | 6 +++--- src/pool.c | 18 +++++++++--------- src/problem.c | 3 +++ 9 files changed, 61 insertions(+), 23 deletions(-) diff --git a/README b/README index 3e865e0..6ef4482 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ -PaCCS version 0.90c +PaCCS version 0.90d -All files Copyright (C) 2009-2015 Vasco Pedro +All files Copyright (C) 2009-2016 Vasco Pedro All rights reserved. * Compiling @@ -103,7 +103,24 @@ Problem splitting: teams) See the TUNING file for the options to use with the different -problems. +problems, and the src/problem.c file for all the available options. + +** Arguments + +The arguments for some of the benchmark problems are: + + costas array-length + golomb n.-of-marks + k-queens [-k n.-of-copies] n.-of-queens + langford n.-of-sets set-size + magic-seq sequence-length + magic-square square-size + partition n.-of-values + qap problem-name (see qap.h, DEFAULT is esc16i) + queens n.-of-queens + +Arguments should come at the end of the command line, after any +runtime option. * Programming diff --git a/TUNING b/TUNING index 410f47b..d7e2a52 100644 --- a/TUNING +++ b/TUNING @@ -13,6 +13,8 @@ costas --label --most-constrained --split-even (first solution) + N <= DOMAIN_BITS / 2 + queens -DDOMAIN_BOUNDS ??? [not ism] --first-fail diff --git a/bench/costas.c b/bench/costas.c index 0995408..b9d2960 100644 --- a/bench/costas.c +++ b/bench/costas.c @@ -138,12 +138,20 @@ int main(int argc, char *argv[]) break; } + fd_end(); + + { + // avoid failure messages from mpirun + extern int _fd_counting_solutions; // XXX: private variable + + if (_fd_counting_solutions) + return 0; + } + if (solutions) printf("%d solutions found\n", solutions); else printf("inconsistent CSP\n"); - fd_end(); - return !solutions; } diff --git a/bench/queens.c b/bench/queens.c index 3ed4079..4b6b4c0 100644 --- a/bench/queens.c +++ b/bench/queens.c @@ -129,12 +129,20 @@ int main(int argc, char *argv[]) break; } + fd_end(); + + { + // avoid failure messages from mpirun + extern int _fd_counting_solutions; // XXX: private variable + + if (_fd_counting_solutions) + return 0; + } + if (solutions) printf("%d solutions found\n", solutions); else printf("inconsistent CSP\n"); - fd_end(); - return !solutions; } diff --git a/src/VERSION b/src/VERSION index 6868823..ecde812 100644 --- a/src/VERSION +++ b/src/VERSION @@ -1 +1 @@ -0.90c +0.90d diff --git a/src/agents-splitgo-mpi.c b/src/agents-splitgo-mpi.c index 0d93649..9d2add4 100644 --- a/src/agents-splitgo-mpi.c +++ b/src/agents-splitgo-mpi.c @@ -44,7 +44,7 @@ # error "don't know which MPI type to use for MPI_DOMAIN_TYPE" #endif -#define MAX_AGENTS 256 +#define MAX_AGENTS 1024 // number of workers to use int fd__workers = -1; @@ -1441,12 +1441,12 @@ int _fd_dsolve() if (nagents < 0) { nagents = 0; - _fd_debug("[%d] using %d workers\n", tid, nagents); + fd__info("[%d] using %d workers\n", tid, nagents); } else if (nagents > MAX_AGENTS) { nagents = MAX_AGENTS; - _fd_debug("[%d] using %d workers\n", tid, nagents); + fd__info("[%d] limiting workers to %d\n", tid, nagents); } } diff --git a/src/agents-splitgo.c b/src/agents-splitgo.c index a594a15..3e97a23 100644 --- a/src/agents-splitgo.c +++ b/src/agents-splitgo.c @@ -21,7 +21,7 @@ #error "must USE_STORE" #endif -#define MAX_AGENTS 256 +#define MAX_AGENTS 1024 // number of workers to use int fd__workers = -1; @@ -238,12 +238,12 @@ int _fd_dsolve() if (nagents < 0) { nagents = 0; - _fd_debug("using %d workers\n", nagents); + fd__info("using %d workers\n", nagents); } else if (nagents > MAX_AGENTS) { nagents = MAX_AGENTS; - _fd_debug("using %d workers\n", nagents); + fd__info("limiting workers to %d\n", nagents); } } diff --git a/src/pool.c b/src/pool.c index 2a07c61..18e05f3 100644 --- a/src/pool.c +++ b/src/pool.c @@ -18,6 +18,7 @@ static __thread int *split_variable; #endif #ifdef GROWABLE_POOL +// number of stores in the pool #define POOL_DEFAULT_SIZE 32 static __thread int pool_size; #endif @@ -31,13 +32,10 @@ static int EMPTY_POOL[] = { 0, 0 }; #ifndef STORE_IN_POOL #define STEAL_THRESHOLD 3 // an agent with less stores won't be stolen from -#define INDEX_SAFE 3 // XXX: explain.... +#define INDEX_SAFE 3 // lock-free access with these many stores in the pool #else -// XXX: should STEAL_THRESHOLD and INDEX_SAFE be changed (because -// there's one extra store in the pool)? -// changing for now, to be able to compare performances -#define STEAL_THRESHOLD 4 -#define INDEX_SAFE 4 +#define STEAL_THRESHOLD (3 + 1) +#define INDEX_SAFE (3 + 1) #endif static pthread_mutex_t *stores_mutexes; @@ -58,7 +56,7 @@ static __thread unsigned long pool_gets = 0; #endif #ifdef STATS_STEALS -#define MAX_AGENTS 256 // XXX: copied from agents-splitgo*.c +#define MAX_AGENTS 1024 // XXX: copied from agents-splitgo*.c static unsigned long sts_attempts[MAX_AGENTS + 1], sts_done[MAX_AGENTS + 1]; #ifdef RANDOM_VICTIM static unsigned long sts_checks[MAX_AGENTS + 1], sts_slept[MAX_AGENTS + 1]; @@ -95,8 +93,10 @@ void _fd_init_store_depository(int agents) // XXX: check for NULL's split_stores_ = calloc(agents, sizeof(*split_stores_)); split_indexes = calloc(agents, sizeof(*split_indexes)); - // XXX: mitigate a race condition: another agent may try to access - // this before proper initialisation by the owning agent + + // these will be properly initialised later, by the agent; + // for now, just make sure that if another agent tries to access it + // before that happens, it will find a sensible value there for (i = 0; i < agents; ++i) split_indexes[i] = EMPTY_POOL; diff --git a/src/problem.c b/src/problem.c index 1e421b7..4b51163 100644 --- a/src/problem.c +++ b/src/problem.c @@ -98,6 +98,9 @@ static void _fd_parse_general_options(int *argc, char *argv[]) ; #endif else if (!strcmp(argv[i], "--no-sort")) /* miscellaneous */ + // Note: the meaning of this option depends on whether it + // appears in the command line before or after the choice of the + // variable selection heuristic (see the code above) sort = false; else if (!strncmp(argv[i], "--workers=", sizeof("--workers=") - 1)) fd__workers = atoi(argv[i] + sizeof("--workers=") - 1); -- libgit2 0.21.2