StarPU Handbook

Data Structures | Macros | Enumerations
OpenMP Runtime Support

This section describes the interface provided for implementing OpenMP runtimes on top of StarPU. More...

## Data Structures
struct | starpu_omp_lock_t
struct | starpu_omp_nest_lock_t
struct | starpu_omp_parallel_region_attr
struct | starpu_omp_task_region_attr

## Macros
#define | STARPU_OPENMP
#define | __STARPU_OMP_NOTHROW

## Enumerations
enum | starpu_omp_sched_value { starpu_omp_sched_undefined , starpu_omp_sched_static , starpu_omp_sched_dynamic , starpu_omp_sched_guided , starpu_omp_sched_auto , starpu_omp_sched_runtime }
enum | starpu_omp_proc_bind_value { starpu_omp_proc_bind_undefined , starpu_omp_proc_bind_false , starpu_omp_proc_bind_true , starpu_omp_proc_bind_master , starpu_omp_proc_bind_close , starpu_omp_proc_bind_spread }

## Initialisation
int | starpu_omp_init (void) __STARPU_OMP_NOTHROW
void | starpu_omp_shutdown (void) __STARPU_OMP_NOTHROW

## Parallel
void | starpu_omp_parallel_region (const struct starpu_omp_parallel_region_attr *attr) __STARPU_OMP_NOTHROW
void | starpu_omp_master (void(*f)(void *arg), void *arg) __STARPU_OMP_NOTHROW
int | starpu_omp_master_inline (void) __STARPU_OMP_NOTHROW

## Synchronization
void | starpu_omp_barrier (void) __STARPU_OMP_NOTHROW
void | starpu_omp_critical (void(*f)(void *arg), void *arg, const char *name) __STARPU_OMP_NOTHROW
void | starpu_omp_critical_inline_begin (const char *name) __STARPU_OMP_NOTHROW
void | starpu_omp_critical_inline_end (const char *name) __STARPU_OMP_NOTHROW

## Worksharing
void | starpu_omp_single (void(*f)(void *arg), void *arg, int nowait) __STARPU_OMP_NOTHROW
int | starpu_omp_single_inline (void) __STARPU_OMP_NOTHROW
void | starpu_omp_single_copyprivate (void(*f)(void *arg, void *data, unsigned long long data_size), void *arg, void *data, unsigned long long data_size) __STARPU_OMP_NOTHROW
void * | starpu_omp_single_copyprivate_inline_begin (void *data) __STARPU_OMP_NOTHROW
void | starpu_omp_single_copyprivate_inline_end (void) __STARPU_OMP_NOTHROW
void | starpu_omp_for (void(*f)(unsigned long long _first_i, unsigned long long _nb_i, void *arg), void *arg, unsigned long long nb_iterations, unsigned long long chunk, int schedule, int ordered, int nowait) __STARPU_OMP_NOTHROW
int | starpu_omp_for_inline_first (unsigned long long nb_iterations, unsigned long long chunk, int schedule, int ordered, unsigned long long *_first_i, unsigned long long *_nb_i) __STARPU_OMP_NOTHROW
int | starpu_omp_for_inline_next (unsigned long long nb_iterations, unsigned long long chunk, int schedule, int ordered, unsigned long long *_first_i, unsigned long long *_nb_i) __STARPU_OMP_NOTHROW
void | starpu_omp_for_alt (void(*f)(unsigned long long _begin_i, unsigned long long _end_i, void *arg), void *arg, unsigned long long nb_iterations, unsigned long long chunk, int schedule, int ordered, int nowait) __STARPU_OMP_NOTHROW
int | starpu_omp_for_inline_first_alt (unsigned long long nb_iterations, unsigned long long chunk, int schedule, int ordered, unsigned long long *_begin_i, unsigned long long *_end_i) __STARPU_OMP_NOTHROW
int | starpu_omp_for_inline_next_alt (unsigned long long nb_iterations, unsigned long long chunk, int schedule, int ordered, unsigned long long *_begin_i, unsigned long long *_end_i) __STARPU_OMP_NOTHROW
void | starpu_omp_ordered (void(*f)(void *arg), void *arg) __STARPU_OMP_NOTHROW
void | starpu_omp_ordered_inline_begin (void) __STARPU_OMP_NOTHROW
void | starpu_omp_ordered_inline_end (void) __STARPU_OMP_NOTHROW
void | starpu_omp_sections (unsigned long long nb_sections, void(**section_f)(void *arg), void **section_arg, int nowait) __STARPU_OMP_NOTHROW
void | starpu_omp_sections_combined (unsigned long long nb_sections, void(*section_f)(unsigned long long section_num, void *arg), void *section_arg, int nowait) __STARPU_OMP_NOTHROW

## Task
void | starpu_omp_task_region (const struct starpu_omp_task_region_attr *attr) __STARPU_OMP_NOTHROW
void | starpu_omp_taskwait (void) __STARPU_OMP_NOTHROW
void | starpu_omp_taskgroup (void(*f)(void *arg), void *arg) __STARPU_OMP_NOTHROW
void | starpu_omp_taskgroup_inline_begin (void) __STARPU_OMP_NOTHROW
void | starpu_omp_taskgroup_inline_end (void) __STARPU_OMP_NOTHROW
void | starpu_omp_taskloop_inline_begin (struct starpu_omp_task_region_attr *attr) __STARPU_OMP_NOTHROW
void | starpu_omp_taskloop_inline_end (const struct starpu_omp_task_region_attr *attr) __STARPU_OMP_NOTHROW

