Work Sharing

Enumerations

enum  sched_type {
  kmp_sch_lower = 32, kmp_sch_static_chunked = 33, kmp_sch_static = 34, kmp_sch_dynamic_chunked = 35,
  kmp_sch_guided_chunked = 36, kmp_sch_runtime = 37, kmp_sch_auto = 38, kmp_sch_trapezoidal = 39,
  kmp_sch_static_greedy = 40, kmp_sch_static_balanced = 41, kmp_sch_guided_iterative_chunked = 42, kmp_sch_guided_analytical_chunked = 43,
  kmp_sch_static_steal = 44, kmp_sch_upper = 45, kmp_ord_lower = 64, kmp_ord_static_chunked = 65,
  kmp_ord_static = 66, kmp_ord_dynamic_chunked = 67, kmp_ord_guided_chunked = 68, kmp_ord_runtime = 69,
  kmp_ord_auto = 70, kmp_ord_trapezoidal = 71, kmp_ord_upper = 72, kmp_nm_lower = 160,
  kmp_nm_static_chunked = 161, kmp_nm_static = 162, kmp_nm_dynamic_chunked = 163, kmp_nm_guided_chunked = 164,
  kmp_nm_runtime = 165, kmp_nm_auto = 166, kmp_nm_trapezoidal = 167, kmp_nm_static_greedy = 168,
  kmp_nm_static_balanced = 169, kmp_nm_guided_iterative_chunked = 170, kmp_nm_guided_analytical_chunked = 171, kmp_nm_static_steal = 172,
  kmp_nm_ord_static_chunked = 193, kmp_nm_ord_static = 194, kmp_nm_ord_dynamic_chunked = 195, kmp_nm_ord_guided_chunked = 196,
  kmp_nm_ord_runtime = 197, kmp_nm_ord_auto = 198, kmp_nm_ord_trapezoidal = 199, kmp_nm_upper = 200,
  kmp_sch_default = kmp_sch_static
}

Functions

void __kmpc_critical (ident_t *loc, kmp_int32 global_tid, kmp_critical_name *crit)
void __kmpc_end_critical (ident_t *loc, kmp_int32 global_tid, kmp_critical_name *crit)
void __kmpc_end_master (ident_t *loc, kmp_int32 global_tid)
void __kmpc_end_ordered (ident_t *loc, kmp_int32 gtid)
void __kmpc_end_single (ident_t *loc, kmp_int32 global_tid)
void __kmpc_for_static_fini (ident_t *loc, kmp_int32 global_tid)
kmp_int32 __kmpc_master (ident_t *loc, kmp_int32 global_tid)
void __kmpc_ordered (ident_t *loc, kmp_int32 gtid)
kmp_int32 __kmpc_single (ident_t *loc, kmp_int32 global_tid)



void __kmpc_dispatch_init_4 (ident_t *loc, kmp_int32 gtid, enum sched_type schedule, kmp_int32 lb, kmp_int32 ub, kmp_int32 st, kmp_int32 chunk)



void __kmpc_for_static_init_4 (ident_t *loc, kmp_int32 gtid, kmp_int32 schedtype, kmp_int32 *plastiter, kmp_int32 *plower, kmp_int32 *pupper, kmp_int32 *pstride, kmp_int32 incr, kmp_int32 chunk)
void __kmpc_for_static_init_4u (ident_t *loc, kmp_int32 gtid, kmp_int32 schedtype, kmp_int32 *plastiter, kmp_uint32 *plower, kmp_uint32 *pupper, kmp_int32 *pstride, kmp_int32 incr, kmp_int32 chunk)
void __kmpc_for_static_init_8 (ident_t *loc, kmp_int32 gtid, kmp_int32 schedtype, kmp_int32 *plastiter, kmp_int64 *plower, kmp_int64 *pupper, kmp_int64 *pstride, kmp_int64 incr, kmp_int64 chunk)
void __kmpc_for_static_init_8u (ident_t *loc, kmp_int32 gtid, kmp_int32 schedtype, kmp_int32 *plastiter, kmp_uint64 *plower, kmp_uint64 *pupper, kmp_int64 *pstride, kmp_int64 incr, kmp_int64 chunk)

