aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-03-09 21:36:50 +0100
committerThomas White <taw@physics.org>2014-03-09 21:36:50 +0100
commit37deaefe474f698d2785189ffc9480f68c01007f (patch)
treef0a3273561797194d952520dba36fe6013c1a37f /src
parent017e55112a161349f4859c00d63eb0ea1be563a7 (diff)
Add -j
Diffstat (limited to 'src')
-rw-r--r--src/ambigator.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/ambigator.c b/src/ambigator.c
index fbe29091..72894eb9 100644
--- a/src/ambigator.c
+++ b/src/ambigator.c
@@ -73,6 +73,7 @@ static void show_help(const char *s)
" --fg-graph=<fn> Save f and g correlation values to file <fn>.\n"
" --ncorr=<n> Use <n> correlations per crystal. Default 1000\n"
" --stop-after=<n> Use at most the first <n> crystals.\n"
+" -j <n> Use <n> threads for CC calculation.\n"
);
}
@@ -474,10 +475,9 @@ static void work(void *wp, int cookie)
static struct cc_list *calc_ccs(struct flist **crystals, int n_crystals,
int ncorr, SymOpList *amb, gsl_rng *rng,
- float *pmean_nac)
+ float *pmean_nac, int nthreads)
{
struct cc_list *ccs;
- int nthreads = 8;
struct queue_args qargs;
assert(n_crystals >= ncorr);
@@ -617,6 +617,7 @@ int main(int argc, char *argv[])
int ncorr = 1000;
int stop_after = 0;
float mean_nac;
+ int n_threads = 1;
/* Long options */
const struct option longopts[] = {
@@ -636,7 +637,7 @@ int main(int argc, char *argv[])
};
/* Short options */
- while ((c = getopt_long(argc, argv, "ho:y:n:w:",
+ while ((c = getopt_long(argc, argv, "ho:y:n:w:j:",
longopts, NULL)) != -1)
{
@@ -662,6 +663,13 @@ int main(int argc, char *argv[])
n_iter = atoi(optarg);
break;
+ case 'j' :
+ if ( sscanf(optarg, "%i", &n_threads) != 1 ) {
+ ERROR("Invalid value for -j\n");
+ return 1;
+ }
+ break;
+
case 2 :
if ( sscanf(optarg, "%e", &highres) != 1 ) {
ERROR("Invalid value for --highres\n");
@@ -843,7 +851,8 @@ int main(int argc, char *argv[])
}
}
- ccs = calc_ccs(crystals, n_crystals, ncorr, amb, rng, &mean_nac);
+ ccs = calc_ccs(crystals, n_crystals, ncorr, amb, rng, &mean_nac,
+ n_threads);
if ( ccs == NULL ) {
ERROR("Failed to allocate CCs\n");
return 1;