## API
void | starpu_omp_set_num_threads (int threads) __STARPU_OMP_NOTHROW
int | starpu_omp_get_num_threads () __STARPU_OMP_NOTHROW
int | starpu_omp_get_thread_num () __STARPU_OMP_NOTHROW
int | starpu_omp_get_max_threads () __STARPU_OMP_NOTHROW
int | starpu_omp_get_num_procs (void) __STARPU_OMP_NOTHROW
int | starpu_omp_in_parallel (void) __STARPU_OMP_NOTHROW
void | starpu_omp_set_dynamic (int dynamic_threads) __STARPU_OMP_NOTHROW
int | starpu_omp_get_dynamic (void) __STARPU_OMP_NOTHROW
void | starpu_omp_set_nested (int nested) __STARPU_OMP_NOTHROW
int | starpu_omp_get_nested (void) __STARPU_OMP_NOTHROW
int | starpu_omp_get_cancellation (void) __STARPU_OMP_NOTHROW
void | starpu_omp_set_schedule (enum starpu_omp_sched_value kind, int modifier) __STARPU_OMP_NOTHROW
void | starpu_omp_get_schedule (enum starpu_omp_sched_value *kind, int *modifier) __STARPU_OMP_NOTHROW
int | starpu_omp_get_thread_limit (void) __STARPU_OMP_NOTHROW
void | starpu_omp_set_max_active_levels (int max_levels) __STARPU_OMP_NOTHROW
int | starpu_omp_get_max_active_levels (void) __STARPU_OMP_NOTHROW
int | starpu_omp_get_level (void) __STARPU_OMP_NOTHROW
int | starpu_omp_get_ancestor_thread_num (int level) __STARPU_OMP_NOTHROW
int | starpu_omp_get_team_size (int level) __STARPU_OMP_NOTHROW
int | starpu_omp_get_active_level (void) __STARPU_OMP_NOTHROW
int | starpu_omp_in_final (void) __STARPU_OMP_NOTHROW
enum starpu_omp_proc_bind_value | starpu_omp_get_proc_bind (void) __STARPU_OMP_NOTHROW
int | starpu_omp_get_num_places (void) __STARPU_OMP_NOTHROW
int | starpu_omp_get_place_num_procs (int place_num) __STARPU_OMP_NOTHROW
void | starpu_omp_get_place_proc_ids (int place_num, int *ids) __STARPU_OMP_NOTHROW
int | starpu_omp_get_place_num (void) __STARPU_OMP_NOTHROW
int | starpu_omp_get_partition_num_places (void) __STARPU_OMP_NOTHROW
void | starpu_omp_get_partition_place_nums (int *place_nums) __STARPU_OMP_NOTHROW
void | starpu_omp_set_default_device (int device_num) __STARPU_OMP_NOTHROW
int | starpu_omp_get_default_device (void) __STARPU_OMP_NOTHROW
int | starpu_omp_get_num_devices (void) __STARPU_OMP_NOTHROW
int | starpu_omp_get_num_teams (void) __STARPU_OMP_NOTHROW
int | starpu_omp_get_team_num (void) __STARPU_OMP_NOTHROW
int | starpu_omp_is_initial_device (void) __STARPU_OMP_NOTHROW
int | starpu_omp_get_initial_device (void) __STARPU_OMP_NOTHROW
int | starpu_omp_get_max_task_priority (void) __STARPU_OMP_NOTHROW
void | starpu_omp_init_lock (starpu_omp_lock_t *lock) __STARPU_OMP_NOTHROW
void | starpu_omp_destroy_lock (starpu_omp_lock_t *lock) __STARPU_OMP_NOTHROW
void | starpu_omp_set_lock (starpu_omp_lock_t *lock) __STARPU_OMP_NOTHROW
void | starpu_omp_unset_lock (starpu_omp_lock_t *lock) __STARPU_OMP_NOTHROW
int | starpu_omp_test_lock (starpu_omp_lock_t *lock) __STARPU_OMP_NOTHROW
void | starpu_omp_init_nest_lock (starpu_omp_nest_lock_t *lock) __STARPU_OMP_NOTHROW
void | starpu_omp_destroy_nest_lock (starpu_omp_nest_lock_t *lock) __STARPU_OMP_NOTHROW
void | starpu_omp_set_nest_lock (starpu_omp_nest_lock_t *lock) __STARPU_OMP_NOTHROW
void | starpu_omp_unset_nest_lock (starpu_omp_nest_lock_t *lock) __STARPU_OMP_NOTHROW
int | starpu_omp_test_nest_lock (starpu_omp_nest_lock_t *lock) __STARPU_OMP_NOTHROW
void | starpu_omp_atomic_fallback_inline_begin (void) __STARPU_OMP_NOTHROW
void | starpu_omp_atomic_fallback_inline_end (void) __STARPU_OMP_NOTHROW
double | starpu_omp_get_wtime (void) __STARPU_OMP_NOTHROW
double | starpu_omp_get_wtick (void) __STARPU_OMP_NOTHROW
void | starpu_omp_vector_annotate (starpu_data_handle_t handle, uint32_t slice_base) __STARPU_OMP_NOTHROW
struct starpu_arbiter * | starpu_omp_get_default_arbiter (void) __STARPU_OMP_NOTHROW

## Detailed Description

This section describes the interface provided for implementing OpenMP runtimes on top of StarPU.

## Data Structure Documentation

## ◆ starpu_omp_lock_t

struct starpu_omp_lock_t

Opaque Simple Lock object () for inter-task synchronization operations.

See also
  starpu_omp_init_lock()
  starpu_omp_destroy_lock()
  starpu_omp_set_lock()
  starpu_omp_unset_lock()
  starpu_omp_test_lock()

Data Fields
void * | internal | opaque pointer for internal use

## ◆ starpu_omp_nest_lock_t

struct starpu_omp_nest_lock_t

Opaque Nestable Lock object () for inter-task synchronization operations.

See also
  starpu_omp_init_nest_lock()
  starpu_omp_destroy_nest_lock()
  starpu_omp_set_nest_lock()
  starpu_omp_unset_nest_lock()
  starpu_omp_test_nest_lock()

