Struct caffe2_threadpool::ThreadPool
source · #[repr(align(64))]pub struct ThreadPool { /* private fields */ }
Expand description
| A threadpool with the given number of | threads. | | ———– | @note | | the kCacheLineSize alignment is present | only for cache performance, and is not | strictly enforced (for example, when | the object is created on the heap). Thus, | in order to avoid misaligned intrinsics, | no SSE instructions shall be involved | in the ThreadPool implementation. | ––––– | @note | | alignas is disabled because some compilers | do not deal with TORCH_API and alignas | annotations at the same time. |
Implementations§
source§impl ThreadPool
impl ThreadPool
pub fn get_min_work_size(&self) -> usize
pub fn default_thread_pool(&mut self) -> Box<ThreadPool>
pub fn new(num_threads: i32) -> Self
sourcepub fn get_num_threads(&self) -> i32
pub fn get_num_threads(&self) -> i32
| Returns the number of threads currently | in use |
sourcepub fn set_num_threads(&mut self, num_threads: usize)
pub fn set_num_threads(&mut self, num_threads: usize)
| Sets the number of threads | | # of threads should not be bigger than the | number of big cores
sourcepub fn set_min_work_size(&mut self, size: usize)
pub fn set_min_work_size(&mut self, size: usize)
| Sets the minimum work size (range) for | which to invoke the threadpool; work sizes | smaller than this will just be run on the | main (calling) thread
pub fn run(f: fn(a: i32, b: usize), range: usize)
sourcepub fn with_pool(f: fn(x: *mut WorkersPool))
pub fn with_pool(f: fn(x: *mut WorkersPool))
| Run an arbitrary function in a thread-safe | manner accessing the Workers Pool |
Trait Implementations§
Auto Trait Implementations§
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.