本文整理汇总了C++中KMP_DEBUG_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ KMP_DEBUG_ASSERT函数的具体用法?C++ KMP_DEBUG_ASSERT怎么用?C++ KMP_DEBUG_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KMP_DEBUG_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __kmp_common_initialize
/* we are called from __kmp_serial_initialize() with __kmp_initz_lock held. */
void
__kmp_common_initialize( void )
{
if( ! TCR_4(__kmp_init_common) ) {
int q;
#ifdef KMP_DEBUG
int gtid;
#endif
__kmp_threadpriv_cache_list = NULL;
#ifdef KMP_DEBUG
/* verify the uber masters were initialized */
for(gtid = 0 ; gtid < __kmp_threads_capacity; gtid++ )
if( __kmp_root[gtid] ) {
KMP_DEBUG_ASSERT( __kmp_root[gtid]->r.r_uber_thread );
for ( q = 0; q< KMP_HASH_TABLE_SIZE; ++q)
KMP_DEBUG_ASSERT( !__kmp_root[gtid]->r.r_uber_thread->th.th_pri_common->data[q] );
/* __kmp_root[ gitd ]-> r.r_uber_thread -> th.th_pri_common -> data[ q ] = 0;*/
}
#endif /* KMP_DEBUG */
for (q = 0; q < KMP_HASH_TABLE_SIZE; ++q)
__kmp_threadprivate_d_table.data[ q ] = 0;
TCW_4(__kmp_init_common, TRUE);
}
}
示例2: __kmp_str_buf_cat
void
__kmp_str_buf_cat(
kmp_str_buf_t * buffer,
char const * str,
int len
) {
KMP_STR_BUF_INVARIANT( buffer );
KMP_DEBUG_ASSERT( str != NULL );
KMP_DEBUG_ASSERT( len >= 0 );
__kmp_str_buf_reserve( buffer, buffer->used + len + 1 );
memcpy( buffer->str + buffer->used, str, len );
buffer->str[ buffer->used + len ] = 0;
buffer->used += len;
KMP_STR_BUF_INVARIANT( buffer );
} // __kmp_str_buf_cat
示例3: __kmp_env_free
void __kmp_env_free(char const **value) {
KMP_DEBUG_ASSERT(value != NULL);
KMP_INTERNAL_FREE(CCAST(char *, *value));
*value = NULL;
} // func __kmp_env_free
示例4: kmp_threadprivate_insert_private_data
void
kmp_threadprivate_insert_private_data( int gtid, void *pc_addr, void *data_addr, size_t pc_size )
{
struct shared_common **lnk_tn, *d_tn;
KMP_DEBUG_ASSERT( __kmp_threads[ gtid ] &&
__kmp_threads[ gtid ] -> th.th_root -> r.r_active == 0 );
d_tn = __kmp_find_shared_task_common( &__kmp_threadprivate_d_table,
gtid, pc_addr );
if (d_tn == 0) {
d_tn = (struct shared_common *) __kmp_allocate( sizeof( struct shared_common ) );
d_tn->gbl_addr = pc_addr;
d_tn->pod_init = __kmp_init_common_data( data_addr, pc_size );
/*
d_tn->obj_init = 0; // AC: commented out because __kmp_allocate zeroes the memory
d_tn->ct.ctor = 0;
d_tn->cct.cctor = 0;;
d_tn->dt.dtor = 0;
d_tn->is_vec = FALSE;
d_tn->vec_len = 0L;
*/
d_tn->cmn_size = pc_size;
__kmp_acquire_lock( &__kmp_global_lock, gtid );
lnk_tn = &(__kmp_threadprivate_d_table.data[ KMP_HASH(pc_addr) ]);
d_tn->next = *lnk_tn;
*lnk_tn = d_tn;
__kmp_release_lock( &__kmp_global_lock, gtid );
}
}
示例5: ___kmp_env_blk_parse_string
static
void
___kmp_env_blk_parse_string(
kmp_env_blk_t * block, // M: Env block to fill.
char const * env // I: String to parse.
) {
char const chr_delimiter = '|';
char const str_delimiter[] = { chr_delimiter, 0 };
char * bulk = NULL;
kmp_env_var_t * vars = NULL;
int count = 0; // Number of used elements in vars array.
int delimiters = 0; // Number of delimiters in input string.
// Copy original string, we will modify the copy.
bulk = __kmp_str_format( "%s", env );
// Loop thru all the vars in environment block. Count delimiters (maximum number of variables
// is number of delimiters plus one).
{
char const * ptr = bulk;
for ( ; ; ) {
ptr = strchr( ptr, chr_delimiter );
if ( ptr == NULL ) {
break;
}; // if
++ delimiters;
ptr += 1;
}; // forever
}
// Allocate vars array.
vars = (kmp_env_var_t *) allocate( ( delimiters + 1 ) * sizeof( kmp_env_var_t ) );
// Loop thru all the variables.
{
char * var; // Pointer to variable (both name and value).
char * name; // Pointer to name of variable.
char * value; // Pointer to value.
char * buf; // Buffer for __kmp_str_token() function.
var = __kmp_str_token( bulk, str_delimiter, & buf ); // Get the first var.
while ( var != NULL ) {
// Save found variable in vars array.
__kmp_str_split( var, '=', & name, & value );
KMP_DEBUG_ASSERT( count < delimiters + 1 );
vars[ count ].name = name;
vars[ count ].value = value;
++ count;
// Get the next var.
var = __kmp_str_token( NULL, str_delimiter, & buf );
}; // while
}
// Fill out result.
block->bulk = bulk;
block->vars = vars;
block->count = count;
}; // ___kmp_env_blk_parse_string
示例6: __kmp_pragma
// NOTE: Function returns allocated memory, caller must free it!
static char const *
__kmp_pragma(
int ct,
ident_t const * ident
) {
char const * cons = NULL; // Construct name.
char * file = NULL; // File name.
char * func = NULL; // Function (routine) name.
char * line = NULL; // Line number.
kmp_str_buf_t buffer;
kmp_msg_t prgm;
__kmp_str_buf_init( & buffer );
if ( 0 < ct && ct < cons_text_c_num ) {
cons = cons_text_c[ ct ];
} else {
KMP_DEBUG_ASSERT( 0 );
};
if ( ident != NULL && ident->psource != NULL ) {
char * tail = NULL;
__kmp_str_buf_print( & buffer, "%s", ident->psource ); // Copy source to buffer.
// Split string in buffer to file, func, and line.
tail = buffer.str;
__kmp_str_split( tail, ';', NULL, & tail );
__kmp_str_split( tail, ';', & file, & tail );
__kmp_str_split( tail, ';', & func, & tail );
__kmp_str_split( tail, ';', & line, & tail );
}; // if
prgm = __kmp_msg_format( kmp_i18n_fmt_Pragma, cons, file, func, line );
__kmp_str_buf_free( & buffer );
return prgm.str;
} // __kmp_pragma
示例7: __kmp_str_free
void
__kmp_str_free(
char const * * str
) {
KMP_DEBUG_ASSERT( str != NULL );
KMP_INTERNAL_FREE( (void *) * str );
* str = NULL;
} // func __kmp_str_free
示例8: __kmpc_team_static_init_8u
/*!
See @ref __kmpc_team_static_init_4
*/
void
__kmpc_team_static_init_8u(
ident_t *loc, kmp_int32 gtid, kmp_int32 *p_last,
kmp_uint64 *p_lb, kmp_uint64 *p_ub, kmp_int64 *p_st, kmp_int64 incr, kmp_int64 chunk )
{
KMP_DEBUG_ASSERT( __kmp_init_serial );
__kmp_team_static_init< kmp_uint64 >( loc, gtid, p_last, p_lb, p_ub, p_st, incr, chunk );
}
示例9: __kmp_common_destroy_gtid
/* Call all destructors for threadprivate data belonging to this thread */
void
__kmp_common_destroy_gtid( int gtid )
{
struct private_common *tn;
struct shared_common *d_tn;
KC_TRACE( 10, ("__kmp_common_destroy_gtid: T#%d called\n", gtid ) );
if( (__kmp_foreign_tp) ? (! KMP_INITIAL_GTID (gtid)) :
(! KMP_UBER_GTID (gtid)) ) {
if( TCR_4(__kmp_init_common) ) {
#if KMP_THREADPRIVATE_TLS
for(d_tn = kmpc_threadprivate_d_table_data_head_local;
d_tn != NULL;
d_tn = d_tn->next) {
// call destructor
if (d_tn->dt.dtor) d_tn->dt.dtor(NULL);
}
#else
/* Cannot do this here since not all threads have destroyed their data */
/* TCW_4(__kmp_init_common, FALSE); */
for (tn = __kmp_threads[ gtid ]->th.th_pri_head; tn; tn = tn->link) {
d_tn = __kmp_find_shared_task_common( &__kmp_threadprivate_d_table,
gtid, tn->gbl_addr );
KMP_DEBUG_ASSERT( d_tn );
if (d_tn->is_vec) {
if (d_tn->dt.dtorv != 0) {
(void) (*d_tn->dt.dtorv) (tn->par_addr, d_tn->vec_len);
}
if (d_tn->obj_init != 0) {
(void) (*d_tn->dt.dtorv) (d_tn->obj_init, d_tn->vec_len);
}
} else {
if (d_tn->dt.dtor != 0) {
(void) (*d_tn->dt.dtor) (tn->par_addr);
}
if (d_tn->obj_init != 0) {
(void) (*d_tn->dt.dtor) (d_tn->obj_init);
}
}
}
#endif
KC_TRACE( 30, ("__kmp_common_destroy_gtid: T#%d threadprivate destructors complete\n",
gtid ) );
}
}
}
示例10: __kmp_i18n_catclose
void
__kmp_i18n_catclose(
) {
if ( status == KMP_I18N_OPENED ) {
KMP_DEBUG_ASSERT( cat != KMP_I18N_NULLCAT );
catclose( cat );
cat = KMP_I18N_NULLCAT;
}; // if
status = KMP_I18N_CLOSED;
} // func __kmp_i18n_catclose
示例11: __kmp_str_to_uint
void
__kmp_str_to_uint( // R: Error code.
char const * str, // I: String of characters, unsigned number.
kmp_uint64 * out, // O: Parsed number.
char const * * error // O: Null if everything is ok, error message otherwise.
) {
size_t value = 0;
int overflow = 0;
int i = 0;
int digit;
KMP_DEBUG_ASSERT( str != NULL );
// Skip spaces.
while ( str[ i ] == ' ' || str[ i ] == '\t' ) {
++ i;
}; // while
// Parse number.
if ( str[ i ] < '0' || str[ i ] > '9' ) {
* error = KMP_I18N_STR( NotANumber );
return;
}; // if
do {
digit = str[ i ] - '0';
overflow = overflow || ( value > ( KMP_SIZE_T_MAX - digit ) / 10 );
value = ( value * 10 ) + digit;
++ i;
} while ( str[ i ] >= '0' && str[ i ] <= '9' );
// Skip spaces.
while ( str[ i ] == ' ' || str[ i ] == '\t' ) {
++ i;
}; // while
if ( str[ i ] != 0 ) {
* error = KMP_I18N_STR( IllegalCharacters );
return;
}; // if
if ( overflow ) {
* error = KMP_I18N_STR( ValueTooLarge );
* out = (kmp_uint64) -1;
return;
}; // if
* error = NULL;
* out = value;
} // __kmp_str_to_unit
示例12: KMP_DEBUG_ASSERT
// stop/save the current timer, and start the new timer (timer_pair)
// There is a special condition where if the current timer is equal to
// the one you are trying to push, then it only manipulates the stack,
// and it won't stop/start the currently running timer.
void partitionedTimers::push(timerPair timer_pair) {
// get the current timer
// stop current timer
// push new timer
// start the new timer
KMP_DEBUG_ASSERT(this->timer_stack.size() > 0);
timerPair current_timer = timer_stack.back();
timer_stack.push_back(timer_pair);
if (current_timer != timer_pair) {
timers[current_timer.get_index()]->pause();
timers[timer_pair.get_index()]->start(timer_pair.get_timer());
}
}
示例13: __kmp_str_buf_reserve
void
__kmp_str_buf_reserve(
kmp_str_buf_t * buffer,
int size
) {
KMP_STR_BUF_INVARIANT( buffer );
KMP_DEBUG_ASSERT( size >= 0 );
if ( buffer->size < size ) {
// Calculate buffer size.
do {
buffer->size *= 2;
} while ( buffer->size < size );
// Enlarge buffer.
if ( buffer->str == & buffer->bulk[ 0 ] ) {
buffer->str = (char *) KMP_INTERNAL_MALLOC( buffer->size );
if ( buffer->str == NULL ) {
KMP_FATAL( MemoryAllocFailed );
}; // if
memcpy( buffer->str, buffer->bulk, buffer->used + 1 );
} else {
buffer->str = (char *) KMP_INTERNAL_REALLOC( buffer->str, buffer->size );
if ( buffer->str == NULL ) {
KMP_FATAL( MemoryAllocFailed );
}; // if
}; // if
}; // if
KMP_DEBUG_ASSERT( buffer->size > 0 );
KMP_DEBUG_ASSERT( buffer->size >= size );
KMP_STR_BUF_INVARIANT( buffer );
} // __kmp_str_buf_reserve
示例14: __kmpc_cancel_barrier
/*!
@ingroup CANCELLATION
@param loc_ref location of the original task directive
@param gtid Global thread ID of encountering thread
@return returns true if a matching cancellation request has been flagged in the
RTL and the encountering thread has to cancel..
Barrier with cancellation point to send threads from the barrier to the
end of the parallel region. Needs a special code pattern as documented
in the design document for the cancellation feature.
*/
kmp_int32 __kmpc_cancel_barrier(ident_t *loc, kmp_int32 gtid) {
int ret = 0 /* false */;
kmp_info_t *this_thr = __kmp_threads[gtid];
kmp_team_t *this_team = this_thr->th.th_team;
KMP_DEBUG_ASSERT(__kmp_get_gtid() == gtid);
// call into the standard barrier
__kmpc_barrier(loc, gtid);
// if cancellation is active, check cancellation flag
if (__kmp_omp_cancellation) {
// depending on which construct to cancel, check the flag and
// reset the flag
switch (KMP_ATOMIC_LD_RLX(&(this_team->t.t_cancel_request))) {
case cancel_parallel:
ret = 1;
// ensure that threads have checked the flag, when
// leaving the above barrier
__kmpc_barrier(loc, gtid);
this_team->t.t_cancel_request = cancel_noreq;
// the next barrier is the fork/join barrier, which
// synchronizes the threads leaving here
break;
case cancel_loop:
case cancel_sections:
ret = 1;
// ensure that threads have checked the flag, when
// leaving the above barrier
__kmpc_barrier(loc, gtid);
this_team->t.t_cancel_request = cancel_noreq;
// synchronize the threads again to make sure we do not have any run-away
// threads that cause a race on the cancellation flag
__kmpc_barrier(loc, gtid);
break;
case cancel_taskgroup:
// this case should not occur
KMP_ASSERT(0 /* false */);
break;
case cancel_noreq:
// do nothing
break;
default:
KMP_ASSERT(0 /* false */);
}
}
return ret;
}
示例15: __kmp_push_parallel
void
__kmp_push_parallel( int gtid, ident_t const * ident )
{
int tos;
struct cons_header *p = __kmp_threads[ gtid ]->th.th_cons;
KMP_DEBUG_ASSERT( __kmp_threads[ gtid ]-> th.th_cons );
KE_TRACE( 10, ("__kmp_push_parallel (%d %d)\n", gtid, __kmp_get_gtid() ) );
KE_TRACE( 100, ( PUSH_MSG( ct_parallel, ident ) ) );
if ( p->stack_top >= p->stack_size ) {
__kmp_expand_cons_stack( gtid, p );
}; // if
tos = ++p->stack_top;
p->stack_data[ tos ].type = ct_parallel;
p->stack_data[ tos ].prev = p->p_top;
p->stack_data[ tos ].ident = ident;
p->stack_data[ tos ].name = NULL;
p->p_top = tos;
KE_DUMP( 1000, dump_cons_stack( gtid, p ) );
}