Data Fields
void * | internal | opaque pointer for internal use

## ◆ starpu_omp_parallel_region_attr

struct starpu_omp_parallel_region_attr

Set of attributes used for creating a new parallel region.

See also
  starpu_omp_parallel_region()

Data Fields
struct starpu_codelet | cl | starpu_codelet (Codelet And Tasks) to use for the parallel region implicit tasks. The codelet must provide a CPU implementation function.
starpu_data_handle_t * | handles | Array of zero or more starpu_data_handle_t data handle to be passed to the parallel region implicit tasks.
void * | cl_arg | Optional pointer to an inline argument to be passed to the region implicit tasks.
size_t | cl_arg_size | Size of the optional inline argument to be passed to the region implicit tasks, or 0 if unused.
unsigned | cl_arg_free | Boolean indicating whether the optional inline argument should be automatically freed (true), or not (false).
int | if_clause | Boolean indicating whether the if clause of the corresponding `pragma omp parallel` is true or false.
int | num_threads | Integer indicating the requested number of threads in the team of the newly created parallel region, or 0 to let the runtime choose the number of threads alone. This attribute may be ignored by the runtime system if the requested number of threads is higher than the number of threads that the runtime can create.

## ◆ starpu_omp_task_region_attr

struct starpu_omp_task_region_attr

Set of attributes used for creating a new task region.

See also
  starpu_omp_task_region()

Data Fields
struct starpu_codelet | cl | starpu_codelet (Codelet And Tasks) to use for the task region explicit task. The codelet must provide a CPU implementation function or an accelerator implementation for offloaded target regions.
starpu_data_handle_t * | handles | Array of zero or more starpu_data_handle_t data handle to be passed to the task region explicit tasks.
void * | cl_arg | Optional pointer to an inline argument to be passed to the region implicit tasks.
size_t | cl_arg_size | Size of the optional inline argument to be passed to the region implicit tasks, or 0 if unused.
unsigned | cl_arg_free | Boolean indicating whether the optional inline argument should be automatically freed (true), or not (false).
int | priority |
int | if_clause | Boolean indicating whether the if clause of the corresponding `pragma omp task` is true or false.
int | final_clause | Boolean indicating whether the final clause of the corresponding `pragma omp task` is true or false.
int | untied_clause | Boolean indicating whether the untied clause of the corresponding `pragma omp task` is true or false.
int | mergeable_clause | Boolean indicating whether the mergeable clause of the corresponding `pragma omp task` is true or false.
int | is_loop | taskloop attribute
int | nogroup_clause |
int | collapse |
int | num_tasks |
unsigned long long | nb_iterations |
unsigned long long | grainsize |
unsigned long long | begin_i |
unsigned long long | end_i |
unsigned long long | chunk |

## Macro Definition Documentation

## ◆ STARPU_OPENMP

#define STARPU_OPENMP

Defined when StarPU has been installed with OpenMP Runtime support. It should be used in your code to detect the availability of the runtime support for OpenMP.

## Enumeration Type Documentation

## ◆ starpu_omp_sched_value

enum starpu_omp_sched_value

Set of constants for selecting the for loop iteration scheduling algorithm () as defined by the OpenMP specification.

See also
  starpu_omp_for()
  starpu_omp_for_inline_first()
  starpu_omp_for_inline_next()
  starpu_omp_for_alt()
  starpu_omp_for_inline_first_alt()
  starpu_omp_for_inline_next_alt()

Enumerator
starpu_omp_sched_undefined | Undefined iteration scheduling algorithm.
starpu_omp_sched_static | Static iteration scheduling algorithm.
starpu_omp_sched_dynamic | Dynamic iteration scheduling algorithm.
starpu_omp_sched_guided | Guided iteration scheduling algorithm.
starpu_omp_sched_auto | Automatically choosen iteration scheduling algorithm.
starpu_omp_sched_runtime | Choice of iteration scheduling algorithm deferred at runtime.

## ◆ starpu_omp_proc_bind_value

enum starpu_omp_proc_bind_value

Set of constants for selecting the processor binding method, as defined in the OpenMP specification.

See also
  starpu_omp_get_proc_bind()

Enumerator
starpu_omp_proc_bind_undefined | Undefined processor binding method.
starpu_omp_proc_bind_false | Team threads may be moved between places at any time.
starpu_omp_proc_bind_true | Team threads may not be moved between places.
starpu_omp_proc_bind_master | Assign every thread in the team to the same place as the master thread.
starpu_omp_proc_bind_close | Assign every thread in the team to a place close to the parent thread.
starpu_omp_proc_bind_spread | Assign team threads as a sparse distribution over the selected places.

## Function Documentation

## ◆ starpu_omp_init()

int starpu_omp_init | ( | void |  | ) |

Initialize StarPU and its OpenMP Runtime support.

## ◆ starpu_omp_shutdown()

void starpu_omp_shutdown | ( | void |  | ) |

Shutdown StarPU and its OpenMP Runtime support.

## ◆ starpu_omp_parallel_region()

void starpu_omp_parallel_region | ( | const struct starpu_omp_parallel_region_attr * | attr | ) |

Generate and launch an OpenMP parallel region and return after its completion. `attr` specifies the attributes for the generated parallel region. If this function is called from inside another, generating, parallel region, the generated parallel region is nested within the generating parallel region.

This function can be used to implement `#pragma omp parallel`.

## ◆ starpu_omp_master()

void starpu_omp_master | ( | void(*)(void *arg) | f,
|  | void * | arg
| ) |  |

Execute a function only on the master thread of the OpenMP parallel region it is called from. When called from a thread that is not the master of the parallel region it is called from, this function does nothing. `f` is the function to be called. `arg` is an argument passed to function `f`.

