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.

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.

Parameters

pts : int

Size of outer loop of routine to be parallelised.

divisor : int

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

Returns

nthreads : int

Determined thread count.