MulticoreBSP for C  Version 2.0.4
Enumerations | Functions | Variables
mcbsp-affinity.h File Reference
#include <stdlib.h>
Include dependency graph for mcbsp-affinity.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  mcbsp_affinity_mode { SCATTER = 0, COMPACT, MANUAL }
 Pre-defined strategies for pinning threads. More...
 
enum  mcbsp_thread_numbering { CONSECUTIVE = 0, WRAPPED }
 Enumerates ways of hardware thread numbering. More...
 

Functions

void mcbsp_set_maximum_threads (const size_t max)
 Changes the maxmimum amount of threads MulticoreBSP can allocate. More...
 
void mcbsp_set_affinity_mode (const enum mcbsp_affinity_mode mode)
 Changes the currently active affinity strategy. More...
 
void mcbsp_set_available_cores (const size_t num_cores)
 Changes the number of available cores. More...
 
void mcbsp_set_threads_per_core (const size_t threads_per_core)
 Changes the number of threads per core. More...
 
void mcbsp_set_unused_threads_per_core (const size_t unused_threads_per_core)
 Prevents the use of a given number of threads at the same core. More...
 
void mcbsp_set_thread_numbering (const enum mcbsp_thread_numbering numbering)
 Changes the thread numbering strategy this machines adheres to. More...
 
void mcbsp_set_pinning (const size_t *const pinning, const size_t length)
 Supplies a manually defined pinning strategy for MulticoreBSP to use. More...
 
void mcbsp_set_reserved_cores (const size_t *const reserved, const size_t length)
 Supplies a list of core IDs that are NOT to be used by MulticoreBSP SPMD runs. More...
 
size_t mcbsp_get_maximum_threads (void)
 
enum mcbsp_affinity_mode mcbsp_get_affinity_mode (void)
 
size_t mcbsp_get_available_cores (void)
 
size_t mcbsp_get_threads_per_core (void)
 
size_t mcbsp_get_unused_threads_per_core (void)
 
enum mcbsp_thread_numbering mcbsp_get_thread_numbering (void)
 
size_t * mcbsp_get_pinning (void)
 
size_t mcbsp_get_reserved_cores_number (void)
 
size_t * mcbsp_get_reserved_cores (void)
 

Variables

enum mcbsp_affinity_mode MCBSP_DEFAULT_AFFINITY
 Default affinity strategy (SCATTER). More...
 
size_t MCBSP_DEFAULT_THREADS_PER_CORE
 Default number of threads per core (1). More...
 
enum mcbsp_thread_numbering MCBSP_DEFAULT_THREAD_NUMBERING
 Default thread numbering (CONSECUTIVE). More...
 

Detailed Description

The MulticoreBSP for C affinity interface

The functions and data types defined in this file allow a user to take control of the way MulticoreBSP pins BSP processes to hardware threads, at run-time.

Changes made to the machine layout using these functions take effect only at the next call to bsp_begin; calling these functions does not affect running SPMD sections.

Values set using this interface supercede values defined in

  1. the `machine.info' file (if it exists);
  2. the default values.

The default values can be changed by directly setting the MCBSP_DEFAULT_AFFINITY, MCBSP_DEFAULT_THREADS_PER_CORE, or MCBSP_DEFAULT_THREAD_NUMBERING globals.

All fields are thread-local. Setting values manually should occur on each thread separately. This is only useful if multiple threads call bsp_begin simultaneously. This is useful when employing hierarchical BSP computations.