This function can be used to implement `#pragma omp master`.

## ◆ starpu_omp_master_inline()

int starpu_omp_master_inline | ( | void |  | ) |

Determine whether the calling thread is the master of the OpenMP parallel region it is called from or not.

This function can be used to implement `#pragma omp master` without code outlining.

Returns
  `!0` if called by the region's master thread.
  `0` if not called by the region's master thread.

## ◆ starpu_omp_barrier()

void starpu_omp_barrier | ( | void |  | ) |

Wait until each participating thread of the innermost OpenMP parallel region has reached the barrier and each explicit OpenMP task bound to this region has completed its execution.

This function can be used to implement `#pragma omp barrier`.

## ◆ starpu_omp_critical()

void starpu_omp_critical | ( | void(*)(void *arg) | f,
|  | void * | arg,
|  | const char * | name
| ) |  |

Wait until no other thread is executing within the context of the selected critical section, then proceeds to the exclusive execution of a function within the critical section. `f` is the function to be executed in the critical section. `arg` is an argument passed to function `f`. `name` is the name of the selected critical section. If `name == NULL`, the selected critical section is the unique anonymous critical section.

This function can be used to implement `#pragma omp critical`.

## ◆ starpu_omp_critical_inline_begin()

void starpu_omp_critical_inline_begin | ( | const char * | name | ) |

Wait until execution can proceed exclusively within the context of the selected critical section. `name` is the name of the selected critical section. If `name == NULL`, the selected critical section is the unique anonymous critical section.

This function together with starpu_omp_critical_inline_end can be used to implement `#pragma omp critical` without code outlining.

## ◆ starpu_omp_critical_inline_end()

void starpu_omp_critical_inline_end | ( | const char * | name | ) |

End the exclusive execution within the context of the selected critical section. `name` is the name of the selected critical section. If `name==NULL`, the selected critical section is the unique anonymous critical section.

This function together with starpu_omp_critical_inline_begin can be used to implement `#pragma omp critical` without code outlining.

## ◆ starpu_omp_single()

void starpu_omp_single | ( | void(*)(void *arg) | f,
|  | void * | arg,
|  | int | nowait
| ) |  |

Ensure that a single participating thread of the innermost OpenMP parallel region executes a function. `f` is the function to be executed by a single thread. `arg` is an argument passed to function `f`. `nowait` is a flag indicating whether an implicit barrier is requested after the single section (`nowait==0`) or not (`nowait==!0`).

This function can be used to implement `#pragma omp single`.

## ◆ starpu_omp_single_inline()

int starpu_omp_single_inline | ( | void |  | ) |

Decide whether the current thread is elected to run the following single section among the participating threads of the innermost OpenMP parallel region.

This function can be used to implement `#pragma omp single` without code outlining.

Returns
  `!0` if the calling thread has won the election.
  `0` if the calling thread has lost the election.

## ◆ starpu_omp_single_copyprivate()

void starpu_omp_single_copyprivate | ( | void(*)(void *arg, void *data, unsigned long long data_size) | f,
|  | void * | arg,
|  | void * | data,
|  | unsigned long long | data_size
| ) |  |

Execute `f` on a single task of the current parallel region task, and then broadcast the contents of the memory block pointed by the copyprivate pointer `data` and of size `data_size` to the corresponding `data` pointed memory blocks of all the other participating region tasks. This function can be used to implement `#pragma omp single` with a copyprivate clause.

See also
  starpu_omp_single_copyprivate_inline
  starpu_omp_single_copyprivate_inline_begin
  starpu_omp_single_copyprivate_inline_end

## ◆ starpu_omp_single_copyprivate_inline_begin()

void * starpu_omp_single_copyprivate_inline_begin | ( | void * | data | ) |

Elect one task among the tasks of the current parallel region task to execute the following single section, and then broadcast the copyprivate pointer `data` to all the other participating region tasks. This function can be used to implement `#pragma omp single` with a copyprivate clause without code outlining.

See also
  starpu_omp_single_copyprivate_inline
  starpu_omp_single_copyprivate_inline_end

## ◆ starpu_omp_single_copyprivate_inline_end()

void starpu_omp_single_copyprivate_inline_end | ( | void |  | ) |

Complete the execution of a single section and return the broadcasted copyprivate pointer for tasks that lost the election and `NULL` for the task that won the election. This function can be used to implement `#pragma omp single` with a copyprivate clause without code outlining.

Returns
  the copyprivate pointer for tasks that lost the election and therefore did not execute the code of the single section.
  `NULL` for the task that won the election and executed the code of the single section.

See also
  starpu_omp_single_copyprivate_inline
  starpu_omp_single_copyprivate_inline_begin

## ◆ starpu_omp_for()

void starpu_omp_for | ( | void(*)(unsigned long long _first_i, unsigned long long _nb_i, void *arg) | f,
|  | void * | arg,
|  | unsigned long long | nb_iterations,
|  | unsigned long long | chunk,
|  | int | schedule,
|  | int | ordered,
|  | int | nowait
| ) |  |

Execute a parallel loop together with the other threads participating to the innermost parallel region. `f` is the function to be executed iteratively. `arg` is an argument passed to function `f`. `nb_iterations` is the number of iterations to be performed by the parallel loop. `chunk` is the number of consecutive iterations that should be affected to the same thread when scheduling the loop workshares, it follows the semantics of the `modifier` argument in OpenMP `#pragma omp for` specification. `schedule` is the scheduling mode according to the OpenMP specification. `ordered` is a flag indicating whether the loop region may contain an ordered section (`ordered==!0`) or not (`ordered==0`). `nowait` is a flag indicating whether an implicit barrier is requested after the for section (`nowait==0`) or not (`nowait==!0`).

