Barrelfish
|
Include to use the bomp library. More...
Data Structures | |
struct | __omp_lock |
internal declaration of a simple lock More... | |
Macros | |
#define | OMP_VERSION_31 0x0310 |
#define | BOMP_DEFAULT_STACKSIZE (64 * 1024) |
Flag indicating that all threads should be used. | |
Typedefs | |
typedef enum bomp_backend | bomp_backend_t |
typedef enum omp_sched | omp_sched_t |
Enumerations |
Functions | |
int | bomp_switch_backend (bomp_backend_t backend) |
switches the backend to be used More... | |
bomp_backend_t | bomp_get_backend (void) |
gets the currently enabled backend More... | |
int | bomp_init_cores (void *coresbm, size_t stack_size) |
initializes the BOMP library using the indicated cores of the BM More... | |
int | bomp_init_varstack (unsigned int nthreads, size_t stack_size) |
initializes the BOMP library with the given stack sizes More... | |
void | omp_set_num_threads (int num_threads) |
Sets the number of threads to be used for parallel regions. More... | |
int | omp_get_num_threads (void) |
returns the current number of threads used (innermost parallel region) More... | |
int | omp_get_max_threads (void) |
the maximum number of threads that can be used for a new parallel task More... | |
int | omp_get_thread_num (void) |
Returns the thread number of the calling thread within the current team. More... | |
int | omp_get_num_procs (void) |
returns the number of available processors More... | |
int | omp_in_parallel (void) |
checks if we are currently in a parallel region More... | |
void | omp_set_dynamic (int dynamic_threads) |
enables / disables the dynamic behavior More... | |
int | omp_get_dynamic (void) |
checks if the dynamic behavior is enabled for the current task More... | |
void | omp_set_nested (int nested) |
Enables or disables nested parallelism, by setting the nest-var ICV. More... | |
int | omp_get_nested (void) |
checks if the nested behavior is enabled More... | |
void | omp_set_schedule (omp_sched_t kind, int modifier) |
sets the schedule to be used More... | |
void | omp_get_schedule (omp_sched_t *kind, int *modifier) |
returns the current scheduler settings More... | |
int | omp_get_thread_limit (void) |
obtains he maximum number of OpenMP threads available More... | |
void | omp_set_max_active_levels (int max_active_levels) |
limits the nested depth More... | |
int | omp_get_max_active_levels (void) |
returns the maximim nested depth More... | |
int | omp_get_level (void) |
returns the level the task is runnig at More... | |
int | omp_get_ancestor_thread_num (int level) |
returns the ancestor thread number of a thread at a given level More... | |
int | omp_get_team_size (int level) |
returns the team size of a thread at a given level More... | |
int | omp_get_active_level (void) |
returns the number of active, nested parallel regions More... | |
int | omp_in_final (void) |
checks if thread is in the final task region More... | |
void | omp_init_lock (omp_lock_t *lock) |
initializes and allocates a simple OpenMP lock More... | |
void | omp_destroy_lock (omp_lock_t *lock) |
destroys a simple OpenMP lock More... | |
void | omp_set_lock (omp_lock_t *lock) |
acquires a simple OpenMP lock More... | |
void | omp_unset_lock (omp_lock_t *lock) |
Releases the simple OpenMP lock. More... | |
int | omp_test_lock (omp_lock_t *lock) |
tries to acquire a simple openMP lock More... | |
void | omp_init_nest_lock (omp_nest_lock_t *lock) |
initializes and allocates a nested OpenMP lock More... | |
void | omp_destroy_nest_lock (omp_nest_lock_t *lock) |
destroys a Nested OpenMP lock More... | |
void | omp_set_nest_lock (omp_nest_lock_t *lock) |
acquires a simple OpenMP lock More... | |
void | omp_unset_nest_lock (omp_nest_lock_t *lock) |
Releases the simple OpenMP lock. More... | |
int | omp_test_nest_lock (omp_nest_lock_t *lock) |
tries to acquire a simple openMP lock More... | |
double | omp_get_wtime (void) |
returns elapsed wall clock time in seconds. More... | |
double | omp_get_wtick (void) |
returns the precision of the timer used by omp_get_wtime. More... | |
Include to use the bomp library.
#define OMP_VERSION_31 0x0310 |
defines which OpenMP version is supported by the backend
OpenMP 4.0: 0x0400 OpenMP 3.1: 0x0310
typedef enum bomp_backend bomp_backend_t |
BOMP backend types
typedef enum omp_sched omp_sched_t |
OpenMP schedule types
enum bomp_backend |
BOMP backend types
enum omp_sched |
OpenMP schedule types
bomp_backend_t bomp_get_backend | ( | void | ) |
gets the currently enabled backend
int bomp_init_cores | ( | void * | coresbm, |
size_t | stack_size | ||
) |
initializes the BOMP library using the indicated cores of the BM
coresbm | bitmap representing the cores to run on |
stack_size | size of the thread's stack in bytes |
int bomp_init_varstack | ( | unsigned int | nthreads, |
size_t | stack_size | ||
) |
initializes the BOMP library with the given stack sizes
stack_size | size of the thread's stack in bytes |
This function will use the first nthreads cores to run on
get the maximum number of cores
int bomp_switch_backend | ( | bomp_backend_t | backend | ) |
switches the backend to be used
backend | Backend to activate |
XXX: this has only to be used if XOMP and BOMP are used in the same library
void omp_destroy_lock | ( | omp_lock_t * | arg | ) |
destroys a simple OpenMP lock
arg | OpenMP lock to destroyed (set to zero) |
The effect of these routines is to change the state of the lock to uninitialized.
void omp_destroy_nest_lock | ( | omp_nest_lock_t * | arg | ) |
destroys a Nested OpenMP lock
arg | OpenMP lock to destroyed (set to zero) |
The effect of these routines is to change the state of the lock to uninitialized.
int omp_get_active_level | ( | void | ) |
returns the number of active, nested parallel regions
The effect of the omp_get_active_level routine is to return the number of nested, active parallel regions enclosing the current task such that all of the parallel regions are enclosed by the outermost initial task region on the current device.
int omp_get_ancestor_thread_num | ( | int | level | ) |
returns the ancestor thread number of a thread at a given level
level | the level of the ancestor |
The omp_get_ancestor_thread_num routine returns the thread number of the ancestor at a given nest level of the current thread or the thread number of the current thread. If the requested nest level is outside the range of 0 and the nest level of the current thread, as returned by the omp_get_level routine, the routine returns -1.
int omp_get_dynamic | ( | void | ) |
checks if the dynamic behavior is enabled for the current task
This routine returns the value of the dyn-var ICV, which is true if dynamic adjustment of the number of threads is enabled for the current task.
int omp_get_level | ( | void | ) |
returns the level the task is runnig at
number | enclosing nested parallel regions |
For the enclosing device region, returns the levels-vars ICV, which is the number of nested parallel regions that enclose the task containing the call.
int omp_get_max_active_levels | ( | void | ) |
returns the maximim nested depth
Returns the value of max-active-levels-var ICV, which determines the maximum number of nested active parallel regions.
int omp_get_max_threads | ( | void | ) |
the maximum number of threads that can be used for a new parallel task
Returns an upper bound on the number of threads that could be used to form a new team if a parallel construct without a num_threads clause were encountered after execution returns from this routine.
The value returned by omp_get_max_threads is the value of the first element of the nthreads-var ICV of the current task. This value is also an upper bound on the number of threads that could be used to form a new team if a parallel region without a num_threads clause were encountered after execution returns from this routine.
int omp_get_nested | ( | void | ) |
checks if the nested behavior is enabled
Returns the value of the nest-var ICV, which indicates if nested parallelism is enabled or disabled.
int omp_get_num_procs | ( | void | ) |
returns the number of available processors
Returns the number of processors that are available to the device at the time the routine is called.
int omp_get_num_threads | ( | void | ) |
returns the current number of threads used (innermost parallel region)
Returns the number of threads in the current team. The binding region for an omp_get_num_threads region is the innermost enclosing parallel region. If called from the sequential part of a program, this routine returns 1.
if we are nested return 1
void omp_get_schedule | ( | omp_sched_t * | kind, |
int * | modifier | ||
) |
returns the current scheduler settings
kind | returns the current scheduler setting (one of OMP_SCHED_*) |
modifier | returns the modifier of the scheduler |
Returns the value of run-sched-var ICV, which is the schedule applied when runtime schedule is used.
int omp_get_team_size | ( | int | level | ) |
returns the team size of a thread at a given level
level | the level to consider |
The omp_get_team_size routine returns the size of the thread team to which the ancestor or the current thread belongs. If the requested nested level is outside the range of 0 and the nested level of the current thread, as returned by the omp_get_level routine, the routine returns -1. Inactive parallel regions are regarded like active parallel regions executed with one thread.
int omp_get_thread_limit | ( | void | ) |
obtains he maximum number of OpenMP threads available
Returns the value of the thread-limit-var ICV, which is the maximum number of OpenMP threads available.
The binding thread set for an omp_get_thread_limit region is all threads on the device. The effect of executing this routine is not related to any specific region corresponding to any construct or API routine.
int omp_get_thread_num | ( | void | ) |
Returns the thread number of the calling thread within the current team.
double omp_get_wtick | ( | void | ) |
returns the precision of the timer used by omp_get_wtime.
The omp_get_wtick routine returns a value equal to the number of seconds between successive clock ticks of the timer used by omp_get_wtime.
double omp_get_wtime | ( | void | ) |
returns elapsed wall clock time in seconds.
The omp_get_wtime routine returns a value equal to the elapsed wall clock time in seconds since some “time in the past”. The actual “time in the past” is arbitrary, but it is guaranteed not to change during the execution of the application program. The time returned is a “per-thread time”, so it is not required to be globally consistent across all the threads participating in an application.
int omp_in_final | ( | void | ) |
checks if thread is in the final task region
Returns true if the routine is executed in a final task region; otherwise, it returns false.
int omp_in_parallel | ( | void | ) |
checks if we are currently in a parallel region
Returns true if the active-levels-var ICV is greater than zero; otherwise it returns false. The effect of the omp_in_parallel routine is to return true if the current task is enclosed by an active parallel region, and the parallel region is enclosed by the outermost initial task region on the device; otherwise it returns false.
void omp_init_lock | ( | omp_lock_t * | arg | ) |
initializes and allocates a simple OpenMP lock
arg | returned pointer to the lock |
The effect of these routines is to initialize the lock to the unlocked state; that is, no task owns the lock.
void omp_init_nest_lock | ( | omp_nest_lock_t * | arg | ) |
initializes and allocates a nested OpenMP lock
arg | returned pointer to the lock |
The effect of these routines is to initialize the lock to the unlocked state; that is, no task owns the lock. In addition, the nesting count for a nestable lock is set to zero.
void omp_set_dynamic | ( | int | dynamic_threads | ) |
enables / disables the dynamic behavior
dynamic_threads | zero to disable dynamic behavior non-zero to enable dynamic behavior |
Returns the value of the dyn-var ICV, which indicates if dynamic adjustment of the number of threads is enabled or disabled.
void omp_set_lock | ( | omp_lock_t * | arg | ) |
acquires a simple OpenMP lock
arg | The lock to acquire |
Each of these routines causes suspension of the task executing the routine until the specified lock is available and then sets the lock.
void omp_set_max_active_levels | ( | int | max_active_levels | ) |
limits the nested depth
max_active_levels | maximum nested level |
Limits the number of nested active parallel regions, by setting max-active-levels-var ICV.
void omp_set_nest_lock | ( | omp_nest_lock_t * | arg | ) |
acquires a simple OpenMP lock
arg | The lock to acquire |
Each of these routines causes suspension of the task executing the routine until the specified lock is available and then sets the lock.
A nestable lock is available if it is unlocked or if it is already owned by the task executing the routine. The task executing the routine is granted, or retains, ownership of the lock, and the nesting count for the lock is incremented.
void omp_set_nested | ( | int | nested | ) |
Enables or disables nested parallelism, by setting the nest-var ICV.
nested | TRUE: enable nested behavior FALSE: disable nested behavior |
void omp_set_num_threads | ( | int | num_threads | ) |
Sets the number of threads to be used for parallel regions.
num_threads | the number of threads |
Affects the number of threads used for subsequent parallel regions not specifying a num_threads clause, by setting the value of the first element of the nthreads-var ICV of the current task to num_threads.
void omp_set_schedule | ( | omp_sched_t | kind, |
int | modifier | ||
) |
sets the schedule to be used
kind | which schedule to be used (one of OMP_SCHED_*) |
modifier | modifier to tweak the scheduler (depends on kind) |
The omp_set_schedule routine affects the schedule that is applied when runtime is used as schedule kind, by setting the value of the run-sched-var ICV.
int omp_test_lock | ( | omp_lock_t * | arg | ) |
tries to acquire a simple openMP lock
arg | The OpenMP lock to acquire |
These routines attempt to set a lock in the same manner as omp_set_lock and omp_set_nest_lock, except that they do not suspend execution of the task executing the routine. For a simple lock, the omp_test_lock routine returns true if the lock is successfully set; otherwise, it returns false.
int omp_test_nest_lock | ( | omp_nest_lock_t * | arg | ) |
tries to acquire a simple openMP lock
arg | The OpenMP lock to acquire |
These routines attempt to set a lock in the same manner as omp_set_lock and omp_set_nest_lock, except that they do not suspend execution of the task executing the routine. For a nestable lock, the omp_test_nest_lock routine returns the new nesting count if the lock is successfully set; otherwise, it returns zero.
void omp_unset_lock | ( | omp_lock_t * | arg | ) |
Releases the simple OpenMP lock.
arg | The lock to be released |
For a simple lock, the omp_unset_lock routine causes the lock to become unlocked.
void omp_unset_nest_lock | ( | omp_nest_lock_t * | arg | ) |
Releases the simple OpenMP lock.
arg | The lock to be released |
For a nestable lock, the omp_unset_nest_lock routine decrements the nesting count, and causes the lock to become unlocked if the resulting nesting count is zero.