aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-03-11 15:33:05 +0100
committerThomas White <taw@physics.org>2021-03-11 16:10:54 +0100
commit4330d385f145fcc3e47c7398293e69268cec5d60 (patch)
tree54e4425984569fa9aac30eda8079682d6af17aba
parentd47c903416fb98701cda2c90e755c4b3e30d9478 (diff)
indexamajig: Add --max-indexer-threads
This is a more general replacement for --pinkIndexer-thread-count.
-rw-r--r--doc/man/indexamajig.110
-rw-r--r--libcrystfel/src/index.c5
-rw-r--r--libcrystfel/src/index.h1
-rw-r--r--libcrystfel/src/indexers/pinkindexer.c22
-rw-r--r--libcrystfel/src/indexers/pinkindexer.h2
-rw-r--r--src/gui_index.c2
-rw-r--r--src/indexamajig.c11
-rw-r--r--src/process_image.h1
8 files changed, 31 insertions, 23 deletions
diff --git a/doc/man/indexamajig.1 b/doc/man/indexamajig.1
index d20fb682..d5c957a9 100644
--- a/doc/man/indexamajig.1
+++ b/doc/man/indexamajig.1
@@ -190,7 +190,7 @@ Prefix the filenames from the input file with \fIprefix\fR. If \fB--basename\fR
.PD 0
.IP "\fB-j\fR \fIn\fR"
.PD
-Run \fIn\fR analyses in parallel. Default: 1.
+Run \fIn\fR analyses in parallel. Default: 1. See also \fB--max-indexer-threads\fR.
.PD 0
.IP \fB--no-check-prefix\fR
@@ -390,6 +390,11 @@ Check that most of the peaks can be accounted for by the indexing solution. Thi
Some indexing algorithms need to know the wavelength of the incident radiation in advance, e.g. to prepare an internal look-up table. However, if the wavelength is taken from image headers, then the wavelength is not available at start-up. In this case, you will be prompted to add this option to give an approximate wavelength, in metres. A warning will be generated if the actual wavelength differs from this value by more than 10%.
.PD 0
+.IP \fB--max-indexer-threads=\fIn\fR
+.PD
+Some indexing algorithms (e.g. pinkIndexer) can use multiple threads for faster calculations. This is in addition to the frame-based parallelism already available in indexamajig (see \fB-j\fR). This option sets the maximum number of threads that each indexing engine is allowed to use. Default: 1.
+
+.PD 0
.IP \fB--taketwo-member-threshold=\fIn\fR
.IP \fB--taketwo-len-tolerance=\fIn\fR
.IP \fB--taketwo-angle-tolerance=\fIn\fR
@@ -446,7 +451,6 @@ These set low-level parameters for the XGANDALF indexing algorithm.
.IP \fB--pinkIndexer-tolerance=\fIn\fR
.IP \fB--pinkIndexer-reflection-radius=\fIn\fR
.IP \fB--pinkIndexer-max-resolution-for-indexing=\fIn\fR
-.IP \fB--pinkIndexer-thread-count=\fIn\fR
.IP \fB--pinkIndexer-max-refinement-disbalance=\fIn\fR
.PD
@@ -464,8 +468,6 @@ These set low-level parameters for the PinkIndexer indexing algorithm.
.IP
\fB--pinkIndexer-max-resolution-for-indexing\fR sets the maximum resolition in 1/A used for indexing. Peaks at high resolution don't add much information, but they add a lot of computation time. Default is infinity. Does not influence the refinement.
.IP
-\fB--pinkIndexer-thread-count\fR sets the thread count for internal parallelization. Default is 1. Very useful for small datasets (e.g. for screening). Internal parallelization does not significantly increase the amount of RAM needed, whereas CrystFEL's parallelization does. For HPCs typically a mixture of both parallelizations leads to best results.
-.IP
\fB--pinkIndexer-max-refinement-disbalance Indexing solutions are dismissed if the refinement refined very well to one side of the detector and very badly to the other side. Allowed values range from 0 (no disbalance) to 2 (extreme disbalance), default 0.4. Disbalance after refinement usually appears for bad geometries or bad prior unit cell parameters.
.SH INTEGRATION OPTIONS
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index e0959657..6d1828a9 100644
--- a/libcrystfel/src/index.c
+++ b/libcrystfel/src/index.c
@@ -69,6 +69,7 @@ struct _indexingprivate
UnitCell *target_cell;
double tolerance[6];
double wavelength_estimate;
+ int n_threads;
int n_methods;
IndexingMethod *methods;
@@ -361,6 +362,7 @@ IndexingPrivate *setup_indexing(const char *method_list,
float *tols,
IndexingFlags flags,
double wavelength_estimate,
+ int n_threads,
struct taketwo_options *ttopts,
struct xgandalf_options *xgandalf_opts,
struct pinkIndexer_options *pinkIndexer_opts,
@@ -473,6 +475,7 @@ IndexingPrivate *setup_indexing(const char *method_list,
ipriv->n_methods = n;
ipriv->flags = flags;
ipriv->wavelength_estimate = wavelength_estimate;
+ ipriv->n_threads = n_threads;
if ( cell != NULL ) {
ipriv->target_cell = cell_new_from_cell(cell);
@@ -682,7 +685,7 @@ static int try_indexer(struct image *image, IndexingMethod indm,
case INDEXING_PINKINDEXER :
set_last_task(last_task, "indexing:pinkindexer");
- r = run_pinkIndexer(image, mpriv);
+ r = run_pinkIndexer(image, mpriv, ipriv->n_threads);
break;
case INDEXING_XGANDALF :
diff --git a/libcrystfel/src/index.h b/libcrystfel/src/index.h
index 24beb408..60e61630 100644
--- a/libcrystfel/src/index.h
+++ b/libcrystfel/src/index.h
@@ -168,6 +168,7 @@ extern IndexingPrivate *setup_indexing(const char *methods,
float *ltl,
IndexingFlags flags,
double wavelength_estimate,
+ int n_threads,
struct taketwo_options *ttopts,
struct xgandalf_options *xgandalf_opts,
struct pinkIndexer_options *pinkIndexer_opts,
diff --git a/libcrystfel/src/indexers/pinkindexer.c b/libcrystfel/src/indexers/pinkindexer.c
index db4da101..b0b5a9fa 100644
--- a/libcrystfel/src/indexers/pinkindexer.c
+++ b/libcrystfel/src/indexers/pinkindexer.c
@@ -51,7 +51,6 @@ struct pinkIndexer_options {
unsigned int refinement_type;
float maxResolutionForIndexing_1_per_A;
float tolerance;
- int thread_count;
float reflectionRadius; /* In m^-1 */
float customBandwidth;
float maxRefinementDisbalance;
@@ -68,7 +67,6 @@ struct pinkIndexer_private_data {
IndexingMethod indm;
UnitCell *cellTemplate;
- int threadCount;
float maxRefinementDisbalance;
@@ -115,7 +113,7 @@ static void scale_detector_shift(double fake_clen,
}
-int run_pinkIndexer(struct image *image, void *ipriv)
+int run_pinkIndexer(struct image *image, void *ipriv, int n_threads)
{
struct pinkIndexer_private_data *pinkIndexer_private_data = ipriv;
reciprocalPeaks_1_per_A_t reciprocalPeaks_1_per_A;
@@ -164,7 +162,7 @@ int run_pinkIndexer(struct image *image, void *ipriv)
&reciprocalPeaks_1_per_A,
intensities,
pinkIndexer_private_data->maxRefinementDisbalance,
- pinkIndexer_private_data->threadCount);
+ n_threads);
free(intensities);
freeReciprocalPeaks(reciprocalPeaks_1_per_A);
@@ -257,7 +255,6 @@ void *pinkIndexer_prepare(IndexingMethod *indm,
struct pinkIndexer_private_data* pinkIndexer_private_data = malloc(sizeof(struct pinkIndexer_private_data));
pinkIndexer_private_data->indm = *indm;
pinkIndexer_private_data->cellTemplate = cell;
- pinkIndexer_private_data->threadCount = pinkIndexer_opts->thread_count;
pinkIndexer_private_data->maxRefinementDisbalance = pinkIndexer_opts->maxRefinementDisbalance;
UnitCell* primitiveCell = uncenter_cell(cell, &pinkIndexer_private_data->centeringTransformation, NULL);
@@ -415,7 +412,7 @@ const char *pinkIndexer_probe(UnitCell *cell)
#else /* HAVE_PINKINDEXER */
-int run_pinkIndexer(struct image *image, void *ipriv)
+int run_pinkIndexer(struct image *image, void *ipriv, int n_threads)
{
ERROR("This copy of CrystFEL was compiled without PINKINDEXER support.\n");
return 0;
@@ -463,9 +460,6 @@ static void pinkIndexer_show_help()
" Specified in 1/A. Default is 2%% of a*.\n"
" --pinkIndexer-max-resolution-for-indexing=n\n"
" Measured in 1/A\n"
-" --pinkIndexer-thread-count=n\n"
-" Thread count for internal parallelization \n"
-" Default: 1\n"
" --pinkIndexer-max-refinement-disbalance=n\n"
" Maximum imbalance after refinement:\n"
" 0 (no imbalance) to 2 (extreme imbalance), default 0.4\n"
@@ -485,7 +479,6 @@ int pinkIndexer_default_options(PinkIndexerOptions **opts_ptr)
opts->refinement_type = 1;
opts->tolerance = 0.06;
opts->maxResolutionForIndexing_1_per_A = +INFINITY;
- opts->thread_count = 1;
opts->reflectionRadius = -1;
opts->maxRefinementDisbalance = 0.4;
@@ -540,12 +533,9 @@ static error_t pinkindexer_parse_arg(int key, char *arg,
break;
case 5 :
- if (sscanf(arg, "%d", &(*opts_ptr)->thread_count) != 1)
- {
- ERROR("Invalid value for --pinkIndexer-thread-count\n");
- return EINVAL;
- }
- break;
+ ERROR("Please use --max-indexer-threads instead of "
+ "--pinkIndexer-thread-count.\n");
+ return EINVAL;
case 6 :
if (sscanf(arg, "%f", &(*opts_ptr)->maxResolutionForIndexing_1_per_A) != 1)
diff --git a/libcrystfel/src/indexers/pinkindexer.h b/libcrystfel/src/indexers/pinkindexer.h
index 12230225..358a8221 100644
--- a/libcrystfel/src/indexers/pinkindexer.h
+++ b/libcrystfel/src/indexers/pinkindexer.h
@@ -37,7 +37,7 @@
extern int pinkIndexer_default_options(PinkIndexerOptions **opts_ptr);
-extern int run_pinkIndexer(struct image *image, void *ipriv);
+extern int run_pinkIndexer(struct image *image, void *ipriv, int n_threads);
extern void *pinkIndexer_prepare(IndexingMethod *indm,
UnitCell *cell,
diff --git a/src/gui_index.c b/src/gui_index.c
index f244f1f5..4b7254de 100644
--- a/src/gui_index.c
+++ b/src/gui_index.c
@@ -519,7 +519,7 @@ static void run_indexing_once(struct crystfelproject *proj)
ipriv = setup_indexing(methods, cell,
proj->indexing_params.tols,
indexing_flags(&proj->indexing_params),
- proj->cur_image->lambda,
+ proj->cur_image->lambda, 1,
taketwoopts, xgandalf_opts,
pinkIndexer_opts, felix_opts);
free(methods);
diff --git a/src/indexamajig.c b/src/indexamajig.c
index f6ff129c..e4da883a 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -458,6 +458,13 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
}
break;
+ case 414 :
+ if (sscanf(arg, "%d", &args->iargs.n_threads) != 1)
+ {
+ ERROR("Invalid value for --max-indexer-threads\n");
+ return EINVAL;
+ }
+ break;
/* ---------- Integration ---------- */
case 501 :
@@ -670,6 +677,7 @@ int main(int argc, char *argv[])
args.iargs.no_image_data = 0;
args.iargs.no_mask_data = 0;
args.iargs.wavelength_estimate = NAN;
+ args.iargs.n_threads = 1;
argp_program_version_hook = show_version;
@@ -769,6 +777,8 @@ int main(int argc, char *argv[])
{"no-cell-combinations", 412, NULL, OPTION_HIDDEN, NULL},
{"wavelength-estimate", 413, "metres", 0,
"Estimate of the incident radiation wavelength, in metres."},
+ {"max-indexer-threads", 414, "n", 0,
+ "Maximum number of threads allowed for indexing engines."},
{NULL, 0, 0, OPTION_DOC, "Integration options:", 5},
{"integration", 501, "method", OPTION_NO_USAGE, "Integration method"},
@@ -971,6 +981,7 @@ int main(int argc, char *argv[])
args.iargs.tols,
flags,
args.iargs.wavelength_estimate,
+ args.iargs.n_threads,
taketwo_opts,
xgandalf_opts,
pinkindexer_opts,
diff --git a/src/process_image.h b/src/process_image.h
index 8174f73d..703f0cde 100644
--- a/src/process_image.h
+++ b/src/process_image.h
@@ -99,6 +99,7 @@ struct index_args
int no_image_data;
int no_mask_data;
float wavelength_estimate;
+ int n_threads;
};