The function `f` will be called with arguments `_first_i`, the first iteration to perform, `_nb_i`, the number of consecutive iterations to perform before returning, `arg`, the free `arg` argument.

This function can be used to implement `#pragma omp for`.

## ◆ starpu_omp_for_inline_first()

int starpu_omp_for_inline_first | ( | unsigned long long | nb_iterations,
|  | unsigned long long | chunk,
|  | int | schedule,
|  | int | ordered,
|  | unsigned long long * | _first_i,
|  | unsigned long long * | _nb_i
| ) |  |

Decide whether the current thread should start to execute a parallel loop section. See starpu_omp_for for the argument description.

This function together with starpu_omp_for_inline_next can be used to implement `#pragma omp for` without code outlining.

Returns
  `!0` if the calling thread participates to the loop region and should execute a first chunk of iterations. In that case, `*_first_i` will be set to the first iteration of the chunk to perform and `*_nb_i` will be set to the number of iterations of the chunk to perform.
  `0` if the calling thread does not participate to the loop region because all the available iterations have been affected to the other threads of the parallel region.

See also
  starpu_omp_for

## ◆ starpu_omp_for_inline_next()

int starpu_omp_for_inline_next | ( | unsigned long long | nb_iterations,
|  | unsigned long long | chunk,
|  | int | schedule,
|  | int | ordered,
|  | unsigned long long * | _first_i,
|  | unsigned long long * | _nb_i
| ) |  |

Decide whether the current thread should continue to execute a parallel loop section. See starpu_omp_for for the argument description.

This function together with starpu_omp_for_inline_first can be used to implement `#pragma omp for` without code outlining.

Returns
  `!0` if the calling thread should execute a next chunk of iterations. In that case, `*_first_i` will be set to the first iteration of the chunk to perform and `*_nb_i` will be set to the number of iterations of the chunk to perform.
  `0` if the calling thread does not participate anymore to the loop region because all the available iterations have been affected to the other threads of the parallel region.

See also
  starpu_omp_for

## ◆ starpu_omp_for_alt()

void starpu_omp_for_alt | ( | void(*)(unsigned long long _begin_i, unsigned long long _end_i, void *arg) | f,
|  | void * | arg,
|  | unsigned long long | nb_iterations,
|  | unsigned long long | chunk,
|  | int | schedule,
|  | int | ordered,
|  | int | nowait
| ) |  |

Alternative implementation of a parallel loop. Differ from starpu_omp_for in the expected arguments of the loop function `f`.

The function `f` will be called with arguments `_begin_i`, the first iteration to perform, `_end_i`, the first iteration not to perform before returning, `arg`, the free `arg` argument.

This function can be used to implement `#pragma omp for`.

See also
  starpu_omp_for

## ◆ starpu_omp_for_inline_first_alt()

int starpu_omp_for_inline_first_alt | ( | unsigned long long | nb_iterations,
|  | unsigned long long | chunk,
|  | int | schedule,
|  | int | ordered,
|  | unsigned long long * | _begin_i,
|  | unsigned long long * | _end_i
| ) |  |

Inline version of the alternative implementation of a parallel loop.

This function together with starpu_omp_for_inline_next_alt can be used to implement `#pragma omp for` without code outlining.

See also
  starpu_omp_for
  starpu_omp_for_alt
  starpu_omp_for_inline_first

## ◆ starpu_omp_for_inline_next_alt()

int starpu_omp_for_inline_next_alt | ( | unsigned long long | nb_iterations,
|  | unsigned long long | chunk,
|  | int | schedule,
|  | int | ordered,
|  | unsigned long long * | _begin_i,
|  | unsigned long long * | _end_i
| ) |  |

Inline version of the alternative implementation of a parallel loop.

This function together with starpu_omp_for_inline_first_alt can be used to implement `#pragma omp for` without code outlining.

See also
  starpu_omp_for
  starpu_omp_for_alt
  starpu_omp_for_inline_next

## ◆ starpu_omp_ordered()

void starpu_omp_ordered | ( | void(*)(void *arg) | f,
|  | void * | arg
| ) |  |

Ensure that a function is sequentially executed once for each iteration in order within a parallel loop, by the thread that own the iteration. `f` is the function to be executed by the thread that own the current iteration. `arg` is an argument passed to function `f`.

This function can be used to implement `#pragma omp ordered`.

## ◆ starpu_omp_ordered_inline_begin()

void starpu_omp_ordered_inline_begin | ( | void |  | ) |

Wait until all the iterations of a parallel loop below the iteration owned by the current thread have been executed.

This function together with starpu_omp_ordered_inline_end can be used to implement `#pragma omp ordered` without code code outlining.

## ◆ starpu_omp_ordered_inline_end()

void starpu_omp_ordered_inline_end | ( | void |  | ) |

Notify that the ordered section for the current iteration has been completed.

This function together with starpu_omp_ordered_inline_begin can be used to implement `#pragma omp ordered` without code code outlining.

## ◆ starpu_omp_sections()

void starpu_omp_sections | ( | unsigned long long | nb_sections,
|  | void(**)(void *arg) | section_f,
|  | void ** | section_arg,
|  | int | nowait
| ) |  |

Ensure that each function of a given array of functions is executed by one and only one thread. `nb_sections` is the number of functions in the array `section_f`. `section_f` is the array of functions to be executed as sections. `section_arg` is an array of arguments to be passed to the corresponding function. `nowait` is a flag indicating whether an implicit barrier is requested after the execution of all the sections (`nowait==0`) or not (`nowait==!0`).

This function can be used to implement `#pragma omp sections` and `#pragma omp section`.

## ◆ starpu_omp_sections_combined()

void starpu_omp_sections_combined | ( | unsigned long long | nb_sections,
|  | void(*)(unsigned long long section_num, void *arg) | section_f,
|  | void * | section_arg,
|  | int | nowait
| ) |  |

