Commit a2ec137b56cf73b4bd6b4693c9750e077ec2edf4

Authored by Vasco Pedro
1 parent f3c60625
Exists in master

updated to PaCCS version 0.90d

1 -PaCCS version 0.90c 1 +PaCCS version 0.90d
2 2
3 -All files Copyright (C) 2009-2015 Vasco Pedro <vp@di.uevora.pt> 3 +All files Copyright (C) 2009-2016 Vasco Pedro <vp@di.uevora.pt>
4 All rights reserved. 4 All rights reserved.
5 5
6 * Compiling 6 * Compiling
@@ -103,7 +103,24 @@ Problem splitting: @@ -103,7 +103,24 @@ Problem splitting:
103 teams) 103 teams)
104 104
105 See the TUNING file for the options to use with the different 105 See the TUNING file for the options to use with the different
106 -problems. 106 +problems, and the src/problem.c file for all the available options.
  107 +
  108 +** Arguments
  109 +
  110 +The arguments for some of the benchmark problems are:
  111 +
  112 + costas array-length
  113 + golomb n.-of-marks
  114 + k-queens [-k n.-of-copies] n.-of-queens
  115 + langford n.-of-sets set-size
  116 + magic-seq sequence-length
  117 + magic-square square-size
  118 + partition n.-of-values
  119 + qap problem-name (see qap.h, DEFAULT is esc16i)
  120 + queens n.-of-queens
  121 +
  122 +Arguments should come at the end of the command line, after any
  123 +runtime option.
107 124
108 125
109 * Programming 126 * Programming
@@ -13,6 +13,8 @@ costas @@ -13,6 +13,8 @@ costas
13 --label --most-constrained 13 --label --most-constrained
14 --split-even (first solution) 14 --split-even (first solution)
15 15
  16 + N <= DOMAIN_BITS / 2
  17 +
16 queens 18 queens
17 -DDOMAIN_BOUNDS ??? [not ism] 19 -DDOMAIN_BOUNDS ??? [not ism]
18 --first-fail 20 --first-fail
bench/costas.c
@@ -138,12 +138,20 @@ int main(int argc, char *argv[]) @@ -138,12 +138,20 @@ int main(int argc, char *argv[])
138 break; 138 break;
139 } 139 }
140 140
  141 + fd_end();
  142 +
  143 + {
  144 + // avoid failure messages from mpirun
  145 + extern int _fd_counting_solutions; // XXX: private variable
  146 +
  147 + if (_fd_counting_solutions)
  148 + return 0;
  149 + }
  150 +
141 if (solutions) 151 if (solutions)
142 printf("%d solutions found\n", solutions); 152 printf("%d solutions found\n", solutions);
143 else 153 else
144 printf("inconsistent CSP\n"); 154 printf("inconsistent CSP\n");
145 155
146 - fd_end();  
147 -  
148 return !solutions; 156 return !solutions;
149 } 157 }
bench/queens.c
@@ -129,12 +129,20 @@ int main(int argc, char *argv[]) @@ -129,12 +129,20 @@ int main(int argc, char *argv[])
129 break; 129 break;
130 } 130 }
131 131
  132 + fd_end();
  133 +
  134 + {
  135 + // avoid failure messages from mpirun
  136 + extern int _fd_counting_solutions; // XXX: private variable
  137 +
  138 + if (_fd_counting_solutions)
  139 + return 0;
  140 + }
  141 +
132 if (solutions) 142 if (solutions)
133 printf("%d solutions found\n", solutions); 143 printf("%d solutions found\n", solutions);
134 else 144 else
135 printf("inconsistent CSP\n"); 145 printf("inconsistent CSP\n");
136 146
137 - fd_end();  
138 -  
139 return !solutions; 147 return !solutions;
140 } 148 }
1 -0.90c 1 +0.90d
src/agents-splitgo-mpi.c
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 # error "don't know which MPI type to use for MPI_DOMAIN_TYPE" 44 # error "don't know which MPI type to use for MPI_DOMAIN_TYPE"
45 #endif 45 #endif
46 46
47 -#define MAX_AGENTS 256 47 +#define MAX_AGENTS 1024
48 48
49 // number of workers to use 49 // number of workers to use
50 int fd__workers = -1; 50 int fd__workers = -1;
@@ -1441,12 +1441,12 @@ int _fd_dsolve() @@ -1441,12 +1441,12 @@ int _fd_dsolve()
1441 if (nagents < 0) 1441 if (nagents < 0)
1442 { 1442 {
1443 nagents = 0; 1443 nagents = 0;
1444 - _fd_debug("[%d] using %d workers\n", tid, nagents); 1444 + fd__info("[%d] using %d workers\n", tid, nagents);
1445 } 1445 }
1446 else if (nagents > MAX_AGENTS) 1446 else if (nagents > MAX_AGENTS)
1447 { 1447 {
1448 nagents = MAX_AGENTS; 1448 nagents = MAX_AGENTS;
1449 - _fd_debug("[%d] using %d workers\n", tid, nagents); 1449 + fd__info("[%d] limiting workers to %d\n", tid, nagents);
1450 } 1450 }
1451 } 1451 }
1452 1452
src/agents-splitgo.c
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 #error "must USE_STORE" 21 #error "must USE_STORE"
22 #endif 22 #endif
23 23
24 -#define MAX_AGENTS 256 24 +#define MAX_AGENTS 1024
25 25
26 // number of workers to use 26 // number of workers to use
27 int fd__workers = -1; 27 int fd__workers = -1;
@@ -238,12 +238,12 @@ int _fd_dsolve() @@ -238,12 +238,12 @@ int _fd_dsolve()
238 if (nagents < 0) 238 if (nagents < 0)
239 { 239 {
240 nagents = 0; 240 nagents = 0;
241 - _fd_debug("using %d workers\n", nagents); 241 + fd__info("using %d workers\n", nagents);
242 } 242 }
243 else if (nagents > MAX_AGENTS) 243 else if (nagents > MAX_AGENTS)
244 { 244 {
245 nagents = MAX_AGENTS; 245 nagents = MAX_AGENTS;
246 - _fd_debug("using %d workers\n", nagents); 246 + fd__info("limiting workers to %d\n", nagents);
247 } 247 }
248 } 248 }
249 249
@@ -18,6 +18,7 @@ static __thread int *split_variable; @@ -18,6 +18,7 @@ static __thread int *split_variable;
18 #endif 18 #endif
19 19
20 #ifdef GROWABLE_POOL 20 #ifdef GROWABLE_POOL
  21 +// number of stores in the pool