Detailed Description

These functions are used for implementing #pragma omp for, #pragma omp sections, #pragma omp single and #pragma omp master constructs.

When handling loops, there are different functions for each of the signed and unsigned 32 and 64 bit integer types which have the name suffixes `_4`, `_4u`, `_8` and `_8u`. The semantics of each of the functions is the same, so they are only described once.

Static loop scheduling is handled by __kmpc_for_static_init_4 and friends. Only a single call is needed, since the iterations to be executed by any give thread can be determined as soon as the loop parameters are known.

Dynamic scheduling is handled by the __kmpc_dispatch_init_4 and __kmpc_dispatch_next_4 functions. The init function is called once in each thread outside the loop, while the next function is called each time that the previous chunk of work has been exhausted.


Enumeration Type Documentation

enum sched_type

Describes the loop schedule to be used for a parallel for loop.

Enumerator:
kmp_sch_lower 

lower bound for unordered values

kmp_sch_static_chunked 
kmp_sch_static 

static unspecialized

kmp_sch_dynamic_chunked 
kmp_sch_guided_chunked 

guided unspecialized

kmp_sch_runtime 
kmp_sch_auto 

auto

kmp_sch_trapezoidal 
kmp_sch_static_greedy 
kmp_sch_static_balanced 
kmp_sch_guided_iterative_chunked 
kmp_sch_guided_analytical_chunked 
kmp_sch_static_steal 

accessible only through KMP_SCHEDULE environment variable

kmp_sch_upper 

upper bound for unordered values

kmp_ord_lower 

lower bound for ordered values, must be power of 2

kmp_ord_static_chunked 
kmp_ord_static 

ordered static unspecialized

kmp_ord_dynamic_chunked 
kmp_ord_guided_chunked 
kmp_ord_runtime 
kmp_ord_auto 

ordered auto

kmp_ord_trapezoidal 
kmp_ord_upper 

upper bound for ordered values

kmp_nm_lower 

lower bound for nomerge values

kmp_nm_static_chunked 
kmp_nm_static 

static unspecialized

kmp_nm_dynamic_chunked 
kmp_nm_guided_chunked 

guided unspecialized

kmp_nm_runtime 
kmp_nm_auto 

auto

kmp_nm_trapezoidal 
kmp_nm_static_greedy 
kmp_nm_static_balanced 
kmp_nm_guided_iterative_chunked 
kmp_nm_guided_analytical_chunked 
kmp_nm_static_steal 
kmp_nm_ord_static_chunked 
kmp_nm_ord_static 

ordered static unspecialized

kmp_nm_ord_dynamic_chunked 
kmp_nm_ord_guided_chunked 
kmp_nm_ord_runtime 
kmp_nm_ord_auto 

auto

kmp_nm_ord_trapezoidal 
kmp_nm_upper 

upper bound for nomerge values

kmp_sch_default 

default scheduling algorithm

Definition at line 309 of file kmp.h.


Function Documentation

void __kmpc_critical ( ident_t loc,
kmp_int32  global_tid,
kmp_critical_name crit 
)
Parameters:
loc source location information.
global_tid global thread number .
crit identity of the critical section. This could be a pointer to a lock associated with the critical section, or some other suitably unique value.

Enter code protected by a `critical` construct. This function blocks until the executing thread can enter the critical section.

Definition at line 1070 of file kmp_csupport.c.

References __kmp_acquire_user_lock_with_checks(), __kmp_env_consistency_check, __kmp_get_critical_section_ptr(), __kmp_push_sync(), __kmp_user_lock_kind, ct_critical, KA_TRACE, KC_TRACE, KMP_CHECK_USER_LOCK_INIT, kmp_tas_lock::lk, lk_tas, OMP_CRITICAL_SIZE, kmp_base_tas_lock::poll, and kmp_user_lock::tas.