Alternative implementation of sections. Differ from starpu_omp_sections in that all the sections are combined within a single function in this version. `section_f` is the function implementing the combined sections.

The function `section_f` will be called with arguments `section_num`, the section number to be executed, `arg`, the entry of `section_arg` corresponding to this section.

This function can be used to implement `#pragma omp sections` and `#pragma omp section`.

See also
  starpu_omp_sections

## ◆ starpu_omp_task_region()

void starpu_omp_task_region | ( | const struct starpu_omp_task_region_attr * | attr | ) |

Generate an explicit child task. The execution of the generated task is asynchronous with respect to the calling code unless specified otherwise. `attr` specifies the attributes for the generated task region.

This function can be used to implement `#pragma omp task`.

## ◆ starpu_omp_taskwait()

void starpu_omp_taskwait | ( | void |  | ) |

Wait for the completion of the tasks generated by the current task. This function does not wait for the descendants of the tasks generated by the current task.

This function can be used to implement `#pragma omp taskwait`.

## ◆ starpu_omp_taskgroup()

void starpu_omp_taskgroup | ( | void(*)(void *arg) | f,
|  | void * | arg
| ) |  |

Launch a function and wait for the completion of every descendant task generated during the execution of the function.

This function can be used to implement `#pragma omp taskgroup`.

See also
  starpu_omp_taskgroup_inline_begin
  starpu_omp_taskgroup_inline_end

## ◆ starpu_omp_taskgroup_inline_begin()

void starpu_omp_taskgroup_inline_begin | ( | void |  | ) |

Launch a function and gets ready to wait for the completion of every descendant task generated during the dynamic scope of the taskgroup.

This function can be used to implement `#pragma omp taskgroup` without code outlining.

See also
  starpu_omp_taskgroup
  starpu_omp_taskgroup_inline_end

## ◆ starpu_omp_taskgroup_inline_end()

void starpu_omp_taskgroup_inline_end | ( | void |  | ) |

Wait for the completion of every descendant task generated during the dynamic scope of the taskgroup.

This function can be used to implement `#pragma omp taskgroup` without code outlining.

See also
  starpu_omp_taskgroup
  starpu_omp_taskgroup_inline_begin

## ◆ starpu_omp_set_num_threads()

void starpu_omp_set_num_threads | ( | int | threads | ) |

Set ICVS nthreads_var for the parallel regions to be created with the current region.

Note: The StarPU OpenMP runtime support currently ignores this setting for nested parallel regions.

See also
  starpu_omp_get_num_threads
  starpu_omp_get_thread_num
  starpu_omp_get_max_threads
  starpu_omp_get_num_procs

## ◆ starpu_omp_get_num_threads()

int starpu_omp_get_num_threads | ( |  | ) |

Return the number of threads of the current region.

Returns
  the number of threads of the current region.

See also
  starpu_omp_set_num_threads
  starpu_omp_get_thread_num
  starpu_omp_get_max_threads
  starpu_omp_get_num_procs

## ◆ starpu_omp_get_thread_num()

int starpu_omp_get_thread_num | ( |  | ) |

Return the rank of the current thread among the threads of the current region.

Returns
  the rank of the current thread in the current region.

See also
  starpu_omp_set_num_threads
  starpu_omp_get_num_threads
  starpu_omp_get_max_threads
  starpu_omp_get_num_procs

## ◆ starpu_omp_get_max_threads()

int starpu_omp_get_max_threads | ( |  | ) |

Return the maximum number of threads that can be used to create a region from the current region.

Returns
  the maximum number of threads that can be used to create a region from the current region.

See also
  starpu_omp_set_num_threads
  starpu_omp_get_num_threads
  starpu_omp_get_thread_num
  starpu_omp_get_num_procs

## ◆ starpu_omp_get_num_procs()

int starpu_omp_get_num_procs | ( | void |  | ) |

Return the number of StarPU CPU workers.

Returns
  the number of StarPU CPU workers.

See also
  starpu_omp_set_num_threads
  starpu_omp_get_num_threads
  starpu_omp_get_thread_num
  starpu_omp_get_max_threads

## ◆ starpu_omp_in_parallel()

int starpu_omp_in_parallel | ( | void |  | ) |

Return whether it is called from the scope of a parallel region or not.

Returns
  `!0` if called from a parallel region scope.
  `0` otherwise.

## ◆ starpu_omp_set_dynamic()

void starpu_omp_set_dynamic | ( | int | dynamic_threads | ) |

Enable (1) or disable (0) dynamically adjusting the number of parallel threads.

Note: The StarPU OpenMP runtime support currently ignores the argument of this function.

See also
  starpu_omp_get_dynamic

## ◆ starpu_omp_get_dynamic()

int starpu_omp_get_dynamic | ( | void |  | ) |

Return the state of dynamic thread number adjustment.

Returns
  `!0` if dynamic thread number adjustment is enabled.
  `0` otherwise.

See also
  starpu_omp_set_dynamic

## ◆ starpu_omp_set_nested()

void starpu_omp_set_nested | ( | int | nested | ) |

Enable (1) or disable (0) nested parallel regions.

Note: The StarPU OpenMP runtime support currently ignores the argument of this function.

See also
  starpu_omp_get_nested
  starpu_omp_get_max_active_levels
  starpu_omp_set_max_active_levels
  starpu_omp_get_level
  starpu_omp_get_active_level

## ◆ starpu_omp_get_nested()

int starpu_omp_get_nested | ( | void |  | ) |

Return whether nested parallel sections are enabled or not.

Returns
  `!0` if nested parallel sections are enabled.
  `0` otherwise.

See also
  starpu_omp_set_nested
  starpu_omp_get_max_active_levels
  starpu_omp_set_max_active_levels
  starpu_omp_get_level
  starpu_omp_get_active_level

