123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463 |
- /*
- * This file is part of the StarPU Handbook.
- * Copyright (C) 2014 Inria
- * See the file version.doxy for copying conditions.
- */
- /*! \defgroup API_OpenMP_Runtime_Support OpenMP Runtime Support
- @name Initialisation
- \ingroup API_OpenMP_Runtime_Support
- \def STARPU_OPENMP
- \ingroup API_OpenMP_Runtime_Support
- This macro is 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.
- \fn int starpu_omp_init(void)
- \ingroup API_OpenMP_Runtime_Support
- Initializes StarPU and its OpenMP Runtime support.
- \fn int starpu_omp_shutdown(void)
- \ingroup API_OpenMP_Runtime_Support
- Shutdown StarPU and its OpenMP Runtime support.
- @name Parallel
- \anchor ORS_Parallel
- \ingroup API_OpenMP_Runtime_Support
- \fn void starpu_omp_parallel_region(const struct starpu_omp_parallel_region_attr *attr)
- \ingroup API_OpenMP_Runtime_Support
- Generates and launch an OpenMP parallel region and return after its
- completion. \p 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 <c>\#pragma omp parallel</c>.
- \fn void starpu_omp_master(void (*f)(void *arg), void *arg)
- \ingroup API_OpenMP_Runtime_Support
- Executes 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. \p
- f is the function to be called. \p arg is an argument passed to function \p f.
- This function can be used to implement <c>\#pragma omp master</c>.
- \fn int starpu_omp_master_inline(void)
- \ingroup API_OpenMP_Runtime_Support
- Determines 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 <c>\#pragma omp master</c> without code
- outlining.
- \return <c>!0</c> if called by the region's master thread.
- \return <c>0</c> if not called by the region's master thread.
- @name Synchronization
- \anchor ORS_Synchronization
- \ingroup API_OpenMP_Runtime_Support
- \fn void starpu_omp_barrier(void)
- \ingroup API_OpenMP_Runtime_Support
- Waits 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 <c>\#pragma omp barrier</c>.
- \fn void starpu_omp_critical(void (*f)(void *arg), void *arg, const char *name)
- \ingroup API_OpenMP_Runtime_Support
- Waits 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. \p f is the function to be executed in the critical
- section. \p arg is an argument passed to function \p f. \p name is the name of
- the selected critical section. If <c>name == NULL</c>, the selected critical
- section is the unique anonymous critical section.
- This function can be used to implement <c>\#pragma omp critical</c>.
- \fn void starpu_omp_critical_inline_begin(const char *name)
- \ingroup API_OpenMP_Runtime_Support
- Waits until execution can proceed exclusively within the context of the
- selected critical section. \p name is the name of the selected critical
- section. If <c>name == NULL</c>, the selected critical section is the unique
- anonymous critical section.
- This function together with #starpu_omp_critical_inline_end can be used to
- implement <c>\#pragma omp critical</c> without code outlining.
- \fn void starpu_omp_critical_inline_end(const char *name)
- \ingroup API_OpenMP_Runtime_Support
- Ends the exclusive execution within the context of the selected critical
- section. \p name is the name of the selected critical section. If
- <c>name==NULL</c>, the selected critical section is the unique anonymous
- critical section.
- This function together with #starpu_omp_critical_inline_begin can be used to
- implement <c>\#pragma omp critical</c> without code outlining.
- @name Worksharing
- \anchor ORS_Worksharing
- \ingroup API_OpenMP_Runtime_Support
- \fn void starpu_omp_single(void (*f)(void *arg), void *arg, int nowait)
- \ingroup API_OpenMP_Runtime_Support
- Ensures that a single participating thread of the innermost OpenMP parallel
- region executes a function. \p f is the function to be executed by a single
- thread. \p arg is an argument passed to function \p f. \p nowait is a flag
- indicating whether an implicit barrier is requested after the single section
- (<c>nowait==0</c>) or not (<c>nowait==!0</c>).
- This function can be used to implement <c>\#pragma omp single</c>.
- \fn int starpu_omp_single_inline(void)
- \ingroup API_OpenMP_Runtime_Support
- Decides 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 <c>\#pragma omp single</c> without code
- outlining.
- \return <c>!0</c> if the calling thread has won the election.
- \return <c>0</c> if the calling thread has lost the election.
- \fn 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)
- \ingroup API_OpenMP_Runtime_Support
- Executes a parallel loop together with the other threads participating to the
- innermost parallel region. \p f is the function to be executed iteratively. \p
- arg is an argument passed to function \p f. \p nb_iterations is the number of
- iterations to be performed by the parallel loop. \p 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 \c modifier
- argument in OpenMP <c>\#pragma omp for</c> specification. \p schedule is the
- scheduling mode according to the OpenMP specification. \p ordered is a flag
- indicating whether the loop region may contain an ordered section
- (<c>ordered==!0</c>) or not (<c>ordered==0</c>). \p nowait is a flag
- indicating whether an implicit barrier is requested after the for section
- (<c>nowait==0</c>) or not (<c>nowait==!0</c>).
- The function \p f will be called with arguments \p _first_i, the first iteration
- to perform, \p _nb_i, the number of consecutive iterations to perform before
- returning, \p arg, the free \p arg argument.
- This function can be used to implement <c>\#pragma omp for</c>.
- \fn 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)
- \ingroup API_OpenMP_Runtime_Support
- Decides 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 <c>\#pragma omp for</c> without code outlining.
- \return <c>!0</c> if the calling thread participates to the loop region and
- should execute a first chunk of iterations. In that case, \p *_first_i will be
- set to the first iteration of the chunk to perform and \p *_nb_i will be set to
- the number of iterations of the chunk to perform.
- \return <c>0</c> 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.
- \sa starpu_omp_for
- \fn 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)
- \ingroup API_OpenMP_Runtime_Support
- Decides 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 <c>\#pragma omp for</c> without code outlining.
- \return <c>!0</c> if the calling thread should execute a next chunk of
- iterations. In that case, \p *_first_i will be set to the first iteration of the
- chunk to perform and \p *_nb_i will be set to the number of iterations of the
- chunk to perform.
- \return <c>0</c> 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.
- \sa starpu_omp_for
- \fn 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)
- \ingroup API_OpenMP_Runtime_Support
- Alternative implementation of a parallel loop. This function differs from
- #starpu_omp_for in the expected arguments of the loop function \c f.
- The function \p f will be called with arguments \p _begin_i, the first iteration
- to perform, \p _end_i, the first iteration not to perform before
- returning, \p arg, the free \p arg argument.
- This function can be used to implement <c>\#pragma omp for</c>.
- \sa starpu_omp_for
- \fn 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)
- \ingroup API_OpenMP_Runtime_Support
- 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 <c>\#pragma omp for</c> without code outlining.
- \sa starpu_omp_for
- \sa starpu_omp_for_alt
- \sa starpu_omp_for_inline_first
- \fn 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)
- \ingroup API_OpenMP_Runtime_Support
- 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 <c>\#pragma omp for</c> without code outlining.
- \sa starpu_omp_for
- \sa starpu_omp_for_alt
- \sa starpu_omp_for_inline_next
- \fn void starpu_omp_ordered(void (*f)(void *arg), void *arg)
- \ingroup API_OpenMP_Runtime_Support
- Ensures that a function is sequentially executed once for each iteration in
- order within a parallel loop, by the thread that own the iteration. \p f is the
- function to be executed by the thread that own the current iteration. \p arg is
- an argument passed to function \p f.
- This function can be used to implement <c>\#pragma omp ordered</c>.
- \fn void starpu_omp_ordered_inline_begin(void)
- \ingroup API_OpenMP_Runtime_Support
- Waits 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 <c>\#pragma omp ordered</c> without code code outlining.
- \fn void starpu_omp_ordered_inline_end(void)
- \ingroup API_OpenMP_Runtime_Support
- Notifies 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 <c>\#pragma omp ordered</c> without code code outlining.
- \fn void starpu_omp_sections(unsigned long long nb_sections, void (**section_f)(void *arg), void **section_arg, int nowait)
- \ingroup API_OpenMP_Runtime_Support
- Ensures that each function of a given array of functions is executed by one and
- only one thread. \p nb_sections is the number of functions in the array \p
- section_f. \p section_f is the array of functions to be executed as sections. \p
- section_arg is an array of arguments to be passed to the corresponding function.
- \p nowait is a flag indicating whether an implicit barrier is requested after
- the execution of all the sections (<c>nowait==0</c>) or not (<c>nowait==!0</c>).
- This function can be used to implement <c>\#pragma omp sections</c> and <c>\#pragma omp section</c>.
- \fn 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)
- \ingroup API_OpenMP_Runtime_Support
- Alternative implementation of sections. This function differs from
- #starpu_omp_sections in that all the sections are combined within a single
- function in this version. \p section_f is the function implementing the combined
- sections.
- The function \p section_f will be called with arguments \p section_num, the
- section number to be executed, \p arg, the entry of \p section_arg corresponding
- to this section.
- This function can be used to implement <c>\#pragma omp sections</c> and <c>\#pragma omp section</c>.
- \sa starpu_omp_sections
- @name Task
- \anchor ORS_Task
- \ingroup API_OpenMP_Runtime_Support
- \fn void starpu_omp_task_region(const struct starpu_omp_task_region_attr *attr)
- \ingroup API_OpenMP_Runtime_Support
- Generates an explicit child task. The execution of the generated task is
- asynchronous with respect to the calling code unless specified otherwise.
- \p attr specifies the attributes for the generated task region.
- This function can be used to implement <c>\#pragma omp task</c>.
- \fn void starpu_omp_taskwait(void)
- \ingroup API_OpenMP_Runtime_Support
- Waits 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 <c>\#pragma omp taskwait</c>.
- \fn void starpu_omp_taskgroup(void (*f)(void *arg), void *arg)
- \ingroup API_OpenMP_Runtime_Support
- Launches 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 <c>\#pragma omp taskgroup</c>.
- @name API
- \anchor ORS_API
- \ingroup API_OpenMP_Runtime_Support
- \fn void starpu_omp_set_num_threads(int threads)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_num_threads()
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_thread_num()
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_max_threads()
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_num_procs (void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_in_parallel (void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn void starpu_omp_set_dynamic (int dynamic_threads)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_dynamic (void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn void starpu_omp_set_nested (int nested)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_nested (void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_cancellation(void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn void starpu_omp_set_schedule (enum starpu_omp_sched_value kind, int modifier)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn void starpu_omp_get_schedule (enum starpu_omp_sched_value *kind, int *modifier)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_thread_limit (void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn void starpu_omp_set_max_active_levels (int max_levels)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_max_active_levels (void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_level (void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_ancestor_thread_num (int level)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_team_size (int level)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_active_level (void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_in_final(void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn enum starpu_omp_proc_bind_value starpu_omp_get_proc_bind(void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn void starpu_omp_set_default_device(int device_num)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_default_device(void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_num_devices(void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_num_teams(void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_get_team_num(void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_is_initial_device(void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn void starpu_omp_init_lock (starpu_omp_lock_t *lock)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn void starpu_omp_destroy_lock (starpu_omp_lock_t *lock)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn void starpu_omp_set_lock (starpu_omp_lock_t *lock)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn void starpu_omp_unset_lock (starpu_omp_lock_t *lock)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_test_lock (starpu_omp_lock_t *lock)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn void starpu_omp_init_nest_lock (starpu_omp_nest_lock_t *lock)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn void starpu_omp_destroy_nest_lock (starpu_omp_nest_lock_t *lock)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn void starpu_omp_set_nest_lock (starpu_omp_nest_lock_t *lock)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn void starpu_omp_unset_nest_lock (starpu_omp_nest_lock_t *lock)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn int starpu_omp_test_nest_lock (starpu_omp_nest_lock_t *lock)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn double starpu_omp_get_wtime (void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- \fn double starpu_omp_get_wtick (void)
- \ingroup API_OpenMP_Runtime_Support
- This function .
- */
|