Referenced by GOMP_critical_name_start(), and GOMP_critical_start().

void __kmpc_dispatch_init_4 ( ident_t loc,
kmp_int32  gtid,
enum sched_type  schedule,
kmp_int32  lb,
kmp_int32  ub,
kmp_int32  st,
kmp_int32  chunk 
)
Parameters:
loc Source location
gtid Global thread id
schedule Schedule type
lb Lower bound
ub Upper bound
st Step (or increment if you prefer)
chunk The chunk size to block with

This function prepares the runtime to start a dynamically scheduled for loop, saving the loop arguments. These functions are all identical apart from the types of the arguments.

Definition at line 2141 of file kmp_dispatch.cpp.

References __kmp_init_serial, and KMP_DEBUG_ASSERT.

void __kmpc_end_critical ( ident_t loc,
kmp_int32  global_tid,
kmp_critical_name crit 
)
Parameters:
loc source location information.
global_tid global thread number .
crit identity of the critical section. This could be a pointer to a lock associated with the critical section, or some other suitably unique value.

Leave a critical section, releasing any lock that was held during its execution.

Definition at line 1121 of file kmp_csupport.c.

References __kmp_env_consistency_check, __kmp_pop_sync(), __kmp_release_user_lock_with_checks(), __kmp_user_lock_kind, ct_critical, KA_TRACE, KC_TRACE, KMP_ASSERT, kmp_tas_lock::lk, lk_tas, OMP_CRITICAL_SIZE, ompt_callbacks, ompt_status, ompt_status_track_callback, kmp_base_tas_lock::poll, kmp_user_lock::tas, and TCR_PTR.

Referenced by GOMP_critical_end(), and GOMP_critical_name_end().

void __kmpc_end_master ( ident_t loc,
kmp_int32  global_tid 
)
Parameters:
loc source location information.
global_tid global thread number .

Mark the end of a master region. This should only be called by the thread that executes the master region.

Definition at line 890 of file kmp_csupport.c.

References __kmp_env_consistency_check, __kmp_pop_sync(), __kmp_threads, __kmp_tid_from_gtid, ct_master, KC_TRACE, KMP_DEBUG_ASSERT, KMP_MASTER_GTID, KMP_WARNING, ompt_callbacks, ompt_status, ompt_status_track_callback, and kmp_team::t.

void __kmpc_end_ordered ( ident_t loc,
kmp_int32  gtid 
)
Parameters:
loc source location information.
gtid global thread number.

End execution of an ordered construct.

Definition at line 991 of file kmp_csupport.c.

References __kmp_parallel_dxo(), __kmp_threads, KC_TRACE, ompt_callbacks, ompt_status, and ompt_status_track_callback.

Referenced by GOMP_ordered_end().

void __kmpc_end_single ( ident_t loc,
kmp_int32  global_tid 
)
Parameters:
loc source location information
global_tid global thread number

Mark the end of a single construct. This function should only be called by the thread that executed the block of code protected by the `single` construct.

Definition at line 1303 of file kmp_csupport.c.

References __kmp_exit_single(), __kmp_threads, __kmp_tid_from_gtid, ompt_callbacks, ompt_status, ompt_status_track_callback, and kmp_team::t.

void __kmpc_for_static_fini ( ident_t loc,
kmp_int32  global_tid 
)
Parameters:
loc Source location
global_tid Global thread id

Mark the end of a statically scheduled loop.

Definition at line 1328 of file kmp_csupport.c.

References __kmp_env_consistency_check, __kmp_pop_workshare(), __kmp_threads, __kmp_tid_from_gtid, ct_pdo, KE_TRACE, ompt_callbacks, ompt_status, ompt_status_track_callback, and kmp_team::t.