## ◆ starpu_omp_get_cancellation()

int starpu_omp_get_cancellation | ( | void |  | ) |

Return the state of the cancel ICVS var.

## ◆ starpu_omp_set_schedule()

void starpu_omp_set_schedule | ( | enum starpu_omp_sched_value | kind,
|  | int | modifier
| ) |  |

Set the default scheduling kind for upcoming loops within the current parallel section. `kind` is the scheduler kind, `modifier` complements the scheduler kind with informations such as the chunk size, in accordance with the OpenMP specification.

See also
  starpu_omp_get_schedule

## ◆ starpu_omp_get_schedule()

void starpu_omp_get_schedule | ( | enum starpu_omp_sched_value * | kind,
|  | int * | modifier
| ) |  |

Return the current selected default loop scheduler.

Returns
  the kind and the modifier of the current default loop scheduler.

See also
  starpu_omp_set_schedule

## ◆ starpu_omp_get_thread_limit()

int starpu_omp_get_thread_limit | ( | void |  | ) |

Return the number of StarPU CPU workers.

Returns
  the number of StarPU CPU workers.

## ◆ starpu_omp_set_max_active_levels()

void starpu_omp_set_max_active_levels | ( | int | max_levels | ) |

Set the maximum number of allowed active parallel section levels.

Note: The StarPU OpenMP runtime support currently ignores the argument of this function and assume `max_levels` equals `1` instead.

See also
  starpu_omp_set_nested
  starpu_omp_get_nested
  starpu_omp_get_max_active_levels
  starpu_omp_get_level
  starpu_omp_get_active_level

## ◆ starpu_omp_get_max_active_levels()

int starpu_omp_get_max_active_levels | ( | void |  | ) |

Return the current maximum number of allowed active parallel section levels

Returns
  the current maximum number of allowed active parallel section levels.

See also
  starpu_omp_set_nested
  starpu_omp_get_nested
  starpu_omp_set_max_active_levels
  starpu_omp_get_level
  starpu_omp_get_active_level

## ◆ starpu_omp_get_level()

int starpu_omp_get_level | ( | void |  | ) |

Return the nesting level of the current parallel section.

Returns
  the nesting level of the current parallel section.

See also
  starpu_omp_set_nested
  starpu_omp_get_nested
  starpu_omp_get_max_active_levels
  starpu_omp_set_max_active_levels
  starpu_omp_get_active_level

## ◆ starpu_omp_get_ancestor_thread_num()

int starpu_omp_get_ancestor_thread_num | ( | int | level | ) |

Return the number of the ancestor of the current parallel section.

Returns
  the number of the ancestor of the current parallel section.

## ◆ starpu_omp_get_team_size()

int starpu_omp_get_team_size | ( | int | level | ) |

Return the size of the team of the current parallel section.

Returns
  the size of the team of the current parallel section.

## ◆ starpu_omp_get_active_level()

int starpu_omp_get_active_level | ( | void |  | ) |

Return the nestinglevel of the current innermost active parallel section.

Returns
  the nestinglevel of the current innermost active parallel section.

See also
  starpu_omp_set_nested
  starpu_omp_get_nested
  starpu_omp_get_max_active_levels
  starpu_omp_set_max_active_levels
  starpu_omp_get_level

## ◆ starpu_omp_in_final()

int starpu_omp_in_final | ( | void |  | ) |

Check whether the current task is final or not.

Returns
  `!0` if called from a final task.
  `0` otherwise.

## ◆ starpu_omp_get_proc_bind()

enum starpu_omp_proc_bind_value starpu_omp_get_proc_bind | ( | void |  | ) |

Return the proc_bind setting of the current parallel region.

Returns
  the proc_bind setting of the current parallel region.

## ◆ starpu_omp_set_default_device()

void starpu_omp_set_default_device | ( | int | device_num | ) |

Set the number of the device to use as default.

Note: The StarPU OpenMP runtime support currently ignores the argument of this function.

See also
  starpu_omp_get_default_device
  starpu_omp_is_initial_device

## ◆ starpu_omp_get_default_device()

int starpu_omp_get_default_device | ( | void |  | ) |

Return the number of the device used as default.

Returns
  the number of the device used as default.

See also
  starpu_omp_set_default_device
  starpu_omp_is_initial_device

## ◆ starpu_omp_get_num_devices()

int starpu_omp_get_num_devices | ( | void |  | ) |

Return the number of the devices.

Returns
  the number of the devices.

## ◆ starpu_omp_get_num_teams()

int starpu_omp_get_num_teams | ( | void |  | ) |

Return the number of teams in the current teams region.

Returns
  the number of teams in the current teams region.

See also
  starpu_omp_get_num_teams

## ◆ starpu_omp_get_team_num()

int starpu_omp_get_team_num | ( | void |  | ) |

Return the team number of the calling thread.

Returns
  the team number of the calling thread.

See also
  starpu_omp_get_num_teams

## ◆ starpu_omp_is_initial_device()

int starpu_omp_is_initial_device | ( | void |  | ) |

Check whether the current device is the initial device or not.

## ◆ starpu_omp_get_max_task_priority()

int starpu_omp_get_max_task_priority | ( | void |  | ) |

Return the maximum value that can be specified in the priority clause.

Returns
  `!0` if called from the host device.
  `0` otherwise.

See also
  starpu_omp_set_default_device
  starpu_omp_get_default_device

## ◆ starpu_omp_init_lock()

void starpu_omp_init_lock | ( | starpu_omp_lock_t * | lock | ) |

Initialize an opaque lock object.

See also
  starpu_omp_destroy_lock
  starpu_omp_set_lock
  starpu_omp_unset_lock
  starpu_omp_test_lock

## ◆ starpu_omp_destroy_lock()

