Thread private data support

Functions

void __kmpc_copyprivate (ident_t *loc, kmp_int32 gtid, size_t cpy_size, void *cpy_data, void(*cpy_func)(void *, void *), kmp_int32 didit)
void * __kmpc_threadprivate_cached (ident_t *loc, kmp_int32 global_tid, void *data, size_t size, void ***cache)
void __kmpc_threadprivate_register (ident_t *loc, void *data, kmpc_ctor ctor, kmpc_cctor cctor, kmpc_dtor dtor)
void __kmpc_threadprivate_register_vec (ident_t *loc, void *data, kmpc_ctor_vec ctor, kmpc_cctor_vec cctor, kmpc_dtor_vec dtor, size_t vector_length)



typedef void *(* kmpc_ctor )(void *)

Detailed Description

These functions support copyin/out and thread private data.


Typedef Documentation

typedef void*(* kmpc_ctor)(void *)

Pointer to the constructor function. The first argument is the this pointer

Definition at line 1269 of file kmp.h.


Function Documentation

void __kmpc_copyprivate ( ident_t loc,
kmp_int32  gtid,
size_t  cpy_size,
void *  cpy_data,
void(*)(void *, void *)  cpy_func,
kmp_int32  didit 
)
Parameters:
loc source location information
gtid global thread number
cpy_size size of the cpy_data buffer
cpy_data pointer to data to be copied
cpy_func helper function to call for copying data
didit flag variable: 1=single thread; 0=not single thread

__kmpc_copyprivate implements the interface for the private data broadcast needed for the copyprivate clause associated with a single region in an OpenMP* program (both C and Fortran). All threads participating in the parallel region call this routine. One of the threads (called the single thread) should have the didit variable set to 1 and all other threads should have that variable set to 0. All threads pass a pointer to a data buffer (cpy_data) that they have built.

The OpenMP specification forbids the use of nowait on the single region when a copyprivate clause is present. However, __kmpc_copyprivate implements a barrier internally to avoid race conditions, so the code generation for the single region should avoid generating a barrier after the call to __kmpc_copyprivate.

The gtid parameter is the global thread id for the current thread. The loc parameter is a pointer to source location information.

Internal implementation: The single thread will first copy its descriptor address (cpy_data) to a team-private location, then the other threads will each call the function pointed to by the parameter cpy_func, which carries out the copy by copying the data using the cpy_data buffer.

The cpy_func routine used for the copy and the contents of the data area defined by cpy_data and cpy_size may be built in any fashion that will allow the copy to be done. For instance, the cpy_data buffer can hold the actual data to be copied or it may hold a list of pointers to the data. The cpy_func routine must interpret the cpy_data buffer appropriately.

The interface to cpy_func is as follows:

void cpy_func( void *destination, void *source ) 

where void *destination is the cpy_data pointer for the thread being copied to and void *source is the cpy_data pointer for the thread being copied from.

Definition at line 1545 of file kmp_csupport.c.

References __kmp_barrier(), __kmp_env_consistency_check, __kmp_team_from_gtid, bs_plain_barrier, FALSE, KC_TRACE, KMP_MB, and KMP_WARNING.

void* __kmpc_threadprivate_cached ( ident_t loc,
kmp_int32  global_tid,
void *  data,
size_t  size,
void ***  cache 
)
Parameters:
loc source location information
global_tid global thread number
data pointer to data to privatize
size size of data to privatize
cache pointer to cache
Returns:
pointer to private storage

Allocate private storage for threadprivate data.

Definition at line 660 of file kmp_threadprivate.c.

References __kmp_acquire_bootstrap_lock(), __kmp_acquire_lock(), __kmp_allocate, __kmp_global_lock, __kmp_msg(), __kmp_msg_null, __kmp_release_bootstrap_lock(), __kmp_release_lock(), __kmp_threadpriv_cache_list, __kmp_threads_capacity, __kmp_tp_cached, __kmp_tp_cached_lock, __kmp_tp_capacity, __kmpc_threadprivate(), i, KC_TRACE, KMP_HNT, KMP_MB, kmp_ms_fatal, KMP_MSG, private_common::next, TCR_PTR, and TCW_PTR.

void __kmpc_threadprivate_register ( ident_t loc,
void *  data,
kmpc_ctor  ctor,
kmpc_cctor  cctor,
kmpc_dtor  dtor 
)
Parameters:
loc source location information
data pointer to data being privatized
ctor pointer to constructor function for data
cctor pointer to copy constructor function for data
dtor pointer to destructor function for data

Register constructors and destructors for thread private data. This function is called when executing in parallel, when we know the thread id.

Definition at line 562 of file kmp_threadprivate.c.

References __kmp_allocate, __kmp_find_shared_task_common(), __kmp_threadprivate_d_table, shared_common::cct, shared_common::cctor, shared_common::ct, shared_common::ctor, shared_table::data, shared_common::dt, shared_common::dtor, shared_common::gbl_addr, KC_TRACE, KMP_ASSERT, KMP_HASH, and shared_common::next.

void __kmpc_threadprivate_register_vec ( ident_t loc,
void *  data,
kmpc_ctor_vec  ctor,
kmpc_cctor_vec  cctor,
kmpc_dtor_vec  dtor,
size_t  vector_length 
)
Parameters:
loc source location information
data pointer to data being privatized
ctor pointer to constructor function for data
cctor pointer to copy constructor function for data
dtor pointer to destructor function for data
vector_length length of the vector (bytes or elements?) Register vector constructors and destructors for thread private data.

Definition at line 742 of file kmp_threadprivate.c.

References __kmp_allocate, __kmp_find_shared_task_common(), __kmp_threadprivate_d_table, shared_common::cct, shared_common::cctorv, shared_common::ct, shared_common::ctorv, shared_table::data, shared_common::dt, shared_common::dtorv, shared_common::gbl_addr, shared_common::is_vec, KC_TRACE, KMP_ASSERT, KMP_HASH, shared_common::next, TRUE, and shared_common::vec_len.


Generated on 25 Aug 2013 for libomp_oss by  doxygen 1.6.1