void __kmpc_for_static_init_4 ( ident_t loc,
kmp_int32  gtid,
kmp_int32  schedtype,
kmp_int32 *  plastiter,
kmp_int32 *  plower,
kmp_int32 *  pupper,
kmp_int32 *  pstride,
kmp_int32  incr,
kmp_int32  chunk 
)
Parameters:
loc Source code location
gtid Global thread id of this thread
schedtype Scheduling type
plastiter Pointer to the "last iteration" flag
plower Pointer to the lower bound
pupper Pointer to the upper bound
pstride Pointer to the stride
incr Pointer to the increment
chunk Pointer to the chunk size

Each of the four functions here are identical apart from the argument types.

The functions compute the upper and lower bounds and stride to be used for the set of iterations to be executed by the current thread from the statically scheduled loop that is described by the initial values of the bround, stride, increment and chunk size.

Definition at line 346 of file kmp_sched.cpp.

void __kmpc_for_static_init_4u ( ident_t loc,
kmp_int32  gtid,
kmp_int32  schedtype,
kmp_int32 *  plastiter,
kmp_uint32 *  plower,
kmp_uint32 *  pupper,
kmp_int32 *  pstride,
kmp_int32  incr,
kmp_int32  chunk 
)

See __kmpc_for_static_init_4

Definition at line 358 of file kmp_sched.cpp.

void __kmpc_for_static_init_8 ( ident_t loc,
kmp_int32  gtid,
kmp_int32  schedtype,
kmp_int32 *  plastiter,
kmp_int64 *  plower,
kmp_int64 *  pupper,
kmp_int64 *  pstride,
kmp_int64  incr,
kmp_int64  chunk 
)

See __kmpc_for_static_init_4

Definition at line 370 of file kmp_sched.cpp.

void __kmpc_for_static_init_8u ( ident_t loc,
kmp_int32  gtid,
kmp_int32  schedtype,
kmp_int32 *  plastiter,
kmp_uint64 *  plower,
kmp_uint64 *  pupper,
kmp_int64 *  pstride,
kmp_int64  incr,
kmp_int64  chunk 
)

See __kmpc_for_static_init_4

Definition at line 382 of file kmp_sched.cpp.

kmp_int32 __kmpc_master ( ident_t loc,
kmp_int32  global_tid 
)
Parameters:
loc source location information.
global_tid global thread number .
Returns:
1 if this thread should execute the master block, 0 otherwise.

Definition at line 844 of file kmp_csupport.c.

References __kmp_check_sync(), __kmp_env_consistency_check, __kmp_init_parallel, __kmp_parallel_initialize(), __kmp_push_sync(), __kmp_threads, __kmp_tid_from_gtid, ct_master, KC_TRACE, KMP_MASTER_GTID, ompt_callbacks, ompt_status, ompt_status_track_callback, status, kmp_team::t, and TCR_4.

Referenced by __kmpc_barrier_master_nowait().

void __kmpc_ordered ( ident_t loc,
kmp_int32  gtid 
)
Parameters:
loc source location information.
gtid global thread number.

Start execution of an ordered construct.

Definition at line 926 of file kmp_csupport.c.

References __kmp_init_parallel, __kmp_init_serial, __kmp_parallel_deo(), __kmp_parallel_initialize(), __kmp_threads, KC_TRACE, KMP_DEBUG_ASSERT, ompt_callbacks, ompt_status, ompt_status_track, ompt_status_track_callback, and TCR_4.

Referenced by GOMP_ordered_start().

kmp_int32 __kmpc_single ( ident_t loc,
kmp_int32  global_tid 
)
Parameters:
loc source location information
global_tid global thread number
Returns:
One if this thread should execute the single construct, zero otherwise.

Test whether to execute a single construct. There are no implicit barriers in the two "single" calls, rather the compiler should introduce an explicit barrier if it is required.

Definition at line 1265 of file kmp_csupport.c.

References __kmp_enter_single(), __kmp_threads, __kmp_tid_from_gtid, ompt_callbacks, ompt_status, ompt_status_track_callback, kmp_team::t, and TRUE.


Generated on 25 Aug 2013 for libomp_oss by  doxygen 1.6.1