vspline 1.1.0
Generic C++11 Code for Uniform B-Splines
Classes | Variables
vspline_threadpool Namespace Reference

Classes

class  thread_pool
 

Variables

const int ncores = std::thread::hardware_concurrency()
 number of CPU cores in the system More...
 
const int default_njobs = 2 * ncores
 when multithreading, use this number of jobs per default. This looks like overkill and unnecessary signalling overhead, but it improves performance over just having as many threads as there are physical cores. Why is this so? There are several possibilities I've considered: More...
 

Variable Documentation

◆ default_njobs

const int vspline_threadpool::default_njobs = 2 * ncores

when multithreading, use this number of jobs per default. This looks like overkill and unnecessary signalling overhead, but it improves performance over just having as many threads as there are physical cores. Why is this so? There are several possibilities I've considered:

  • while one task waits e.g. for memory, another task can perform computations
  • the scheduler might assign time slices to each thread, so having more threads yields more time slices

Definition at line 99 of file thread_pool.h.

◆ ncores

const int vspline_threadpool::ncores = std::thread::hardware_concurrency()

number of CPU cores in the system

Definition at line 87 of file thread_pool.h.