Class MultiThread
Global configuration for NumSharp's multithreaded kernels.
Currently governs the fused 1-D dot product (numpy.dot vector·vector) for contiguous float / double inputs; other kernels remain single-threaded. Disabled by default — enable via multithreading(bool, int) so existing behavior (and bit-for-bit summation order) is unchanged unless the caller opts in.
Parallelism is gated on work size: tiny and medium reductions stay on one thread because thread fan-out (a few microseconds) would dominate. Only when there is enough work to amortize that cost are chunks dispatched across cores.
public static class MultiThread
- Inheritance
-
MultiThread
- Inherited Members
Properties
Enabled
Whether parallel kernels may use more than one thread. Default: false.
public static bool Enabled { get; set; }
Property Value
MaxThreads
Upper bound on worker threads, clamped to at least 1. The effective count is additionally capped by ProcessorCount and by the available work. Default: 8.
public static int MaxThreads { get; set; }
Property Value
Methods
DegreeOfParallelism(long)
Effective number of threads for a contiguous element-wise reduction over
n elements. Returns 1 when multithreading is disabled or the
work is too small for parallelism to pay off; otherwise
min(MaxThreads, ProcessorCount, n / MinWorkPerThread).
public static int DegreeOfParallelism(long n)
Parameters
nlong