21 #define POOL_DEFAULT_SIZE 32 22 #define POOL_DEFAULT_SIZE 32
22 static __thread int pool_size; 23 static __thread int pool_size;
23 #endif 24 #endif
@@ -31,13 +32,10 @@ static int EMPTY_POOL[] = { 0, 0 }; @@ -31,13 +32,10 @@ static int EMPTY_POOL[] = { 0, 0 };
31 32
32 #ifndef STORE_IN_POOL 33 #ifndef STORE_IN_POOL
33 #define STEAL_THRESHOLD 3 // an agent with less stores won't be stolen from 34 #define STEAL_THRESHOLD 3 // an agent with less stores won't be stolen from
34 -#define INDEX_SAFE 3 // XXX: explain.... 35 +#define INDEX_SAFE 3 // lock-free access with these many stores in the pool
35 #else 36 #else
36 -// XXX: should STEAL_THRESHOLD and INDEX_SAFE be changed (because  
37 -// there's one extra store in the pool)?  
38 -// changing for now, to be able to compare performances  
39 -#define STEAL_THRESHOLD 4  
40 -#define INDEX_SAFE 4 37 +#define STEAL_THRESHOLD (3 + 1)
  38 +#define INDEX_SAFE (3 + 1)
41 #endif 39 #endif
42 40
43 static pthread_mutex_t *stores_mutexes; 41 static pthread_mutex_t *stores_mutexes;
@@ -58,7 +56,7 @@ static __thread unsigned long pool_gets = 0; @@ -58,7 +56,7 @@ static __thread unsigned long pool_gets = 0;
58 #endif 56 #endif
59 57
60 #ifdef STATS_STEALS 58 #ifdef STATS_STEALS
61 -#define MAX_AGENTS 256 // XXX: copied from agents-splitgo*.c 59 +#define MAX_AGENTS 1024 // XXX: copied from agents-splitgo*.c
62 static unsigned long sts_attempts[MAX_AGENTS + 1], sts_done[MAX_AGENTS + 1]; 60 static unsigned long sts_attempts[MAX_AGENTS + 1], sts_done[MAX_AGENTS + 1];
63 #ifdef RANDOM_VICTIM 61 #ifdef RANDOM_VICTIM
64 static unsigned long sts_checks[MAX_AGENTS + 1], sts_slept[MAX_AGENTS + 1]; 62 static unsigned long sts_checks[MAX_AGENTS + 1], sts_slept[MAX_AGENTS + 1];
@@ -95,8 +93,10 @@ void _fd_init_store_depository(int agents) @@ -95,8 +93,10 @@ void _fd_init_store_depository(int agents)
95 // XXX: check for NULL's 93 // XXX: check for NULL's
96 split_stores_ = calloc(agents, sizeof(*split_stores_)); 94 split_stores_ = calloc(agents, sizeof(*split_stores_));
97 split_indexes = calloc(agents, sizeof(*split_indexes)); 95 split_indexes = calloc(agents, sizeof(*split_indexes));
98 - // XXX: mitigate a race condition: another agent may try to access  
99 - // this before proper initialisation by the owning agent 96 +
  97 + // these will be properly initialised later, by the agent;
  98 + // for now, just make sure that if another agent tries to access it
  99 + // before that happens, it will find a sensible value there
100 for (i = 0; i < agents; ++i) 100 for (i = 0; i < agents; ++i)
101 split_indexes[i] = EMPTY_POOL; 101 split_indexes[i] = EMPTY_POOL;
102 102
@@ -98,6 +98,9 @@ static void _fd_parse_general_options(int *argc, char *argv[]) @@ -98,6 +98,9 @@ static void _fd_parse_general_options(int *argc, char *argv[])
98 ; 98 ;
99 #endif 99 #endif
100 else if (!strcmp(argv[i], "--no-sort")) /* miscellaneous */ 100 else if (!strcmp(argv[i], "--no-sort")) /* miscellaneous */
  101 + // Note: the meaning of this option depends on whether it
  102 + // appears in the command line before or after the choice of the
  103 + // variable selection heuristic (see the code above)
101 sort = false; 104 sort = false;
102 else if (!strncmp(argv[i], "--workers=", sizeof("--workers=") - 1)) 105 else if (!strncmp(argv[i], "--workers=", sizeof("--workers=") - 1))
103 fd__workers = atoi(argv[i] + sizeof("--workers=") - 1); 106 fd__workers = atoi(argv[i] + sizeof("--workers=") - 1);