finesse.utilities.cyomp.determine_nthreads_even

finesse.utilities.cyomp.determine_nthreads_even(int pts, int divisor) int

Determine the number of threads to use for a routine with an outer loop of size pts.

Parameters
ptsint

Size of outer loop of routine to be parallelised.

divisorint

Estimate of scaling for number of threads where the nominal thread count will then be pts // divisor.

Returns
nthreadsint

Determined thread count. Or 1 if no openmp support available.

Notes

The divisor arg defines the nominal number of threads via nominal = pts // divisor. Hence, this argument should correspond to the best-estimate of multi-threaded performance scaling behaviour of the routine to follow.

The actual value returned will be either unity or an even number (depending on values of pts and divisor) which is clipped by the maximum number of threads as given by the OpenMP routine omp_get_max_threads.

If Finesse was compiled without OpenMP support then this always returns 1.