void starpu_omp_destroy_lock | ( | starpu_omp_lock_t * | lock | ) |

Destroy an opaque lock object.

See also
  starpu_omp_init_lock
  starpu_omp_set_lock
  starpu_omp_unset_lock
  starpu_omp_test_lock

## ◆ starpu_omp_set_lock()

void starpu_omp_set_lock | ( | starpu_omp_lock_t * | lock | ) |

Lock an opaque lock object. If the lock is already locked, the function will block until it succeeds in exclusively acquiring the lock.

See also
  starpu_omp_init_lock
  starpu_omp_destroy_lock
  starpu_omp_unset_lock
  starpu_omp_test_lock

## ◆ starpu_omp_unset_lock()

void starpu_omp_unset_lock | ( | starpu_omp_lock_t * | lock | ) |

Unlock a previously locked lock object. The behaviour of this function is unspecified if it is called on an unlocked lock object.

See also
  starpu_omp_init_lock
  starpu_omp_destroy_lock
  starpu_omp_set_lock
  starpu_omp_test_lock

## ◆ starpu_omp_test_lock()

int starpu_omp_test_lock | ( | starpu_omp_lock_t * | lock | ) |

Unblockingly attempt to lock a lock object and return whether it succeeded or not.

Returns
  `!0` if the function succeeded in acquiring the lock.
  `0` if the lock was already locked.

See also
  starpu_omp_init_lock
  starpu_omp_destroy_lock
  starpu_omp_set_lock
  starpu_omp_unset_lock

## ◆ starpu_omp_init_nest_lock()

void starpu_omp_init_nest_lock | ( | starpu_omp_nest_lock_t * | lock | ) |

Initialize an opaque lock object supporting nested locking operations.

See also
  starpu_omp_destroy_nest_lock
  starpu_omp_set_nest_lock
  starpu_omp_unset_nest_lock
  starpu_omp_test_nest_lock

## ◆ starpu_omp_destroy_nest_lock()

void starpu_omp_destroy_nest_lock | ( | starpu_omp_nest_lock_t * | lock | ) |

Destroy an opaque lock object supporting nested locking operations.

See also
  starpu_omp_init_nest_lock
  starpu_omp_set_nest_lock
  starpu_omp_unset_nest_lock
  starpu_omp_test_nest_lock

## ◆ starpu_omp_set_nest_lock()

void starpu_omp_set_nest_lock | ( | starpu_omp_nest_lock_t * | lock | ) |

Lock an opaque lock object supporting nested locking operations. If the lock is already locked by another task, the function will block until it succeeds in exclusively acquiring the lock. If the lock is already taken by the current task, the function will increase the nested locking level of the lock object.

See also
  starpu_omp_init_nest_lock
  starpu_omp_destroy_nest_lock
  starpu_omp_unset_nest_lock
  starpu_omp_test_nest_lock

## ◆ starpu_omp_unset_nest_lock()

void starpu_omp_unset_nest_lock | ( | starpu_omp_nest_lock_t * | lock | ) |

Unlock a previously locked lock object supporting nested locking operations. If the lock has been locked multiple times in nested fashion, the nested locking level is decreased and the lock remains locked. Otherwise, if the lock has only been locked once, it becomes unlocked. The behaviour of this function is unspecified if it is called on an unlocked lock object. The behaviour of this function is unspecified if it is called from a different task than the one that locked the lock object.

See also
  starpu_omp_init_nest_lock
  starpu_omp_destroy_nest_lock
  starpu_omp_set_nest_lock
  starpu_omp_test_nest_lock

## ◆ starpu_omp_test_nest_lock()

int starpu_omp_test_nest_lock | ( | starpu_omp_nest_lock_t * | lock | ) |

Unblocking attempt to lock an opaque lock object supporting nested locking operations and returns whether it succeeded or not. If the lock is already locked by another task, the function will return without having acquired the lock. If the lock is already taken by the current task, the function will increase the nested locking level of the lock object.

Returns
  `!0` if the function succeeded in acquiring the lock.
  `0` if the lock was already locked.

See also
  starpu_omp_init_nest_lock
  starpu_omp_destroy_nest_lock
  starpu_omp_set_nest_lock
  starpu_omp_unset_nest_lock

## ◆ starpu_omp_atomic_fallback_inline_begin()

void starpu_omp_atomic_fallback_inline_begin | ( | void |  | ) |

Implement the entry point of a fallback global atomic region. Block until it succeeds in acquiring exclusive access to the global atomic region.

See also
  starpu_omp_atomic_fallback_inline_end

## ◆ starpu_omp_atomic_fallback_inline_end()

void starpu_omp_atomic_fallback_inline_end | ( | void |  | ) |

Implement the exit point of a fallback global atomic region. Release the exclusive access to the global atomic region.

See also
  starpu_omp_atomic_fallback_inline_begin

## ◆ starpu_omp_get_wtime()

double starpu_omp_get_wtime | ( | void |  | ) |

Return the elapsed wallclock time in seconds.

Returns
  the elapsed wallclock time in seconds.

See also
  starpu_omp_get_wtick

## ◆ starpu_omp_get_wtick()

double starpu_omp_get_wtick | ( | void |  | ) |

Return the precision of the time used by `starpu_omp_get_wtime()`.

Returns
  the precision of the time used by `starpu_omp_get_wtime()`.

See also
  starpu_omp_get_wtime

## ◆ starpu_omp_vector_annotate()

void starpu_omp_vector_annotate | ( | starpu_data_handle_t | handle,
|  | uint32_t | slice_base
| ) |  |

Enable setting additional vector metadata needed by the OpenMP Runtime Support.

`handle` is vector data handle. `slice_base` is the base of an array slice, expressed in number of vector elements from the array base.

See also
  STARPU_VECTOR_GET_SLICE_BASE