Kokkos Core Kernels Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Functions
Kokkos::hwloc Namespace Reference

Minimal subset of logical 'hwloc' functionality available from http://www.open-mpi.org/projects/hwloc/. More...

Functions

bool available ()
 Query if hwloc is available. More...
 
unsigned get_available_numa_count ()
 Query number of available NUMA regions. This will be less than the hardware capacity if the MPI process is pinned to a NUMA region. More...
 
unsigned get_available_cores_per_numa ()
 Query number of available cores per NUMA regions. This will be less than the hardware capacity if the MPI process is pinned to a set of cores. More...
 
unsigned get_available_threads_per_core ()
 Query number of available "hard" threads per core; i.e., hyperthreads. More...
 
unsigned thread_mapping (const char *const label, const bool allow_async, unsigned &thread_count, unsigned &use_numa_count, unsigned &use_cores_per_numa, std::pair< unsigned, unsigned > threads_coord[])
 Recommend mapping of threads onto cores. More...
 
std::pair< unsigned, unsigned > get_this_thread_coordinate ()
 Query core-coordinate of the current thread with respect to the core_topology. More...
 
bool bind_this_thread (const std::pair< unsigned, unsigned >)
 Bind the current thread to a core. More...
 
bool can_bind_threads ()
 Can hwloc bind threads? More...
 
unsigned bind_this_thread (const unsigned coordinate_count, std::pair< unsigned, unsigned > coordinate[])
 Bind the current thread to one of the cores in the list. Set that entry to (~0,~0) and return the index. If binding fails return ~0. More...
 
bool unbind_this_thread ()
 Unbind the current thread back to the original process binding. More...
 

Detailed Description

Minimal subset of logical 'hwloc' functionality available from http://www.open-mpi.org/projects/hwloc/.

The calls are NOT thread safe in order to avoid mutexes, memory allocations, or other actions which could give the runtime system an opportunity to migrate the threads or touch allocated memory during the function calls.

All calls to these functions should be performed by a thread when it has guaranteed exclusive access; e.g., for OpenMP within a 'critical' region.

Function Documentation

bool Kokkos::hwloc::available ( )

Query if hwloc is available.

unsigned Kokkos::hwloc::get_available_numa_count ( )

Query number of available NUMA regions. This will be less than the hardware capacity if the MPI process is pinned to a NUMA region.

unsigned Kokkos::hwloc::get_available_cores_per_numa ( )

Query number of available cores per NUMA regions. This will be less than the hardware capacity if the MPI process is pinned to a set of cores.

unsigned Kokkos::hwloc::get_available_threads_per_core ( )

Query number of available "hard" threads per core; i.e., hyperthreads.

unsigned Kokkos::hwloc::thread_mapping ( const char *const  label,
const bool  allow_async,
unsigned &  thread_count,
unsigned &  use_numa_count,
unsigned &  use_cores_per_numa,
std::pair< unsigned, unsigned >  threads_coord[] 
)

Recommend mapping of threads onto cores.

If thread_count == 0 then choose and set a value. If use_numa_count == 0 then choose and set a value. If use_cores_per_numa == 0 then choose and set a value.

Return 0 if asynchronous, Return 1 if synchronous and threads_coord[0] is process core

std::pair<unsigned, unsigned> Kokkos::hwloc::get_this_thread_coordinate ( )

Query core-coordinate of the current thread with respect to the core_topology.

As long as the thread is running within the process binding the following condition holds.

core_coordinate.first < core_topology.first core_coordinate.second < core_topology.second

bool Kokkos::hwloc::bind_this_thread ( const std::pair< unsigned, unsigned >  )

Bind the current thread to a core.

bool Kokkos::hwloc::can_bind_threads ( )

Can hwloc bind threads?

unsigned Kokkos::hwloc::bind_this_thread ( const unsigned  coordinate_count,
std::pair< unsigned, unsigned >  coordinate[] 
)

Bind the current thread to one of the cores in the list. Set that entry to (~0,~0) and return the index. If binding fails return ~0.

bool Kokkos::hwloc::unbind_this_thread ( )

Unbind the current thread back to the original process binding.