1
1

* rename all the atomic functions from ompi to opal

This commit was SVN r6325.
Этот коммит содержится в:
Brian Barrett 2005-07-03 21:38:51 +00:00
родитель 9f0c969bb4
Коммит 9da0b4fe1d
66 изменённых файлов: 780 добавлений и 780 удалений

Просмотреть файл

@ -48,7 +48,7 @@
*/ */
struct ompi_cb_fifo_ctl_t { struct ompi_cb_fifo_ctl_t {
/* spin-lock for access control */ /* spin-lock for access control */
ompi_lock_t lock; opal_atomic_lock_t lock;
/* current queue index */ /* current queue index */
volatile int fifo_index; volatile int fifo_index;
@ -172,7 +172,7 @@ static inline int ompi_cb_fifo_init(int size_of_fifo, int lazy_free_freq,
} }
/* initialize the head structure */ /* initialize the head structure */
ompi_atomic_unlock(&(fifo->head->lock)); opal_atomic_unlock(&(fifo->head->lock));
fifo->head->fifo_index=0; fifo->head->fifo_index=0;
fifo->head->num_to_clear=0; fifo->head->num_to_clear=0;
@ -184,7 +184,7 @@ static inline int ompi_cb_fifo_init(int size_of_fifo, int lazy_free_freq,
} }
/* initialize the head structure */ /* initialize the head structure */
ompi_atomic_unlock(&(fifo->tail->lock)); opal_atomic_unlock(&(fifo->tail->lock));
fifo->tail->fifo_index=0; fifo->tail->fifo_index=0;
fifo->tail->num_to_clear=0; fifo->tail->num_to_clear=0;
@ -501,7 +501,7 @@ static inline int ompi_cb_fifo_init_same_base_addr(int size_of_fifo,
} }
/* initialize the head structure */ /* initialize the head structure */
ompi_atomic_unlock(&(fifo->head->lock)); opal_atomic_unlock(&(fifo->head->lock));
fifo->head->fifo_index=0; fifo->head->fifo_index=0;
fifo->head->num_to_clear=0; fifo->head->num_to_clear=0;
@ -513,7 +513,7 @@ static inline int ompi_cb_fifo_init_same_base_addr(int size_of_fifo,
} }
/* initialize the head structure */ /* initialize the head structure */
ompi_atomic_unlock(&(fifo->tail->lock)); opal_atomic_unlock(&(fifo->tail->lock));
fifo->tail->fifo_index=0; fifo->tail->fifo_index=0;
fifo->tail->num_to_clear=0; fifo->tail->num_to_clear=0;

Просмотреть файл

@ -67,8 +67,8 @@ struct ompi_fifo_t {
volatile ompi_cb_fifo_wrapper_t *tail; volatile ompi_cb_fifo_wrapper_t *tail;
/* locks for thread synchronization */ /* locks for thread synchronization */
ompi_lock_t head_lock; opal_atomic_lock_t head_lock;
ompi_lock_t tail_lock; opal_atomic_lock_t tail_lock;
}; };

Просмотреть файл

@ -400,7 +400,7 @@ int mca_btl_sm_add_procs_same_base_addr(
/* memory barrier to ensure this flag is set before other /* memory barrier to ensure this flag is set before other
* flags are set */ * flags are set */
ompi_atomic_mb(); opal_atomic_mb();
} }
/* Note: Need to make sure that proc 0 initializes control /* Note: Need to make sure that proc 0 initializes control
@ -422,7 +422,7 @@ int mca_btl_sm_add_procs_same_base_addr(
mca_btl_sm_component.sm_mpool->mpool_base(mca_btl_sm_component.sm_mpool); mca_btl_sm_component.sm_mpool->mpool_base(mca_btl_sm_component.sm_mpool);
/* memory barrier to ensure this flag is set before other /* memory barrier to ensure this flag is set before other
* flags are set */ * flags are set */
ompi_atomic_mb(); opal_atomic_mb();
mca_btl_sm_component.sm_ctl_header->segment_header. mca_btl_sm_component.sm_ctl_header->segment_header.
base_shared_mem_flags[mca_btl_sm_component.my_smp_rank]=1; base_shared_mem_flags[mca_btl_sm_component.my_smp_rank]=1;
@ -445,8 +445,8 @@ int mca_btl_sm_add_procs_same_base_addr(
for( j=0 ; j < n_to_allocate ; j++ ) { for( j=0 ; j < n_to_allocate ; j++ ) {
my_fifos[j].head=OMPI_CB_FREE; my_fifos[j].head=OMPI_CB_FREE;
my_fifos[j].tail=OMPI_CB_FREE; my_fifos[j].tail=OMPI_CB_FREE;
ompi_atomic_unlock(&(my_fifos[j].head_lock)); opal_atomic_unlock(&(my_fifos[j].head_lock));
ompi_atomic_unlock(&(my_fifos[j].tail_lock)); opal_atomic_unlock(&(my_fifos[j].tail_lock));
} }
fifo_tmp=(ompi_fifo_t * volatile *) fifo_tmp=(ompi_fifo_t * volatile *)
( (char *)(mca_btl_sm_component.sm_ctl_header->fifo) + ( (char *)(mca_btl_sm_component.sm_ctl_header->fifo) +

Просмотреть файл

@ -347,7 +347,7 @@ int mca_btl_sm_component_progress(void)
/* aquire thread lock */ /* aquire thread lock */
if( ompi_using_threads() ) { if( ompi_using_threads() ) {
ompi_atomic_lock( &(fifo->tail_lock) ); opal_atomic_lock( &(fifo->tail_lock) );
} }
/* get pointer - pass in offset to change queue pointer /* get pointer - pass in offset to change queue pointer
@ -357,14 +357,14 @@ int mca_btl_sm_component_progress(void)
if( OMPI_CB_FREE == frag ) { if( OMPI_CB_FREE == frag ) {
/* release thread lock */ /* release thread lock */
if( ompi_using_threads() ) { if( ompi_using_threads() ) {
ompi_atomic_unlock(&(fifo->tail_lock)); opal_atomic_unlock(&(fifo->tail_lock));
} }
continue; continue;
} }
/* release thread lock */ /* release thread lock */
if( ompi_using_threads() ) { if( ompi_using_threads() ) {
ompi_atomic_unlock(&(fifo->tail_lock)); opal_atomic_unlock(&(fifo->tail_lock));
} }
/* dispatch fragment by type */ /* dispatch fragment by type */
@ -424,7 +424,7 @@ int mca_btl_sm_component_progress(void)
/* aquire thread lock */ /* aquire thread lock */
if( ompi_using_threads() ) { if( ompi_using_threads() ) {
ompi_atomic_lock(&(fifo->tail_lock)); opal_atomic_lock(&(fifo->tail_lock));
} }
/* get pointer - pass in offset to change queue pointer /* get pointer - pass in offset to change queue pointer
@ -434,14 +434,14 @@ int mca_btl_sm_component_progress(void)
if( OMPI_CB_FREE == frag ) { if( OMPI_CB_FREE == frag ) {
/* release thread lock */ /* release thread lock */
if( ompi_using_threads() ) { if( ompi_using_threads() ) {
ompi_atomic_unlock(&(fifo->tail_lock)); opal_atomic_unlock(&(fifo->tail_lock));
} }
continue; continue;
} }
/* release thread lock */ /* release thread lock */
if( ompi_using_threads() ) { if( ompi_using_threads() ) {
ompi_atomic_unlock(&(fifo->tail_lock)); opal_atomic_unlock(&(fifo->tail_lock));
} }
/* change the address from address relative to the shared /* change the address from address relative to the shared

Просмотреть файл

@ -12,7 +12,7 @@ do { \
\ \
/* thread lock */ \ /* thread lock */ \
if(ompi_using_threads()) \ if(ompi_using_threads()) \
ompi_atomic_lock(&fifo->head_lock); \ opal_atomic_lock(&fifo->head_lock); \
if(OMPI_CB_FREE == fifo->head) { \ if(OMPI_CB_FREE == fifo->head) { \
/* no queues have been allocated - allocate now */ \ /* no queues have been allocated - allocate now */ \
rc=ompi_fifo_init_same_base_addr( \ rc=ompi_fifo_init_same_base_addr( \
@ -24,7 +24,7 @@ do { \
fifo, mca_btl_sm_component.sm_mpool); \ fifo, mca_btl_sm_component.sm_mpool); \
if( rc != OMPI_SUCCESS ) { \ if( rc != OMPI_SUCCESS ) { \
if(ompi_using_threads()) \ if(ompi_using_threads()) \
ompi_atomic_unlock(&(fifo->head_lock)); \ opal_atomic_unlock(&(fifo->head_lock)); \
break; \ break; \
} \ } \
} \ } \
@ -37,7 +37,7 @@ do { \
rc=OMPI_SUCCESS; \ rc=OMPI_SUCCESS; \
} \ } \
if(ompi_using_threads()) \ if(ompi_using_threads()) \
ompi_atomic_unlock(&fifo->head_lock); \ opal_atomic_unlock(&fifo->head_lock); \
} while(0) } while(0)

Просмотреть файл

@ -184,7 +184,7 @@ mca_common_sm_mmap_t* mca_common_sm_mmap_init(size_t size, char *file_name,
/* initialize the segment - only the first process to open the file */ /* initialize the segment - only the first process to open the file */
if( !file_previously_opened ) { if( !file_previously_opened ) {
ompi_atomic_unlock(&seg->seg_lock); opal_atomic_unlock(&seg->seg_lock);
seg->seg_inited = false; seg->seg_inited = false;
seg->seg_offset = mem_offset; seg->seg_offset = mem_offset;
seg->seg_size = size; seg->seg_size = size;
@ -222,7 +222,7 @@ void* mca_common_sm_mmap_seg_alloc(
mca_common_sm_file_header_t* seg = map->map_seg; mca_common_sm_file_header_t* seg = map->map_seg;
void* addr; void* addr;
ompi_atomic_lock(&seg->seg_lock); opal_atomic_lock(&seg->seg_lock);
if(seg->seg_offset + *size > map->map_size) { if(seg->seg_offset + *size > map->map_size) {
addr = NULL; addr = NULL;
} else { } else {
@ -230,7 +230,7 @@ void* mca_common_sm_mmap_seg_alloc(
addr = map->data_addr + seg->seg_offset; addr = map->data_addr + seg->seg_offset;
seg->seg_offset += *size; seg->seg_offset += *size;
} }
ompi_atomic_unlock(&seg->seg_lock); opal_atomic_unlock(&seg->seg_lock);
return addr; return addr;
} }

Просмотреть файл

@ -33,7 +33,7 @@ struct mca_mpool_base_module_t;
struct mca_common_sm_file_header_t { struct mca_common_sm_file_header_t {
/* lock to control atomic access */ /* lock to control atomic access */
ompi_lock_t seg_lock; opal_atomic_lock_t seg_lock;
/* is the segment ready for use */ /* is the segment ready for use */
volatile bool seg_inited; volatile bool seg_inited;

Просмотреть файл

@ -182,7 +182,7 @@ static inline mca_pml_ob1_endpoint_t* mca_pml_ob1_ep_array_find(
do { \ do { \
if(NULL != (descriptor = endpoint->btl_cache)) { \ if(NULL != (descriptor = endpoint->btl_cache)) { \
/* atomically acquire the cached descriptor */ \ /* atomically acquire the cached descriptor */ \
if(ompi_atomic_cmpset_ptr(&endpoint->btl_cache, descriptor, NULL) == 0) { \ if(opal_atomic_cmpset_ptr(&endpoint->btl_cache, descriptor, NULL) == 0) { \
endpoint->btl_cache = NULL; \ endpoint->btl_cache = NULL; \
} else { \ } else { \
descriptor = endpoint->btl_alloc(endpoint->btl, sizeof(mca_pml_ob1_hdr_t) + \ descriptor = endpoint->btl_alloc(endpoint->btl, sizeof(mca_pml_ob1_hdr_t) + \
@ -215,7 +215,7 @@ do {
#define MCA_PML_OB1_ENDPOINT_DES_RETURN(endpoint, descriptor) \ #define MCA_PML_OB1_ENDPOINT_DES_RETURN(endpoint, descriptor) \
do { \ do { \
if(NULL == endpoint->btl_cache) { \ if(NULL == endpoint->btl_cache) { \
if(ompi_atomic_cmpset_ptr(&endpoint->btl_cache,NULL,descriptor) == 0) { \ if(opal_atomic_cmpset_ptr(&endpoint->btl_cache,NULL,descriptor) == 0) { \
endpoint->btl_free(endpoint->btl,descriptor); \ endpoint->btl_free(endpoint->btl,descriptor); \
} \ } \
} else { \ } else { \

Просмотреть файл

@ -441,7 +441,7 @@ mca_ptl_elan_matched (mca_ptl_base_module_t * ptl,
} }
} }
set = ompi_atomic_fetch_and_set_int ( set = opal_atomic_fetch_and_set_int (
&((mca_ptl_elan_recv_frag_t *)frag)->frag_progressed, 1); &((mca_ptl_elan_recv_frag_t *)frag)->frag_progressed, 1);
if (!set) { if (!set) {
/* IN TCP case, IO_VEC is first allocated. /* IN TCP case, IO_VEC is first allocated.

Просмотреть файл

@ -172,7 +172,7 @@ mca_ptl_elan_send_desc_done (
#if OMPI_PTL_ELAN_ENABLE_GET #if OMPI_PTL_ELAN_ENABLE_GET
if (frag->desc->desc_type == MCA_PTL_ELAN_DESC_GET) { if (frag->desc->desc_type == MCA_PTL_ELAN_DESC_GET) {
if(ompi_atomic_fetch_and_set_int (&frag->frag_progressed, 1) == 0) { if(opal_atomic_fetch_and_set_int (&frag->frag_progressed, 1) == 0) {
ptl->super.ptl_recv_progress(ptl, ptl->super.ptl_recv_progress(ptl,
(mca_pml_base_recv_request_t *) req, (mca_pml_base_recv_request_t *) req,
frag->frag_base.frag_size, frag->frag_base.frag_size,
@ -198,7 +198,7 @@ mca_ptl_elan_send_desc_done (
(opal_list_item_t *) frag); (opal_list_item_t *) frag);
} else if (0 == (header->hdr_common.hdr_flags & MCA_PTL_FLAGS_ACK) } else if (0 == (header->hdr_common.hdr_flags & MCA_PTL_FLAGS_ACK)
|| mca_pml_base_send_request_matched(req)) { || mca_pml_base_send_request_matched(req)) {
if(ompi_atomic_fetch_and_set_int (&frag->frag_progressed, 1) == 0) if(opal_atomic_fetch_and_set_int (&frag->frag_progressed, 1) == 0)
{ {
ptl->super.ptl_send_progress( ptl->super.ptl_send_progress(
(struct mca_ptl_base_module_t*) ptl, (struct mca_ptl_base_module_t*) ptl,

Просмотреть файл

@ -158,7 +158,7 @@ mca_ptl_elan_last_frag_ack (struct mca_ptl_elan_module_t *ptl,
req->req_peer_addr.pval, req->req_peer_addr.pval,
req->req_peer_size); req->req_peer_size);
if(ompi_atomic_fetch_and_set_int (&desc->frag_progressed, 1) == 0) { if(opal_atomic_fetch_and_set_int (&desc->frag_progressed, 1) == 0) {
ptl->super.ptl_send_progress( ptl->super.ptl_send_progress(
(struct mca_ptl_base_module_t*) ptl, (struct mca_ptl_base_module_t*) ptl,
req, header->hdr_ack.hdr_dst_size); req, header->hdr_ack.hdr_dst_size);

Просмотреть файл

@ -322,7 +322,7 @@ static void mca_ptl_gm_basic_ack_callback( struct gm_port* port, void* context,
OMPI_GM_FREE_LIST_RETURN( &(gm_ptl->gm_send_dma_frags), ((opal_list_item_t*)header) ); OMPI_GM_FREE_LIST_RETURN( &(gm_ptl->gm_send_dma_frags), ((opal_list_item_t*)header) );
/* release the send token */ /* release the send token */
ompi_atomic_add( &(gm_ptl->num_send_tokens), 1 ); opal_atomic_add( &(gm_ptl->num_send_tokens), 1 );
} }
/* A posted receive has been matched - if required send an /* A posted receive has been matched - if required send an
@ -355,7 +355,7 @@ mca_ptl_gm_matched( mca_ptl_base_module_t* ptl,
opal_list_append (&mca_ptl_gm_module.gm_pending_acks, (opal_list_item_t *)frag); opal_list_append (&mca_ptl_gm_module.gm_pending_acks, (opal_list_item_t *)frag);
OMPI_THREAD_UNLOCK (&mca_ptl_gm_component.gm_lock); OMPI_THREAD_UNLOCK (&mca_ptl_gm_component.gm_lock);
} else { } else {
ompi_atomic_sub( &(gm_ptl->num_send_tokens), 1 ); opal_atomic_sub( &(gm_ptl->num_send_tokens), 1 );
assert( gm_ptl->num_send_tokens >= 0 ); assert( gm_ptl->num_send_tokens >= 0 );
hdr = (mca_ptl_base_header_t*)item; hdr = (mca_ptl_base_header_t*)item;

Просмотреть файл

@ -47,7 +47,7 @@ static void mca_ptl_gm_basic_frag_callback( struct gm_port* port, void* context,
case GM_SUCCESS: case GM_SUCCESS:
OMPI_GM_FREE_LIST_RETURN( &(gm_ptl->gm_send_dma_frags), ((opal_list_item_t*)header) ); OMPI_GM_FREE_LIST_RETURN( &(gm_ptl->gm_send_dma_frags), ((opal_list_item_t*)header) );
/* release the send token */ /* release the send token */
ompi_atomic_add( &(gm_ptl->num_send_tokens), 1 ); opal_atomic_add( &(gm_ptl->num_send_tokens), 1 );
break; break;
case GM_SEND_TIMED_OUT: case GM_SEND_TIMED_OUT:
ompi_output( 0, "send_continue timed out\n" ); ompi_output( 0, "send_continue timed out\n" );
@ -196,7 +196,7 @@ int mca_ptl_gm_sender_advance_pipeline( mca_ptl_gm_send_frag_t* frag )
int32_t rc; int32_t rc;
OMPI_FREE_LIST_WAIT( &(peer->peer_ptl->gm_send_dma_frags), item, rc ); OMPI_FREE_LIST_WAIT( &(peer->peer_ptl->gm_send_dma_frags), item, rc );
ompi_atomic_sub( &(peer->peer_ptl->num_send_tokens), 1 ); opal_atomic_sub( &(peer->peer_ptl->num_send_tokens), 1 );
hdr = (mca_ptl_gm_frag_header_t*)item; hdr = (mca_ptl_gm_frag_header_t*)item;
hdr->hdr_frag.hdr_common.hdr_type = MCA_PTL_HDR_TYPE_FRAG; hdr->hdr_frag.hdr_common.hdr_type = MCA_PTL_HDR_TYPE_FRAG;
@ -334,7 +334,7 @@ int mca_ptl_gm_send_burst_data( mca_ptl_gm_peer_t *ptl_peer,
if( NULL == hdr ) { if( NULL == hdr ) {
opal_list_item_t* item; opal_list_item_t* item;
OMPI_FREE_LIST_WAIT( &(ptl_peer->peer_ptl->gm_send_dma_frags), item, rc ); OMPI_FREE_LIST_WAIT( &(ptl_peer->peer_ptl->gm_send_dma_frags), item, rc );
ompi_atomic_sub( &(ptl_peer->peer_ptl->num_send_tokens), 1 ); opal_atomic_sub( &(ptl_peer->peer_ptl->num_send_tokens), 1 );
hdr = (mca_ptl_base_frag_header_t*)item; hdr = (mca_ptl_base_frag_header_t*)item;
} }
iov.iov_base = (char*)hdr + sizeof(mca_ptl_base_frag_header_t); iov.iov_base = (char*)hdr + sizeof(mca_ptl_base_frag_header_t);
@ -439,7 +439,7 @@ int mca_ptl_gm_peer_send_continue( mca_ptl_gm_peer_t *ptl_peer,
} }
if( NULL == item ) { if( NULL == item ) {
OMPI_FREE_LIST_WAIT( &(ptl_peer->peer_ptl->gm_send_dma_frags), item, rc ); OMPI_FREE_LIST_WAIT( &(ptl_peer->peer_ptl->gm_send_dma_frags), item, rc );
ompi_atomic_sub( &(ptl_peer->peer_ptl->num_send_tokens), 1 ); opal_atomic_sub( &(ptl_peer->peer_ptl->num_send_tokens), 1 );
hdr = (mca_ptl_gm_frag_header_t*)item; hdr = (mca_ptl_gm_frag_header_t*)item;
} }
@ -496,7 +496,7 @@ static void send_match_callback( struct gm_port* port, void* context, gm_status_
OMPI_GM_FREE_LIST_RETURN( &(gm_ptl->gm_send_dma_frags), ((opal_list_item_t*)header) ); OMPI_GM_FREE_LIST_RETURN( &(gm_ptl->gm_send_dma_frags), ((opal_list_item_t*)header) );
/* release the send token */ /* release the send token */
ompi_atomic_add( &(gm_ptl->num_send_tokens), 1 ); opal_atomic_add( &(gm_ptl->num_send_tokens), 1 );
} }
/* This function is used for the initial send. For small size messages the data will be attached /* This function is used for the initial send. For small size messages the data will be attached
@ -523,7 +523,7 @@ int mca_ptl_gm_peer_send( struct mca_ptl_base_module_t* ptl,
char* sendbuf; char* sendbuf;
OMPI_FREE_LIST_WAIT( &(ptl_gm->gm_send_dma_frags), item, rc ); OMPI_FREE_LIST_WAIT( &(ptl_gm->gm_send_dma_frags), item, rc );
ompi_atomic_sub( &(ptl_gm->num_send_tokens), 1 ); opal_atomic_sub( &(ptl_gm->num_send_tokens), 1 );
sendbuf = (char*)item; sendbuf = (char*)item;
hdr = (mca_ptl_base_header_t*)item; hdr = (mca_ptl_base_header_t*)item;
@ -657,7 +657,7 @@ static void recv_short_callback( struct gm_port* port, void* context, gm_status_
OMPI_GM_FREE_LIST_RETURN( &(gm_ptl->gm_send_dma_frags), ((opal_list_item_t*)header) ); OMPI_GM_FREE_LIST_RETURN( &(gm_ptl->gm_send_dma_frags), ((opal_list_item_t*)header) );
/* release the send token */ /* release the send token */
ompi_atomic_add( &(gm_ptl->num_send_tokens), 1 ); opal_atomic_add( &(gm_ptl->num_send_tokens), 1 );
} }
static int mca_ptl_gm_send_quick_fin_message( struct mca_ptl_gm_peer_t* ptl_peer, static int mca_ptl_gm_send_quick_fin_message( struct mca_ptl_gm_peer_t* ptl_peer,
@ -668,7 +668,7 @@ static int mca_ptl_gm_send_quick_fin_message( struct mca_ptl_gm_peer_t* ptl_peer
int rc; int rc;
OMPI_FREE_LIST_WAIT( &(ptl_peer->peer_ptl->gm_send_dma_frags), item, rc ); OMPI_FREE_LIST_WAIT( &(ptl_peer->peer_ptl->gm_send_dma_frags), item, rc );
ompi_atomic_sub( &(ptl_peer->peer_ptl->num_send_tokens), 1 ); opal_atomic_sub( &(ptl_peer->peer_ptl->num_send_tokens), 1 );
hdr = (mca_ptl_base_header_t*)item; hdr = (mca_ptl_base_header_t*)item;
hdr->hdr_common.hdr_type = MCA_PTL_HDR_TYPE_FIN; hdr->hdr_common.hdr_type = MCA_PTL_HDR_TYPE_FIN;

Просмотреть файл

@ -57,7 +57,7 @@ mca_ptl_gm_alloc_send_frag( struct mca_ptl_gm_module_t* ptl,
frag = (mca_ptl_gm_send_frag_t*)item; frag = (mca_ptl_gm_send_frag_t*)item;
/* And then get some DMA memory to put the data */ /* And then get some DMA memory to put the data */
OMPI_FREE_LIST_WAIT( &(ptl->gm_send_dma_frags), item, rc ); OMPI_FREE_LIST_WAIT( &(ptl->gm_send_dma_frags), item, rc );
ompi_atomic_sub( &(ptl->num_send_tokens), 1 ); opal_atomic_sub( &(ptl->num_send_tokens), 1 );
assert( ptl->num_send_tokens >= 0 ); assert( ptl->num_send_tokens >= 0 );
frag->send_buf = (void*)item; frag->send_buf = (void*)item;

Просмотреть файл

@ -103,7 +103,7 @@ do { \
*/ \ */ \
frag_ack = (frag->frag_send.frag_base.frag_header. \ frag_ack = (frag->frag_send.frag_base.frag_header. \
hdr_common.hdr_flags & MCA_PTL_FLAGS_ACK) ? true : false; \ hdr_common.hdr_flags & MCA_PTL_FLAGS_ACK) ? true : false; \
if(frag_ack == false || ompi_atomic_add_32(&frag->frag_progress,1) == 2) { \ if(frag_ack == false || opal_atomic_add_32(&frag->frag_progress,1) == 2) { \
\ \
/* update request status */ \ /* update request status */ \
frag->frag_send.frag_base.frag_owner->ptl_send_progress( \ frag->frag_send.frag_base.frag_owner->ptl_send_progress( \

Просмотреть файл

@ -409,7 +409,7 @@ int mca_ptl_sm_add_procs_same_base_addr(
/* memory barrier to ensure this flag is set before other /* memory barrier to ensure this flag is set before other
* flags are set */ * flags are set */
ompi_atomic_mb(); opal_atomic_mb();
} }
/* Note: Need to make sure that proc 0 initializes control /* Note: Need to make sure that proc 0 initializes control
@ -431,7 +431,7 @@ int mca_ptl_sm_add_procs_same_base_addr(
mca_ptl_sm_component.sm_mpool->mpool_base(mca_ptl_sm_component.sm_mpool); mca_ptl_sm_component.sm_mpool->mpool_base(mca_ptl_sm_component.sm_mpool);
/* memory barrier to ensure this flag is set before other /* memory barrier to ensure this flag is set before other
* flags are set */ * flags are set */
ompi_atomic_mb(); opal_atomic_mb();
mca_ptl_sm_component.sm_ctl_header->segment_header. mca_ptl_sm_component.sm_ctl_header->segment_header.
base_shared_mem_flags[mca_ptl_sm_component.my_smp_rank]=1; base_shared_mem_flags[mca_ptl_sm_component.my_smp_rank]=1;
@ -455,8 +455,8 @@ int mca_ptl_sm_add_procs_same_base_addr(
for( j=0 ; j < n_to_allocate ; j++ ) { for( j=0 ; j < n_to_allocate ; j++ ) {
my_fifos[j].head=OMPI_CB_FREE; my_fifos[j].head=OMPI_CB_FREE;
my_fifos[j].tail=OMPI_CB_FREE; my_fifos[j].tail=OMPI_CB_FREE;
ompi_atomic_unlock(&(my_fifos[j].head_lock)); opal_atomic_unlock(&(my_fifos[j].head_lock));
ompi_atomic_unlock(&(my_fifos[j].tail_lock)); opal_atomic_unlock(&(my_fifos[j].tail_lock));
} }
fifo_tmp=(ompi_fifo_t * volatile *) fifo_tmp=(ompi_fifo_t * volatile *)
( (char *)(mca_ptl_sm_component.sm_ctl_header->fifo) + ( (char *)(mca_ptl_sm_component.sm_ctl_header->fifo) +
@ -851,7 +851,7 @@ int mca_ptl_sm_send(
/* thread lock */ /* thread lock */
if(ompi_using_threads()) if(ompi_using_threads())
ompi_atomic_lock(&send_fifo->head_lock); opal_atomic_lock(&send_fifo->head_lock);
if(OMPI_CB_FREE == send_fifo->head) { if(OMPI_CB_FREE == send_fifo->head) {
/* no queues have been allocated - allocate now */ /* no queues have been allocated - allocate now */
return_status=ompi_fifo_init_same_base_addr( return_status=ompi_fifo_init_same_base_addr(
@ -863,7 +863,7 @@ int mca_ptl_sm_send(
send_fifo, mca_ptl_sm_component.sm_mpool); send_fifo, mca_ptl_sm_component.sm_mpool);
if( return_status != OMPI_SUCCESS ) { if( return_status != OMPI_SUCCESS ) {
if(ompi_using_threads()) if(ompi_using_threads())
ompi_atomic_unlock(&(send_fifo->head_lock)); opal_atomic_unlock(&(send_fifo->head_lock));
return return_status; return return_status;
} }
} }
@ -876,7 +876,7 @@ int mca_ptl_sm_send(
return_status=OMPI_SUCCESS; return_status=OMPI_SUCCESS;
} }
if(ompi_using_threads()) if(ompi_using_threads())
ompi_atomic_unlock(&send_fifo->head_lock); opal_atomic_unlock(&send_fifo->head_lock);
/* if this is the entire message - signal request is complete */ /* if this is the entire message - signal request is complete */
if(sendreq->req_send.req_bytes_packed == size && if(sendreq->req_send.req_bytes_packed == size &&
@ -985,7 +985,7 @@ int mca_ptl_sm_send_continue(
* we need shared memory access to these lock, and in some pthread * we need shared memory access to these lock, and in some pthread
* implementation, such mutex's don't work correctly */ * implementation, such mutex's don't work correctly */
if(ompi_using_threads()) if(ompi_using_threads())
ompi_atomic_lock(&send_fifo->head_lock); opal_atomic_lock(&send_fifo->head_lock);
/* post descriptor */ /* post descriptor */
return_status=ompi_fifo_write_to_head_same_base_addr(send_frag, return_status=ompi_fifo_write_to_head_same_base_addr(send_frag,
@ -997,6 +997,6 @@ int mca_ptl_sm_send_continue(
/* release thread lock */ /* release thread lock */
if(ompi_using_threads()) if(ompi_using_threads())
ompi_atomic_unlock(&send_fifo->head_lock); opal_atomic_unlock(&send_fifo->head_lock);
return return_status; return return_status;
} }

Просмотреть файл

@ -394,7 +394,7 @@ int mca_ptl_sm_component_progress(mca_ptl_tstamp_t tstamp)
/* aquire thread lock */ /* aquire thread lock */
if( ompi_using_threads() ) { if( ompi_using_threads() ) {
ompi_atomic_lock( &(send_fifo->tail_lock) ); opal_atomic_lock( &(send_fifo->tail_lock) );
} }
/* get pointer - pass in offset to change queue pointer /* get pointer - pass in offset to change queue pointer
@ -404,14 +404,14 @@ int mca_ptl_sm_component_progress(mca_ptl_tstamp_t tstamp)
if( OMPI_CB_FREE == header_ptr ) { if( OMPI_CB_FREE == header_ptr ) {
/* release thread lock */ /* release thread lock */
if( ompi_using_threads() ) { if( ompi_using_threads() ) {
ompi_atomic_unlock(&(send_fifo->tail_lock)); opal_atomic_unlock(&(send_fifo->tail_lock));
} }
continue; continue;
} }
/* release thread lock */ /* release thread lock */
if( ompi_using_threads() ) { if( ompi_using_threads() ) {
ompi_atomic_unlock(&(send_fifo->tail_lock)); opal_atomic_unlock(&(send_fifo->tail_lock));
} }
/* figure out what type of message this is */ /* figure out what type of message this is */
@ -490,7 +490,7 @@ int mca_ptl_sm_component_progress(mca_ptl_tstamp_t tstamp)
/* aquire thread lock */ /* aquire thread lock */
if( ompi_using_threads() ) { if( ompi_using_threads() ) {
ompi_atomic_lock(&(send_fifo->tail_lock)); opal_atomic_lock(&(send_fifo->tail_lock));
} }
/* get pointer - pass in offset to change queue pointer /* get pointer - pass in offset to change queue pointer
@ -500,14 +500,14 @@ int mca_ptl_sm_component_progress(mca_ptl_tstamp_t tstamp)
if( OMPI_CB_FREE == header_ptr ) { if( OMPI_CB_FREE == header_ptr ) {
/* release thread lock */ /* release thread lock */
if( ompi_using_threads() ) { if( ompi_using_threads() ) {
ompi_atomic_unlock(&(send_fifo->tail_lock)); opal_atomic_unlock(&(send_fifo->tail_lock));
} }
continue; continue;
} }
/* release thread lock */ /* release thread lock */
if( ompi_using_threads() ) { if( ompi_using_threads() ) {
ompi_atomic_unlock(&(send_fifo->tail_lock)); opal_atomic_unlock(&(send_fifo->tail_lock));
} }
/* change the address from address relative to the shared /* change the address from address relative to the shared

Просмотреть файл

@ -122,7 +122,7 @@ void mca_ptl_sm_matched(
/* lock as multiple processes can attempt to init the head */ /* lock as multiple processes can attempt to init the head */
if(ompi_using_threads()) if(ompi_using_threads())
ompi_atomic_lock(&send_fifo->head_lock); opal_atomic_lock(&send_fifo->head_lock);
/* check to see if fifo is allocated */ /* check to see if fifo is allocated */
if(OMPI_CB_FREE == send_fifo->head) { if(OMPI_CB_FREE == send_fifo->head) {
@ -136,7 +136,7 @@ void mca_ptl_sm_matched(
send_fifo, mca_ptl_sm_component.sm_mpool); send_fifo, mca_ptl_sm_component.sm_mpool);
if( return_status != OMPI_SUCCESS ) { if( return_status != OMPI_SUCCESS ) {
if(ompi_using_threads()) if(ompi_using_threads())
ompi_atomic_unlock(&send_fifo->head_lock); opal_atomic_unlock(&send_fifo->head_lock);
return; return;
} }
} }
@ -152,7 +152,7 @@ void mca_ptl_sm_matched(
send_fifo, mca_ptl_sm_component.sm_mpool); send_fifo, mca_ptl_sm_component.sm_mpool);
if(ompi_using_threads()) if(ompi_using_threads())
ompi_atomic_unlock(&send_fifo->head_lock); opal_atomic_unlock(&send_fifo->head_lock);
/* if can't ack, put on list for later delivery */ /* if can't ack, put on list for later delivery */
if( 0 > return_status ) { if( 0 > return_status ) {

Просмотреть файл

@ -131,7 +131,7 @@ static inline void mca_ptl_tcp_recv_frag_progress(mca_ptl_tcp_recv_frag_t* frag)
uint32_t iov_count; uint32_t iov_count;
size_t max_data; size_t max_data;
int32_t freeAfter; int32_t freeAfter;
int32_t frag_progressed = ompi_atomic_add_32(&frag->frag_progressed,1); int32_t frag_progressed = opal_atomic_add_32(&frag->frag_progressed,1);
/* For a match/rendezvous packet - we need to progress the fragment after /* For a match/rendezvous packet - we need to progress the fragment after
* the match has been made and all data has arrived. So this routine is * the match has been made and all data has arrived. So this routine is

Просмотреть файл

@ -107,7 +107,7 @@ static inline void mca_ptl_tcp_send_frag_progress(mca_ptl_tcp_send_frag_t* frag)
*/ */
frag_ack = (frag->frag_send.frag_base.frag_header. frag_ack = (frag->frag_send.frag_base.frag_header.
hdr_common.hdr_flags & MCA_PTL_FLAGS_ACK) ? true : false; hdr_common.hdr_flags & MCA_PTL_FLAGS_ACK) ? true : false;
if(frag_ack == false || ompi_atomic_add_32(&frag->frag_progressed,1) == 2) { if(frag_ack == false || opal_atomic_add_32(&frag->frag_progressed,1) == 2) {
/* update request status */ /* update request status */
frag->frag_send.frag_base.frag_owner->ptl_send_progress( frag->frag_send.frag_base.frag_owner->ptl_send_progress(

Просмотреть файл

@ -46,7 +46,7 @@ int MPI_Request_get_status(MPI_Request request, int *flag,
} }
} }
ompi_atomic_mb(); opal_atomic_mb();
if( (request == MPI_REQUEST_NULL) || (request->req_state == OMPI_REQUEST_INACTIVE) ) { if( (request == MPI_REQUEST_NULL) || (request->req_state == OMPI_REQUEST_INACTIVE) ) {
*flag = true; *flag = true;
if( MPI_STATUS_IGNORE != status ) { if( MPI_STATUS_IGNORE != status ) {

Просмотреть файл

@ -32,7 +32,7 @@ int ompi_request_test_any(
ompi_request_t **rptr; ompi_request_t **rptr;
ompi_request_t *request; ompi_request_t *request;
ompi_atomic_mb(); opal_atomic_mb();
rptr = requests; rptr = requests;
for (i = 0; i < count; i++, rptr++) { for (i = 0; i < count; i++, rptr++) {
request = *rptr; request = *rptr;
@ -79,7 +79,7 @@ int ompi_request_test_all(
size_t num_completed = 0; size_t num_completed = 0;
ompi_request_t *request; ompi_request_t *request;
ompi_atomic_mb(); opal_atomic_mb();
rptr = requests; rptr = requests;
for (i = 0; i < count; i++, rptr++) { for (i = 0; i < count; i++, rptr++) {
request = *rptr; request = *rptr;

Просмотреть файл

@ -36,7 +36,7 @@ int ompi_request_wait_any(
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
/* poll for completion */ /* poll for completion */
ompi_atomic_mb(); opal_atomic_mb();
for (c = 0; completed < 0 && c < ompi_request_poll_iterations; c++) { for (c = 0; completed < 0 && c < ompi_request_poll_iterations; c++) {
rptr = requests; rptr = requests;
num_requests_null_inactive = 0; num_requests_null_inactive = 0;

Просмотреть файл

@ -208,7 +208,7 @@ static inline int ompi_request_test(
ompi_status_public_t * status) ompi_status_public_t * status)
{ {
ompi_request_t *request = *rptr; ompi_request_t *request = *rptr;
ompi_atomic_mb(); opal_atomic_mb();
if (request == MPI_REQUEST_NULL || if (request == MPI_REQUEST_NULL ||
request->req_state == OMPI_REQUEST_INACTIVE) { request->req_state == OMPI_REQUEST_INACTIVE) {
*completed = true; *completed = true;

Просмотреть файл

@ -29,15 +29,15 @@
(LOCKS_TABLE_SIZE - 1)])) (LOCKS_TABLE_SIZE - 1)]))
/* have to fix if you change LOCKS_TABLE_SIZE */ /* have to fix if you change LOCKS_TABLE_SIZE */
static ompi_lock_t locks_table[LOCKS_TABLE_SIZE] = { static opal_atomic_lock_t locks_table[LOCKS_TABLE_SIZE] = {
{ { OMPI_ATOMIC_UNLOCKED } }, { { OPAL_ATOMIC_UNLOCKED } },
{ { OMPI_ATOMIC_UNLOCKED } }, { { OPAL_ATOMIC_UNLOCKED } },
{ { OMPI_ATOMIC_UNLOCKED } }, { { OPAL_ATOMIC_UNLOCKED } },
{ { OMPI_ATOMIC_UNLOCKED } }, { { OPAL_ATOMIC_UNLOCKED } },
{ { OMPI_ATOMIC_UNLOCKED } }, { { OPAL_ATOMIC_UNLOCKED } },
{ { OMPI_ATOMIC_UNLOCKED } }, { { OPAL_ATOMIC_UNLOCKED } },
{ { OMPI_ATOMIC_UNLOCKED } }, { { OPAL_ATOMIC_UNLOCKED } },
{ { OMPI_ATOMIC_UNLOCKED } } { { OPAL_ATOMIC_UNLOCKED } }
}; };
# else /* OMPI_WANT_SMP_LOCKS */ # else /* OMPI_WANT_SMP_LOCKS */
@ -45,36 +45,36 @@ static ompi_lock_t locks_table[LOCKS_TABLE_SIZE] = {
#define LOCKS_TABLE_SIZE 1 #define LOCKS_TABLE_SIZE 1
#define FIND_LOCK(addr) (&(locks_table[0])) #define FIND_LOCK(addr) (&(locks_table[0]))
static ompi_lock_t locks_table[1] = { OMPI_ATOMIC_UNLOCKED }; static opal_atomic_lock_t locks_table[1] = { OPAL_ATOMIC_UNLOCKED };
#endif /* OMPI_WANT_SMP_LOCKS */ #endif /* OMPI_WANT_SMP_LOCKS */
int32_t int32_t
ompi_atomic_add_32(volatile int32_t *addr, int delta) opal_atomic_add_32(volatile int32_t *addr, int delta)
{ {
int32_t ret; int32_t ret;
ompi_atomic_lock(FIND_LOCK(addr)); opal_atomic_lock(FIND_LOCK(addr));
ret = (*addr += delta); ret = (*addr += delta);
ompi_atomic_unlock(FIND_LOCK(addr)); opal_atomic_unlock(FIND_LOCK(addr));
return ret; return ret;
} }
int32_t int32_t
ompi_atomic_sub_32(volatile int32_t *addr, int delta) opal_atomic_sub_32(volatile int32_t *addr, int delta)
{ {
int32_t ret; int32_t ret;
ompi_atomic_lock(FIND_LOCK(addr)); opal_atomic_lock(FIND_LOCK(addr));
ret = (*addr -= delta); ret = (*addr -= delta);
ompi_atomic_unlock(FIND_LOCK(addr)); opal_atomic_unlock(FIND_LOCK(addr));
return ret; return ret;
} }

Просмотреть файл

@ -1,31 +1,31 @@
START_FILE START_FILE
TEXT TEXT
START_FUNC(ompi_atomic_mb) START_FUNC(opal_atomic_mb)
pushq %rbp pushq %rbp
movq %rsp, %rbp movq %rsp, %rbp
leave leave
ret ret
END_FUNC(ompi_atomic_mb) END_FUNC(opal_atomic_mb)
START_FUNC(ompi_atomic_rmb) START_FUNC(opal_atomic_rmb)
pushq %rbp pushq %rbp
movq %rsp, %rbp movq %rsp, %rbp
leave leave
ret ret
END_FUNC(ompi_atomic_rmb) END_FUNC(opal_atomic_rmb)
START_FUNC(ompi_atomic_wmb) START_FUNC(opal_atomic_wmb)
pushq %rbp pushq %rbp
movq %rsp, %rbp movq %rsp, %rbp
leave leave
ret ret
END_FUNC(ompi_atomic_wmb) END_FUNC(opal_atomic_wmb)
START_FUNC(ompi_atomic_cmpset_32) START_FUNC(opal_atomic_cmpset_32)
pushq %rbp pushq %rbp
movq %rsp, %rbp movq %rsp, %rbp
movq %rdi, -8(%rbp) movq %rdi, -8(%rbp)
@ -48,10 +48,10 @@ START_FUNC(ompi_atomic_cmpset_32)
movl -28(%rbp), %eax movl -28(%rbp), %eax
leave leave
ret ret
END_FUNC(ompi_atomic_cmpset_32) END_FUNC(opal_atomic_cmpset_32)
START_FUNC(ompi_atomic_cmpset_64) START_FUNC(opal_atomic_cmpset_64)
pushq %rbp pushq %rbp
movq %rsp, %rbp movq %rsp, %rbp
movq %rdi, -8(%rbp) movq %rdi, -8(%rbp)
@ -71,4 +71,4 @@ START_FUNC(ompi_atomic_cmpset_64)
movzbl %al, %eax movzbl %al, %eax
leave leave
ret ret
END_FUNC(ompi_atomic_cmpset_64) END_FUNC(opal_atomic_cmpset_64)

Просмотреть файл

@ -1,31 +1,31 @@
START_FILE START_FILE
TEXT TEXT
START_FUNC(ompi_atomic_mb) START_FUNC(opal_atomic_mb)
pushl %ebp pushl %ebp
movl %esp, %ebp movl %esp, %ebp
leave leave
ret ret
END_FUNC(ompi_atomic_mb) END_FUNC(opal_atomic_mb)
START_FUNC(ompi_atomic_rmb) START_FUNC(opal_atomic_rmb)
pushl %ebp pushl %ebp
movl %esp, %ebp movl %esp, %ebp
leave leave
ret ret
END_FUNC(ompi_atomic_rmb) END_FUNC(opal_atomic_rmb)
START_FUNC(ompi_atomic_wmb) START_FUNC(opal_atomic_wmb)
pushl %ebp pushl %ebp
movl %esp, %ebp movl %esp, %ebp
leave leave
ret ret
END_FUNC(ompi_atomic_wmb) END_FUNC(opal_atomic_wmb)
START_FUNC(ompi_atomic_cmpset_32) START_FUNC(opal_atomic_cmpset_32)
pushl %ebp pushl %ebp
movl %esp, %ebp movl %esp, %ebp
movl 8(%ebp), %edx movl 8(%ebp), %edx
@ -39,10 +39,10 @@ START_FUNC(ompi_atomic_cmpset_32)
movzbl %dl, %eax movzbl %dl, %eax
leave leave
ret ret
END_FUNC(ompi_atomic_cmpset_32) END_FUNC(opal_atomic_cmpset_32)
START_FUNC(ompi_atomic_cmpset_64) START_FUNC(opal_atomic_cmpset_64)
pushl %ebp pushl %ebp
movl %esp, %ebp movl %esp, %ebp
subl $32, %esp subl $32, %esp
@ -78,10 +78,10 @@ START_FUNC(ompi_atomic_cmpset_64)
movl %ebp, %esp movl %ebp, %esp
popl %ebp popl %ebp
ret ret
END_FUNC(ompi_atomic_cmpset_64) END_FUNC(opal_atomic_cmpset_64)
START_FUNC(ompi_atomic_add_32) START_FUNC(opal_atomic_add_32)
pushl %ebp pushl %ebp
movl %esp, %ebp movl %esp, %ebp
movl 8(%ebp), %eax movl 8(%ebp), %eax
@ -92,10 +92,10 @@ START_FUNC(ompi_atomic_add_32)
movl (%eax), %eax movl (%eax), %eax
leave leave
ret ret
END_FUNC(ompi_atomic_add_32) END_FUNC(opal_atomic_add_32)
START_FUNC(ompi_atomic_sub_32) START_FUNC(opal_atomic_sub_32)
pushl %ebp pushl %ebp
movl %esp, %ebp movl %esp, %ebp
movl 8(%ebp), %eax movl 8(%ebp), %eax
@ -106,4 +106,4 @@ START_FUNC(ompi_atomic_sub_32)
movl (%eax), %eax movl (%eax), %eax
leave leave
ret ret
END_FUNC(ompi_atomic_sub_32) END_FUNC(opal_atomic_sub_32)

Просмотреть файл

@ -3,36 +3,36 @@ START_FILE
.pred.safe_across_calls p1-p5,p16-p63 .pred.safe_across_calls p1-p5,p16-p63
.text .text
.align 16 .align 16
.global ompi_atomic_mb# .global opal_atomic_mb#
.proc ompi_atomic_mb# .proc opal_atomic_mb#
ompi_atomic_mb: opal_atomic_mb:
.prologue .prologue
.body .body
br.ret.sptk.many b0 br.ret.sptk.many b0
;; ;;
.endp ompi_atomic_mb# .endp opal_atomic_mb#
.align 16 .align 16
.global ompi_atomic_rmb# .global opal_atomic_rmb#
.proc ompi_atomic_rmb# .proc opal_atomic_rmb#
ompi_atomic_rmb: opal_atomic_rmb:
.prologue .prologue
.body .body
br.ret.sptk.many b0 br.ret.sptk.many b0
;; ;;
.endp ompi_atomic_rmb# .endp opal_atomic_rmb#
.align 16 .align 16
.global ompi_atomic_wmb# .global opal_atomic_wmb#
.proc ompi_atomic_wmb# .proc opal_atomic_wmb#
ompi_atomic_wmb: opal_atomic_wmb:
.prologue .prologue
.body .body
br.ret.sptk.many b0 br.ret.sptk.many b0
;; ;;
.endp ompi_atomic_wmb# .endp opal_atomic_wmb#
.align 16 .align 16
.global ompi_atomic_cmpset_acq_32# .global opal_atomic_cmpset_acq_32#
.proc ompi_atomic_cmpset_acq_32# .proc opal_atomic_cmpset_acq_32#
ompi_atomic_cmpset_acq_32: opal_atomic_cmpset_acq_32:
.prologue .prologue
.body .body
mov ar.ccv=r33;; mov ar.ccv=r33;;
@ -44,11 +44,11 @@ ompi_atomic_cmpset_acq_32:
(p7) mov r8 = r0 (p7) mov r8 = r0
br.ret.sptk.many b0 br.ret.sptk.many b0
;; ;;
.endp ompi_atomic_cmpset_acq_32# .endp opal_atomic_cmpset_acq_32#
.align 16 .align 16
.global ompi_atomic_cmpset_rel_32# .global opal_atomic_cmpset_rel_32#
.proc ompi_atomic_cmpset_rel_32# .proc opal_atomic_cmpset_rel_32#
ompi_atomic_cmpset_rel_32: opal_atomic_cmpset_rel_32:
.prologue .prologue
.body .body
mov ar.ccv=r33;; mov ar.ccv=r33;;
@ -60,11 +60,11 @@ ompi_atomic_cmpset_rel_32:
(p7) mov r8 = r0 (p7) mov r8 = r0
br.ret.sptk.many b0 br.ret.sptk.many b0
;; ;;
.endp ompi_atomic_cmpset_rel_32# .endp opal_atomic_cmpset_rel_32#
.align 16 .align 16
.global ompi_atomic_cmpset_acq_64# .global opal_atomic_cmpset_acq_64#
.proc ompi_atomic_cmpset_acq_64# .proc opal_atomic_cmpset_acq_64#
ompi_atomic_cmpset_acq_64: opal_atomic_cmpset_acq_64:
.prologue .prologue
.body .body
mov ar.ccv=r33;; mov ar.ccv=r33;;
@ -78,11 +78,11 @@ ompi_atomic_cmpset_acq_64:
(p7) mov r8 = r0 (p7) mov r8 = r0
br.ret.sptk.many b0 br.ret.sptk.many b0
;; ;;
.endp ompi_atomic_cmpset_acq_64# .endp opal_atomic_cmpset_acq_64#
.align 16 .align 16
.global ompi_atomic_cmpset_rel_64# .global opal_atomic_cmpset_rel_64#
.proc ompi_atomic_cmpset_rel_64# .proc opal_atomic_cmpset_rel_64#
ompi_atomic_cmpset_rel_64: opal_atomic_cmpset_rel_64:
.prologue .prologue
.body .body
mov ar.ccv=r33;; mov ar.ccv=r33;;
@ -96,5 +96,5 @@ ompi_atomic_cmpset_rel_64:
(p7) mov r8 = r0 (p7) mov r8 = r0
br.ret.sptk.many b0 br.ret.sptk.many b0
;; ;;
.endp ompi_atomic_cmpset_rel_64# .endp opal_atomic_cmpset_rel_64#
.ident "GCC: (GNU) 3.2.3 20030502 (Red Hat Linux 3.2.3-49)" .ident "GCC: (GNU) 3.2.3 20030502 (Red Hat Linux 3.2.3-49)"

Просмотреть файл

@ -6,32 +6,32 @@ START_FILE
TEXT TEXT
ALIGN(8) ALIGN(8)
LEAF(ompi_atomic_mb) LEAF(opal_atomic_mb)
#APP #APP
sync sync
#NO_APP #NO_APP
j ra j ra
END(ompi_atomic_mb) END(opal_atomic_mb)
ALIGN(8) ALIGN(8)
LEAF(ompi_atomic_rmb) LEAF(opal_atomic_rmb)
#APP #APP
sync sync
#NO_APP #NO_APP
j ra j ra
END(ompi_atomic_rmb) END(opal_atomic_rmb)
LEAF(ompi_atomic_wmb) LEAF(opal_atomic_wmb)
#APP #APP
sync sync
#NO_APP #NO_APP
j ra j ra
END(ompi_atomic_wmb) END(opal_atomic_wmb)
LEAF(ompi_atomic_cmpset_32) LEAF(opal_atomic_cmpset_32)
#APP #APP
.set noreorder .set noreorder
retry1: retry1:
@ -47,10 +47,10 @@ done1:
xor $3,$3,$5 xor $3,$3,$5
j ra j ra
sltu $2,$3,1 sltu $2,$3,1
END(ompi_atomic_cmpset_32) END(opal_atomic_cmpset_32)
LEAF(ompi_atomic_cmpset_acq_32) LEAF(opal_atomic_cmpset_acq_32)
#APP #APP
.set noreorder .set noreorder
retry2: retry2:
@ -67,10 +67,10 @@ done2:
xor $3,$3,$5 xor $3,$3,$5
j ra j ra
sltu $2,$3,1 sltu $2,$3,1
END(ompi_atomic_cmpset_acq_32) END(opal_atomic_cmpset_acq_32)
LEAF(ompi_atomic_cmpset_rel_32) LEAF(opal_atomic_cmpset_rel_32)
#APP #APP
.set noreorder .set noreorder
sync sync
@ -87,10 +87,10 @@ done3:
xor $3,$3,$5 xor $3,$3,$5
j ra j ra
sltu $2,$3,1 sltu $2,$3,1
END(ompi_atomic_cmpset_rel_32) END(opal_atomic_cmpset_rel_32)
LEAF(ompi_atomic_cmpset_64) LEAF(opal_atomic_cmpset_64)
#APP #APP
.set noreorder .set noreorder
retry4: retry4:
@ -106,10 +106,10 @@ done4:
xor $4,$3,$5 xor $4,$3,$5
j ra j ra
sltu $3,$4,1 sltu $3,$4,1
END(ompi_atomic_cmpset_64) END(opal_atomic_cmpset_64)
LEAF(ompi_atomic_cmpset_acq_64) LEAF(opal_atomic_cmpset_acq_64)
#APP #APP
.set noreorder .set noreorder
retry5: retry5:
@ -125,10 +125,10 @@ done5:
xor $4,$3,$5 xor $4,$3,$5
j ra j ra
sltu $3,$4,1 sltu $3,$4,1
END(ompi_atomic_cmpset_acq_64) END(opal_atomic_cmpset_acq_64)
LEAF(ompi_atomic_cmpset_rel_64) LEAF(opal_atomic_cmpset_rel_64)
#APP #APP
.set noreorder .set noreorder
sync sync
@ -145,4 +145,4 @@ done6:
xor $4,$3,$5 xor $4,$3,$5
j ra j ra
sltu $3,$4,1 sltu $3,$4,1
END(ompi_atomic_cmpset_rel_64) END(opal_atomic_cmpset_rel_64)

Просмотреть файл

@ -2,25 +2,25 @@ START_FILE
TEXT TEXT
ALIGN(4) ALIGN(4)
START_FUNC(ompi_atomic_mb) START_FUNC(opal_atomic_mb)
sync sync
blr blr
END_FUNC(ompi_atomic_mb) END_FUNC(opal_atomic_mb)
START_FUNC(ompi_atomic_rmb) START_FUNC(opal_atomic_rmb)
lwsync lwsync
blr blr
END_FUNC(ompi_atomic_rmb) END_FUNC(opal_atomic_rmb)
START_FUNC(ompi_atomic_wmb) START_FUNC(opal_atomic_wmb)
eieio eieio
blr blr
END_FUNC(ompi_atomic_wmb) END_FUNC(opal_atomic_wmb)
START_FUNC(ompi_atomic_cmpset_32) START_FUNC(opal_atomic_cmpset_32)
LSYM(1) lwarx r0, 0, r3 LSYM(1) lwarx r0, 0, r3
cmpw 0, r0, r4 cmpw 0, r0, r4
bne- REFLSYM(2) bne- REFLSYM(2)
@ -31,10 +31,10 @@ START_FUNC(ompi_atomic_cmpset_32)
subfic r5,r3,0 subfic r5,r3,0
adde r3,r5,r3 adde r3,r5,r3
blr blr
END_FUNC(ompi_atomic_cmpset_32) END_FUNC(opal_atomic_cmpset_32)
START_FUNC(ompi_atomic_cmpset_acq_32) START_FUNC(opal_atomic_cmpset_acq_32)
LSYM(3) lwarx r0, 0, r3 LSYM(3) lwarx r0, 0, r3
cmpw 0, r0, r4 cmpw 0, r0, r4
bne- REFLSYM(4) bne- REFLSYM(4)
@ -47,10 +47,10 @@ START_FUNC(ompi_atomic_cmpset_acq_32)
adde r3,r5,r3 adde r3,r5,r3
lwsync lwsync
blr blr
END_FUNC(ompi_atomic_cmpset_acq_32) END_FUNC(opal_atomic_cmpset_acq_32)
START_FUNC(ompi_atomic_cmpset_rel_32) START_FUNC(opal_atomic_cmpset_rel_32)
eieio eieio
LSYM(5) lwarx r0, 0, r3 LSYM(5) lwarx r0, 0, r3
cmpw 0, r0, r4 cmpw 0, r0, r4
@ -63,10 +63,10 @@ START_FUNC(ompi_atomic_cmpset_rel_32)
subfic r5,r3,0 subfic r5,r3,0
adde r3,r5,r3 adde r3,r5,r3
blr blr
END_FUNC(ompi_atomic_cmpset_rel_32) END_FUNC(opal_atomic_cmpset_rel_32)
#START_64BIT #START_64BIT
START_FUNC(ompi_atomic_cmpset_64) START_FUNC(opal_atomic_cmpset_64)
stw r4,-32(r1) stw r4,-32(r1)
stw r5,-28(r1) stw r5,-28(r1)
stw r6,-24(r1) stw r6,-24(r1)
@ -83,10 +83,10 @@ START_FUNC(ompi_atomic_cmpset_64)
subfic r5,r3,0 subfic r5,r3,0
adde r3,r5,r3 adde r3,r5,r3
blr blr
END_FUNC(ompi_atomic_cmpset_64) END_FUNC(opal_atomic_cmpset_64)
START_FUNC(ompi_atomic_cmpset_acq_64) START_FUNC(opal_atomic_cmpset_acq_64)
stw r4,-32(r1) stw r4,-32(r1)
stw r5,-28(r1) stw r5,-28(r1)
stw r6,-24(r1) stw r6,-24(r1)
@ -106,10 +106,10 @@ START_FUNC(ompi_atomic_cmpset_acq_64)
blr blr
lwsync lwsync
blr blr
END_FUNC(ompi_atomic_cmpset_acq_64) END_FUNC(opal_atomic_cmpset_acq_64)
START_FUNC(ompi_atomic_cmpset_rel_64) START_FUNC(opal_atomic_cmpset_rel_64)
stw r4,-32(r1) stw r4,-32(r1)
stw r5,-28(r1) stw r5,-28(r1)
stw r6,-24(r1) stw r6,-24(r1)
@ -130,11 +130,11 @@ START_FUNC(ompi_atomic_cmpset_rel_64)
blr blr
lwsync lwsync
blr blr
END_FUNC(ompi_atomic_cmpset_rel_64) END_FUNC(opal_atomic_cmpset_rel_64)
#END_64BIT #END_64BIT
START_FUNC(ompi_atomic_add_32) START_FUNC(opal_atomic_add_32)
LSYM(13) lwarx r0, 0, r3 LSYM(13) lwarx r0, 0, r3
add r0, r4, r0 add r0, r4, r0
stwcx. r0, 0, r3 stwcx. r0, 0, r3
@ -142,10 +142,10 @@ START_FUNC(ompi_atomic_add_32)
lwz r3,0(r3) lwz r3,0(r3)
blr blr
END_FUNC(ompi_atomic_add_32) END_FUNC(opal_atomic_add_32)
START_FUNC(ompi_atomic_sub_32) START_FUNC(opal_atomic_sub_32)
LSYM(14) lwarx r0,0,r3 LSYM(14) lwarx r0,0,r3
subf r0,r4,r0 subf r0,r4,r0
stwcx. r0,0,r3 stwcx. r0,0,r3
@ -153,4 +153,4 @@ START_FUNC(ompi_atomic_sub_32)
lwz r3,0(r3) lwz r3,0(r3)
blr blr
END_FUNC(ompi_atomic_sub_32) END_FUNC(opal_atomic_sub_32)

Просмотреть файл

@ -2,25 +2,25 @@ START_FILE
TEXT TEXT
ALIGN(4) ALIGN(4)
START_FUNC(ompi_atomic_mb) START_FUNC(opal_atomic_mb)
sync sync
blr blr
END_FUNC(ompi_atomic_mb) END_FUNC(opal_atomic_mb)
START_FUNC(ompi_atomic_rmb) START_FUNC(opal_atomic_rmb)
lwsync lwsync
blr blr
END_FUNC(ompi_atomic_rmb) END_FUNC(opal_atomic_rmb)
START_FUNC(ompi_atomic_wmb) START_FUNC(opal_atomic_wmb)
eieio eieio
blr blr
END_FUNC(ompi_atomic_wmb) END_FUNC(opal_atomic_wmb)
START_FUNC(ompi_atomic_cmpset_32) START_FUNC(opal_atomic_cmpset_32)
LSYM(1) lwarx r0, 0, r3 LSYM(1) lwarx r0, 0, r3
cmpw 0, r0, r4 cmpw 0, r0, r4
bne- REFLSYM(2) bne- REFLSYM(2)
@ -31,27 +31,27 @@ START_FUNC(ompi_atomic_cmpset_32)
mfcr r3 mfcr r3
rlwinm r3,r3,31,1 rlwinm r3,r3,31,1
blr blr
END_FUNC(ompi_atomic_cmpset_32) END_FUNC(opal_atomic_cmpset_32)
START_FUNC(ompi_atomic_cmpset_acq_32) START_FUNC(opal_atomic_cmpset_acq_32)
mflr r0 mflr r0
std r29,-24(r1) std r29,-24(r1)
std r0,16(r1) std r0,16(r1)
stdu r1,-144(r1) stdu r1,-144(r1)
bl REFGSYM(ompi_atomic_cmpset_32) bl REFGSYM(opal_atomic_cmpset_32)
mr r29,r3 mr r29,r3
bl REFGSYM(ompi_atomic_rmb) bl REFGSYM(opal_atomic_rmb)
mr r3,r29 mr r3,r29
addi r1,r1,144 addi r1,r1,144
ld r0,16(r1) ld r0,16(r1)
mtlr r0 mtlr r0
ld r29,-24(r1) ld r29,-24(r1)
blr blr
END_FUNC(ompi_atomic_cmpset_acq_32) END_FUNC(opal_atomic_cmpset_acq_32)
START_FUNC(ompi_atomic_cmpset_rel_32) START_FUNC(opal_atomic_cmpset_rel_32)
mflr r0 mflr r0
std r27,-40(r1) std r27,-40(r1)
std r28,-32(r1) std r28,-32(r1)
@ -61,11 +61,11 @@ START_FUNC(ompi_atomic_cmpset_rel_32)
mr r29,r3 mr r29,r3
mr r28,r4 mr r28,r4
mr r27,r5 mr r27,r5
bl REFGSYM(ompi_atomic_wmb) bl REFGSYM(opal_atomic_wmb)
mr r3,r29 mr r3,r29
mr r4,r28 mr r4,r28
mr r5,r27 mr r5,r27
bl REFGSYM(ompi_atomic_cmpset_32) bl REFGSYM(opal_atomic_cmpset_32)
addi r1,r1,160 addi r1,r1,160
ld r0,16(r1) ld r0,16(r1)
mtlr r0 mtlr r0
@ -73,10 +73,10 @@ START_FUNC(ompi_atomic_cmpset_rel_32)
ld r28,-32(r1) ld r28,-32(r1)
ld r29,-24(r1) ld r29,-24(r1)
blr blr
END_FUNC(ompi_atomic_cmpset_rel_32) END_FUNC(opal_atomic_cmpset_rel_32)
START_FUNC(ompi_atomic_cmpset_64) START_FUNC(opal_atomic_cmpset_64)
LSYM(3) ldarx r0, 0, r3 LSYM(3) ldarx r0, 0, r3
cmpd 0, r0, r4 cmpd 0, r0, r4
bne- REFLSYM(4) bne- REFLSYM(4)
@ -87,10 +87,10 @@ START_FUNC(ompi_atomic_cmpset_64)
subfic r5,r3,0 subfic r5,r3,0
adde r3,r5,r3 adde r3,r5,r3
blr blr
END_FUNC(ompi_atomic_cmpset_64) END_FUNC(opal_atomic_cmpset_64)
START_FUNC(ompi_atomic_cmpset_acq_64) START_FUNC(opal_atomic_cmpset_acq_64)
LSYM(7) ldarx r0, 0, r3 LSYM(7) ldarx r0, 0, r3
cmpd 0, r0, r4 cmpd 0, r0, r4
bne- REFLSYM(8) bne- REFLSYM(8)
@ -102,10 +102,10 @@ START_FUNC(ompi_atomic_cmpset_acq_64)
subfic r5,r3,0 subfic r5,r3,0
adde r3,r5,r3 adde r3,r5,r3
blr blr
END_FUNC(ompi_atomic_cmpset_acq_64) END_FUNC(opal_atomic_cmpset_acq_64)
START_FUNC(ompi_atomic_cmpset_rel_64) START_FUNC(opal_atomic_cmpset_rel_64)
eieio eieio
LSYM(9) ldarx r0, 0, r3 LSYM(9) ldarx r0, 0, r3
cmpd 0, r0, r4 cmpd 0, r0, r4
@ -117,10 +117,10 @@ START_FUNC(ompi_atomic_cmpset_rel_64)
subfic r5,r3,0 subfic r5,r3,0
adde r3,r5,r3 adde r3,r5,r3
blr blr
END_FUNC(ompi_atomic_cmpset_rel_64) END_FUNC(opal_atomic_cmpset_rel_64)
START_FUNC(ompi_atomic_add_32) START_FUNC(opal_atomic_add_32)
LSYM(5) lwarx r0, 0, r3 LSYM(5) lwarx r0, 0, r3
add r0, r4, r0 add r0, r4, r0
stwcx. r0, 0, r3 stwcx. r0, 0, r3
@ -129,10 +129,10 @@ START_FUNC(ompi_atomic_add_32)
lwz r3,0(r3) lwz r3,0(r3)
extsw r3,r3 extsw r3,r3
blr blr
END_FUNC(ompi_atomic_add_32) END_FUNC(opal_atomic_add_32)
START_FUNC(ompi_atomic_sub_32) START_FUNC(opal_atomic_sub_32)
LSYM(6) lwarx r0,0,r3 LSYM(6) lwarx r0,0,r3
subf r0,r4,r0 subf r0,r4,r0
stwcx. r0,0,r3 stwcx. r0,0,r3
@ -141,4 +141,4 @@ START_FUNC(ompi_atomic_sub_32)
lwz r3,0(r3) lwz r3,0(r3)
extsw r3,r3 extsw r3,r3
blr blr
END_FUNC(ompi_atomic_sub_32) END_FUNC(opal_atomic_sub_32)

Просмотреть файл

@ -3,40 +3,40 @@ START_FILE
ALIGN(4) ALIGN(4)
START_FUNC(ompi_atomic_mb) START_FUNC(opal_atomic_mb)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
retl retl
nop nop
END_FUNC(ompi_atomic_mb) END_FUNC(opal_atomic_mb)
START_FUNC(ompi_atomic_rmb) START_FUNC(opal_atomic_rmb)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
retl retl
nop nop
END_FUNC(ompi_atomic_rmb) END_FUNC(opal_atomic_rmb)
START_FUNC(ompi_atomic_wmb) START_FUNC(opal_atomic_wmb)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
retl retl
nop nop
END_FUNC(ompi_atomic_wmb) END_FUNC(opal_atomic_wmb)
START_FUNC(ompi_atomic_init) START_FUNC(opal_atomic_init)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
stb %o1, [%o0] stb %o1, [%o0]
retl retl
nop nop
END_FUNC(ompi_atomic_init) END_FUNC(opal_atomic_init)
START_FUNC(ompi_atomic_trylock) START_FUNC(opal_atomic_trylock)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
ldstub [%o0], %o0 ldstub [%o0], %o0
@ -44,10 +44,10 @@ START_FUNC(ompi_atomic_trylock)
subcc %g0, %o0, %g0 subcc %g0, %o0, %g0
retl retl
subx %g0, -1, %o0 subx %g0, -1, %o0
END_FUNC(ompi_atomic_trylock) END_FUNC(opal_atomic_trylock)
START_FUNC(ompi_atomic_lock) START_FUNC(opal_atomic_lock)
!#PROLOGUE# 0 !#PROLOGUE# 0
save %sp, -112, %sp save %sp, -112, %sp
!#PROLOGUE# 1 !#PROLOGUE# 1
@ -66,10 +66,10 @@ LSYM(out)
nop nop
ret ret
restore restore
END_FUNC(ompi_atomic_lock) END_FUNC(opal_atomic_lock)
START_FUNC(ompi_atomic_unlock) START_FUNC(opal_atomic_unlock)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
stbar stbar
@ -77,4 +77,4 @@ START_FUNC(ompi_atomic_unlock)
retl retl
nop nop
END_FUNC(ompi_atomic_unlock) END_FUNC(opal_atomic_unlock)

Просмотреть файл

@ -4,34 +4,34 @@ START_FILE
ALIGN(4) ALIGN(4)
START_FUNC(ompi_atomic_mb) START_FUNC(opal_atomic_mb)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad
retl retl
nop nop
END_FUNC(ompi_atomic_mb) END_FUNC(opal_atomic_mb)
START_FUNC(ompi_atomic_rmb) START_FUNC(opal_atomic_rmb)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
membar #LoadLoad membar #LoadLoad
retl retl
nop nop
END_FUNC(ompi_atomic_rmb) END_FUNC(opal_atomic_rmb)
START_FUNC(ompi_atomic_wmb) START_FUNC(opal_atomic_wmb)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
membar #StoreStore membar #StoreStore
retl retl
nop nop
END_FUNC(ompi_atomic_wmb) END_FUNC(opal_atomic_wmb)
START_FUNC(ompi_atomic_cmpset_32) START_FUNC(opal_atomic_cmpset_32)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
casa [%o0] 0x80, %o1, %o2 casa [%o0] 0x80, %o1, %o2
@ -39,10 +39,10 @@ START_FUNC(ompi_atomic_cmpset_32)
subcc %g0, %o2, %g0 subcc %g0, %o2, %g0
retl retl
subx %g0, -1, %o0 subx %g0, -1, %o0
END_FUNC(ompi_atomic_cmpset_32) END_FUNC(opal_atomic_cmpset_32)
START_FUNC(ompi_atomic_cmpset_acq_32) START_FUNC(opal_atomic_cmpset_acq_32)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
casa [%o0] 0x80, %o1, %o2 casa [%o0] 0x80, %o1, %o2
@ -52,10 +52,10 @@ START_FUNC(ompi_atomic_cmpset_acq_32)
membar #LoadLoad membar #LoadLoad
retl retl
sra %o0, 0, %o0 sra %o0, 0, %o0
END_FUNC(ompi_atomic_cmpset_acq_32) END_FUNC(opal_atomic_cmpset_acq_32)
START_FUNC(ompi_atomic_cmpset_rel_32) START_FUNC(opal_atomic_cmpset_rel_32)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
membar #StoreStore membar #StoreStore
@ -64,10 +64,10 @@ START_FUNC(ompi_atomic_cmpset_rel_32)
subcc %g0, %o2, %g0 subcc %g0, %o2, %g0
retl retl
subx %g0, -1, %o0 subx %g0, -1, %o0
END_FUNC(ompi_atomic_cmpset_rel_32) END_FUNC(opal_atomic_cmpset_rel_32)
START_FUNC(ompi_atomic_cmpset_64) START_FUNC(opal_atomic_cmpset_64)
!#PROLOGUE# 0 !#PROLOGUE# 0
save %sp, -128, %sp save %sp, -128, %sp
!#PROLOGUE# 1 !#PROLOGUE# 1
@ -94,10 +94,10 @@ START_FUNC(ompi_atomic_cmpset_64)
LSYM(12) LSYM(12)
ret ret
restore restore
END_FUNC(ompi_atomic_cmpset_64) END_FUNC(opal_atomic_cmpset_64)
START_FUNC(ompi_atomic_cmpset_acq_64) START_FUNC(opal_atomic_cmpset_acq_64)
!#PROLOGUE# 0 !#PROLOGUE# 0
save %sp, -128, %sp save %sp, -128, %sp
!#PROLOGUE# 1 !#PROLOGUE# 1
@ -126,10 +126,10 @@ LSYM(16)
membar #LoadLoad membar #LoadLoad
ret ret
restore restore
END_FUNC(ompi_atomic_cmpset_acq_64) END_FUNC(opal_atomic_cmpset_acq_64)
START_FUNC(ompi_atomic_cmpset_rel_64) START_FUNC(opal_atomic_cmpset_rel_64)
!#PROLOGUE# 0 !#PROLOGUE# 0
save %sp, -128, %sp save %sp, -128, %sp
!#PROLOGUE# 1 !#PROLOGUE# 1
@ -158,4 +158,4 @@ START_FUNC(ompi_atomic_cmpset_rel_64)
LSYM(21) LSYM(21)
ret ret
restore restore
END_FUNC(ompi_atomic_cmpset_rel_64) END_FUNC(opal_atomic_cmpset_rel_64)

Просмотреть файл

@ -4,34 +4,34 @@ START_FILE
ALIGN(4) ALIGN(4)
START_FUNC(ompi_atomic_mb) START_FUNC(opal_atomic_mb)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad
retl retl
nop nop
END_FUNC(ompi_atomic_mb) END_FUNC(opal_atomic_mb)
START_FUNC(ompi_atomic_rmb) START_FUNC(opal_atomic_rmb)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
membar #LoadLoad membar #LoadLoad
retl retl
nop nop
END_FUNC(ompi_atomic_rmb) END_FUNC(opal_atomic_rmb)
START_FUNC(ompi_atomic_wmb) START_FUNC(opal_atomic_wmb)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
membar #StoreStore membar #StoreStore
retl retl
nop nop
END_FUNC(ompi_atomic_wmb) END_FUNC(opal_atomic_wmb)
START_FUNC(ompi_atomic_cmpset_32) START_FUNC(opal_atomic_cmpset_32)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
casa [%o0] 0x80, %o1, %o2 casa [%o0] 0x80, %o1, %o2
@ -39,10 +39,10 @@ START_FUNC(ompi_atomic_cmpset_32)
subcc %g0, %o2, %g0 subcc %g0, %o2, %g0
retl retl
subx %g0, -1, %o0 subx %g0, -1, %o0
END_FUNC(ompi_atomic_cmpset_32) END_FUNC(opal_atomic_cmpset_32)
START_FUNC(ompi_atomic_cmpset_acq_32) START_FUNC(opal_atomic_cmpset_acq_32)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
casa [%o0] 0x80, %o1, %o2 casa [%o0] 0x80, %o1, %o2
@ -52,10 +52,10 @@ START_FUNC(ompi_atomic_cmpset_acq_32)
membar #LoadLoad membar #LoadLoad
retl retl
sra %o0, 0, %o0 sra %o0, 0, %o0
END_FUNC(ompi_atomic_cmpset_acq_32) END_FUNC(opal_atomic_cmpset_acq_32)
START_FUNC(ompi_atomic_cmpset_rel_32) START_FUNC(opal_atomic_cmpset_rel_32)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
membar #StoreStore membar #StoreStore
@ -64,10 +64,10 @@ START_FUNC(ompi_atomic_cmpset_rel_32)
subcc %g0, %o2, %g0 subcc %g0, %o2, %g0
retl retl
subx %g0, -1, %o0 subx %g0, -1, %o0
END_FUNC(ompi_atomic_cmpset_rel_32) END_FUNC(opal_atomic_cmpset_rel_32)
START_FUNC(ompi_atomic_cmpset_64) START_FUNC(opal_atomic_cmpset_64)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
casxa [%o0] 0x80, %o1, %o2 casxa [%o0] 0x80, %o1, %o2
@ -75,10 +75,10 @@ START_FUNC(ompi_atomic_cmpset_64)
xor %o2, %o1, %o2 xor %o2, %o1, %o2
retl retl
movre %o2, 1, %o0 movre %o2, 1, %o0
END_FUNC(ompi_atomic_cmpset_64) END_FUNC(opal_atomic_cmpset_64)
START_FUNC(ompi_atomic_cmpset_acq_64) START_FUNC(opal_atomic_cmpset_acq_64)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
casxa [%o0] 0x80, %o1, %o2 casxa [%o0] 0x80, %o1, %o2
@ -88,10 +88,10 @@ START_FUNC(ompi_atomic_cmpset_acq_64)
membar #LoadLoad membar #LoadLoad
retl retl
sra %o0, 0, %o0 sra %o0, 0, %o0
END_FUNC(ompi_atomic_cmpset_acq_64) END_FUNC(opal_atomic_cmpset_acq_64)
START_FUNC(ompi_atomic_cmpset_rel_64) START_FUNC(opal_atomic_cmpset_rel_64)
!#PROLOGUE# 0 !#PROLOGUE# 0
!#PROLOGUE# 1 !#PROLOGUE# 1
membar #StoreStore membar #StoreStore
@ -100,4 +100,4 @@ START_FUNC(ompi_atomic_cmpset_rel_64)
xor %o2, %o1, %o2 xor %o2, %o1, %o2
retl retl
movre %o2, 1, %o0 movre %o2, 1, %o0
END_FUNC(ompi_atomic_cmpset_rel_64) END_FUNC(opal_atomic_cmpset_rel_64)

Просмотреть файл

@ -147,7 +147,7 @@ bool opal_list_insert(opal_list_t *list, opal_list_item_t *item, long long idx)
/* Spot check: ensure this item is only on the list that we /* Spot check: ensure this item is only on the list that we
just insertted it into */ just insertted it into */
ompi_atomic_add( &(item->opal_list_item_refcount), 1 ); opal_atomic_add( &(item->opal_list_item_refcount), 1 );
assert(1 == item->opal_list_item_refcount); assert(1 == item->opal_list_item_refcount);
item->opal_list_item_belong_to = list; item->opal_list_item_belong_to = list;
#endif #endif

Просмотреть файл

@ -47,7 +47,7 @@ opal_class_t opal_object_t_class = {
/* /*
* Local variables * Local variables
*/ */
static ompi_lock_t class_lock = { { OMPI_ATOMIC_UNLOCKED } }; static opal_atomic_lock_t class_lock = { { OPAL_ATOMIC_UNLOCKED } };
static void** classes = NULL; static void** classes = NULL;
static int num_classes = 0; static int num_classes = 0;
static int max_classes = 0; static int max_classes = 0;
@ -77,14 +77,14 @@ void opal_class_initialize(opal_class_t *cls)
if (1 == cls->cls_initialized) { if (1 == cls->cls_initialized) {
return; return;
} }
ompi_atomic_lock(&class_lock); opal_atomic_lock(&class_lock);
/* If another thread initializing this same class came in at /* If another thread initializing this same class came in at
roughly the same time, it may have gotten the lock and roughly the same time, it may have gotten the lock and
initialized. So check again. */ initialized. So check again. */
if (1 == cls->cls_initialized) { if (1 == cls->cls_initialized) {
ompi_atomic_unlock(&class_lock); opal_atomic_unlock(&class_lock);
return; return;
} }
@ -122,7 +122,7 @@ void opal_class_initialize(opal_class_t *cls)
/* All done */ /* All done */
ompi_atomic_unlock(&class_lock); opal_atomic_unlock(&class_lock);
} }

Просмотреть файл

@ -447,7 +447,7 @@ static inline opal_object_t *opal_obj_new(size_t size, opal_class_t * cls)
static inline int opal_obj_update(opal_object_t *object, int inc) static inline int opal_obj_update(opal_object_t *object, int inc)
{ {
#if OMPI_HAVE_THREAD_SUPPORT #if OMPI_HAVE_THREAD_SUPPORT
ompi_atomic_add(&(object->obj_reference_count), inc ); opal_atomic_add(&(object->obj_reference_count), inc );
#else #else
object->obj_reference_count += inc; object->obj_reference_count += inc;
#endif #endif

Просмотреть файл

@ -41,11 +41,11 @@
* Define constants for PowerPC 32 * Define constants for PowerPC 32
* *
*********************************************************************/ *********************************************************************/
#define OMPI_HAVE_ATOMIC_MEM_BARRIER 1 #define OPAL_HAVE_ATOMIC_MEM_BARRIER 1
#define OMPI_HAVE_ATOMIC_CMPSET_32 1 #define OPAL_HAVE_ATOMIC_CMPSET_32 1
#define OMPI_HAVE_ATOMIC_CMPSET_64 1 #define OPAL_HAVE_ATOMIC_CMPSET_64 1
/********************************************************************** /**********************************************************************
@ -55,19 +55,19 @@
*********************************************************************/ *********************************************************************/
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline void ompi_atomic_mb(void) static inline void opal_atomic_mb(void)
{ {
MB(); MB();
} }
static inline void ompi_atomic_rmb(void) static inline void opal_atomic_rmb(void)
{ {
RMB(); RMB();
} }
static inline void ompi_atomic_wmb(void) static inline void opal_atomic_wmb(void)
{ {
WMB(); WMB();
} }
@ -82,7 +82,7 @@ static inline void ompi_atomic_wmb(void)
*********************************************************************/ *********************************************************************/
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline int ompi_atomic_cmpset_32( volatile int32_t *addr, static inline int opal_atomic_cmpset_32( volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
int32_t ret; int32_t ret;
@ -105,29 +105,29 @@ static inline int ompi_atomic_cmpset_32( volatile int32_t *addr,
} }
static inline int ompi_atomic_cmpset_acq_32(volatile int32_t *addr, static inline int opal_atomic_cmpset_acq_32(volatile int32_t *addr,
int32_t oldval, int32_t oldval,
int32_t newval) int32_t newval)
{ {
int rc; int rc;
rc = ompi_atomic_cmpset_32(addr, oldval, newval); rc = opal_atomic_cmpset_32(addr, oldval, newval);
ompi_atomic_rmb(); opal_atomic_rmb();
return rc; return rc;
} }
static inline int ompi_atomic_cmpset_rel_32(volatile int32_t *addr, static inline int opal_atomic_cmpset_rel_32(volatile int32_t *addr,
int32_t oldval, int32_t oldval,
int32_t newval) int32_t newval)
{ {
ompi_atomic_wmb(); opal_atomic_wmb();
return ompi_atomic_cmpset_32(addr, oldval, newval); return opal_atomic_cmpset_32(addr, oldval, newval);
} }
static inline int ompi_atomic_cmpset_64( volatile int64_t *addr, static inline int opal_atomic_cmpset_64( volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
int32_t ret; int32_t ret;
@ -150,25 +150,25 @@ static inline int ompi_atomic_cmpset_64( volatile int64_t *addr,
} }
static inline int ompi_atomic_cmpset_acq_64(volatile int64_t *addr, static inline int opal_atomic_cmpset_acq_64(volatile int64_t *addr,
int64_t oldval, int64_t oldval,
int64_t newval) int64_t newval)
{ {
int rc; int rc;
rc = ompi_atomic_cmpset_64(addr, oldval, newval); rc = opal_atomic_cmpset_64(addr, oldval, newval);
ompi_atomic_rmb(); opal_atomic_rmb();
return rc; return rc;
} }
static inline int ompi_atomic_cmpset_rel_64(volatile int64_t *addr, static inline int opal_atomic_cmpset_rel_64(volatile int64_t *addr,
int64_t oldval, int64_t oldval,
int64_t newval) int64_t newval)
{ {
ompi_atomic_wmb(); opal_atomic_wmb();
return ompi_atomic_cmpset_64(addr, oldval, newval); return opal_atomic_cmpset_64(addr, oldval, newval);
} }

Просмотреть файл

@ -15,7 +15,7 @@
# $HEADER$ # $HEADER$
# #
CFILE=/tmp/ompi_atomic_$$.c CFILE=/tmp/opal_atomic_$$.c
trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15

Просмотреть файл

@ -35,11 +35,11 @@
* Define constants for AMD64 / x86_64 / EM64T / ... * Define constants for AMD64 / x86_64 / EM64T / ...
* *
*********************************************************************/ *********************************************************************/
#define OMPI_HAVE_ATOMIC_MEM_BARRIER 1 #define OPAL_HAVE_ATOMIC_MEM_BARRIER 1
#define OMPI_HAVE_ATOMIC_CMPSET_32 1 #define OPAL_HAVE_ATOMIC_CMPSET_32 1
#define OMPI_HAVE_ATOMIC_CMPSET_64 1 #define OPAL_HAVE_ATOMIC_CMPSET_64 1
/********************************************************************** /**********************************************************************
@ -49,19 +49,19 @@
*********************************************************************/ *********************************************************************/
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline void ompi_atomic_mb(void) static inline void opal_atomic_mb(void)
{ {
MB(); MB();
} }
static inline void ompi_atomic_rmb(void) static inline void opal_atomic_rmb(void)
{ {
MB(); MB();
} }
static inline void ompi_atomic_wmb(void) static inline void opal_atomic_wmb(void)
{ {
MB(); MB();
} }
@ -76,7 +76,7 @@ static inline void ompi_atomic_wmb(void)
*********************************************************************/ *********************************************************************/
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline int ompi_atomic_cmpset_32( volatile int32_t *addr, static inline int opal_atomic_cmpset_32( volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
unsigned long prev; unsigned long prev;
@ -89,12 +89,12 @@ static inline int ompi_atomic_cmpset_32( volatile int32_t *addr,
#endif /* OMPI_GCC_INLINE_ASSEMBLY */ #endif /* OMPI_GCC_INLINE_ASSEMBLY */
#define ompi_atomic_cmpset_acq_32 ompi_atomic_cmpset_32 #define opal_atomic_cmpset_acq_32 opal_atomic_cmpset_32
#define ompi_atomic_cmpset_rel_32 ompi_atomic_cmpset_32 #define opal_atomic_cmpset_rel_32 opal_atomic_cmpset_32
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline int ompi_atomic_cmpset_64( volatile int64_t *addr, static inline int opal_atomic_cmpset_64( volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
int64_t prev; int64_t prev;
@ -110,7 +110,7 @@ static inline int ompi_atomic_cmpset_64( volatile int64_t *addr,
#endif /* OMPI_GCC_INLINE_ASSEMBLY */ #endif /* OMPI_GCC_INLINE_ASSEMBLY */
#define ompi_atomic_cmpset_acq_64 ompi_atomic_cmpset_64 #define opal_atomic_cmpset_acq_64 opal_atomic_cmpset_64
#define ompi_atomic_cmpset_rel_64 ompi_atomic_cmpset_64 #define opal_atomic_cmpset_rel_64 opal_atomic_cmpset_64
#endif /* ! OMPI_SYS_ARCH_ATOMIC_H */ #endif /* ! OMPI_SYS_ARCH_ATOMIC_H */

Просмотреть файл

@ -15,7 +15,7 @@
# $HEADER$ # $HEADER$
# #
CFILE=/tmp/ompi_atomic_$$.c CFILE=/tmp/opal_atomic_$$.c
trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15

Просмотреть файл

@ -29,18 +29,18 @@
* The following #defines will be true / false based on * The following #defines will be true / false based on
* assembly support: * assembly support:
* *
* - \c OMPI_HAVE_MEM_BARRIER atomic memory barriers * - \c OPAL_HAVE_ATOMIC_MEM_BARRIER atomic memory barriers
* - \c OMPI_HAVE_ATOMIC_SPINLOCKS atomic spinlocks * - \c OPAL_HAVE_ATOMIC_SPINLOCKS atomic spinlocks
* - \c OMPI_HAVE_ATOMIC_MATH_32 if 32 bit add/sub/cmpset can be done "atomicly" * - \c OPAL_HAVE_ATOMIC_MATH_32 if 32 bit add/sub/cmpset can be done "atomicly"
* - \c OMPI_HAVE_ATOMIC_MATH_64 if 32 bit add/sub/cmpset can be done "atomicly" * - \c OPAL_HAVE_ATOMIC_MATH_64 if 32 bit add/sub/cmpset can be done "atomicly"
* *
* Note that for the Atomic math, atomic add/sub may be implemented as * Note that for the Atomic math, atomic add/sub may be implemented as
* C code using ompi_atomic_cmpset. The appearance of atomic * C code using opal_atomic_cmpset. The appearance of atomic
* operation will be upheld in these cases. * operation will be upheld in these cases.
*/ */
#ifndef OMPI_SYS_ATOMIC_H #ifndef OPAL_SYS_ATOMIC_H
#define OMPI_SYS_ATOMIC_H 1 #define OPAL_SYS_ATOMIC_H 1
#include "ompi_config.h" #include "ompi_config.h"
@ -77,14 +77,14 @@ extern "C" {
* to use an int or unsigned char as the lock value - the user is not * to use an int or unsigned char as the lock value - the user is not
* informed either way. * informed either way.
*/ */
struct ompi_lock_t { struct opal_atomic_lock_t {
union { union {
volatile int lock; /**< The lock address (an integer) */ volatile int lock; /**< The lock address (an integer) */
volatile unsigned char sparc_lock; /**< The lock address on sparc */ volatile unsigned char sparc_lock; /**< The lock address on sparc */
char padding[sizeof(int)]; /**< Array for optional padding */ char padding[sizeof(int)]; /**< Array for optional padding */
} u; } u;
}; };
typedef struct ompi_lock_t ompi_lock_t; typedef struct opal_atomic_lock_t opal_atomic_lock_t;
/********************************************************************** /**********************************************************************
@ -124,11 +124,11 @@ typedef struct ompi_lock_t ompi_lock_t;
/* compare and set operations can't really be emulated from software, /* compare and set operations can't really be emulated from software,
so if these defines aren't already set, they should be set to 0 so if these defines aren't already set, they should be set to 0
now */ now */
#ifndef OMPI_HAVE_ATOMIC_CMPSET_32 #ifndef OPAL_HAVE_ATOMIC_CMPSET_32
#define OMPI_HAVE_ATOMIC_CMPSET_32 0 #define OPAL_HAVE_ATOMIC_CMPSET_32 0
#endif #endif
#ifndef OMPI_HAVE_ATOMIC_CMPSET_64 #ifndef OPAL_HAVE_ATOMIC_CMPSET_64
#define OMPI_HAVE_ATOMIC_CMPSET_64 0 #define OPAL_HAVE_ATOMIC_CMPSET_64 0
#endif #endif
#endif /* DOXYGEN */ #endif /* DOXYGEN */
@ -138,18 +138,18 @@ typedef struct ompi_lock_t ompi_lock_t;
* but can't inline * but can't inline
* *
*********************************************************************/ *********************************************************************/
#if !defined(OMPI_HAVE_ATOMIC_MEM_BARRIER) && !defined(DOXYGEN) #if !defined(OPAL_HAVE_ATOMIC_MEM_BARRIER) && !defined(DOXYGEN)
/* no way to emulate in C code */ /* no way to emulate in C code */
#define OMPI_HAVE_ATOMIC_MEM_BARRIER 0 #define OPAL_HAVE_ATOMIC_MEM_BARRIER 0
#endif #endif
#if defined(DOXYGEN) || OMPI_HAVE_ATOMIC_MEM_BARRIER #if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_MEM_BARRIER
/** /**
* Memory barrier * Memory barrier
* *
* Will use system-specific features to instruct the processor and * Will use system-specific features to instruct the processor and
* memory controller that all writes and reads that have been posted * memory controller that all writes and reads that have been posted
* before the call to \c ompi_atomic_mb() must appear to have * before the call to \c opal_atomic_mb() must appear to have
* completed before the next read or write. * completed before the next read or write.
* *
* \note This can have some expensive side effects, including flushing * \note This can have some expensive side effects, including flushing
@ -157,31 +157,31 @@ typedef struct ompi_lock_t ompi_lock_t;
* generally grinding the memory controller's performance. Use only * generally grinding the memory controller's performance. Use only
* if you need *both* read and write barriers. * if you need *both* read and write barriers.
*/ */
void ompi_atomic_mb(void); void opal_atomic_mb(void);
/** /**
* Read memory barrier * Read memory barrier
* *
* Use system-specific features to instruct the processor and memory * Use system-specific features to instruct the processor and memory
* conrtoller that all reads that have been posted before the call to * conrtoller that all reads that have been posted before the call to
* \c ompi_atomic_rmb() must appear to have been completed before the * \c opal_atomic_rmb() must appear to have been completed before the
* next read. Nothing is said about the ordering of writes when using * next read. Nothing is said about the ordering of writes when using
* \c ompi_atomic_rmb(). * \c opal_atomic_rmb().
*/ */
void ompi_atomic_rmb(void); void opal_atomic_rmb(void);
/** /**
* Write memory barrier. * Write memory barrier.
* *
* Use system-specific features to instruct the processor and memory * Use system-specific features to instruct the processor and memory
* conrtoller that all writes that have been posted before the call to * conrtoller that all writes that have been posted before the call to
* \c ompi_atomic_rmb() must appear to have been completed before the * \c opal_atomic_rmb() must appear to have been completed before the
* next write. Nothing is said about the ordering of reads when using * next write. Nothing is said about the ordering of reads when using
* \c ompi_atomic_rmb(). * \c opal_atomic_rmb().
*/ */
void ompi_atomic_wmb(void); void opal_atomic_wmb(void);
#endif /* defined(DOXYGEN) || OMPI_HAVE_MEM_BARRIER */ #endif /* defined(DOXYGEN) || OPAL_HAVE_ATOMIC_MEM_BARRIER */
/********************************************************************** /**********************************************************************
@ -190,20 +190,20 @@ void ompi_atomic_wmb(void);
* *
*********************************************************************/ *********************************************************************/
#if !defined(OMPI_HAVE_ATOMIC_SPINLOCKS) && !defined(DOXYGEN) #if !defined(OPAL_HAVE_ATOMIC_SPINLOCKS) && !defined(DOXYGEN)
/* 0 is more like "pending" - we'll fix up at the end after all /* 0 is more like "pending" - we'll fix up at the end after all
the static inline functions are declared */ the static inline functions are declared */
#define OMPI_HAVE_ATOMIC_SPINLOCKS 0 #define OPAL_HAVE_ATOMIC_SPINLOCKS 0
#endif #endif
#if defined(DOXYGEN) || OMPI_HAVE_ATOMIC_SPINLOCKS || (OMPI_HAVE_ATOMIC_CMPSET_32 || OMPI_HAVE_ATOMIC_CMPSET_64) #if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_SPINLOCKS || (OPAL_HAVE_ATOMIC_CMPSET_32 || OPAL_HAVE_ATOMIC_CMPSET_64)
/** /**
* Enumeration of lock states * Enumeration of lock states
*/ */
enum { enum {
OMPI_ATOMIC_UNLOCKED = 0, OPAL_ATOMIC_UNLOCKED = 0,
OMPI_ATOMIC_LOCKED = 1 OPAL_ATOMIC_LOCKED = 1
}; };
@ -213,10 +213,10 @@ enum {
* @param lock Address of the lock * @param lock Address of the lock
* @param value Initial value to set lock to * @param value Initial value to set lock to
*/ */
#if OMPI_HAVE_ATOMIC_SPINLOCKS == 0 #if OPAL_HAVE_ATOMIC_SPINLOCKS == 0
static inline static inline
#endif #endif
void ompi_atomic_init(ompi_lock_t* lock, int value); void opal_atomic_init(opal_atomic_lock_t* lock, int value);
/** /**
@ -225,10 +225,10 @@ void ompi_atomic_init(ompi_lock_t* lock, int value);
* @param lock Address of the lock. * @param lock Address of the lock.
* @return 0 if the lock was acquired, 1 otherwise. * @return 0 if the lock was acquired, 1 otherwise.
*/ */
#if OMPI_HAVE_ATOMIC_SPINLOCKS == 0 #if OPAL_HAVE_ATOMIC_SPINLOCKS == 0
static inline static inline
#endif #endif
int ompi_atomic_trylock(ompi_lock_t *lock); int opal_atomic_trylock(opal_atomic_lock_t *lock);
/** /**
@ -236,10 +236,10 @@ int ompi_atomic_trylock(ompi_lock_t *lock);
* *
* @param lock Address of the lock. * @param lock Address of the lock.
*/ */
#if OMPI_HAVE_ATOMIC_SPINLOCKS == 0 #if OPAL_HAVE_ATOMIC_SPINLOCKS == 0
static inline static inline
#endif #endif
void ompi_atomic_lock(ompi_lock_t *lock); void opal_atomic_lock(opal_atomic_lock_t *lock);
/** /**
@ -247,19 +247,19 @@ void ompi_atomic_lock(ompi_lock_t *lock);
* *
* @param lock Address of the lock. * @param lock Address of the lock.
*/ */
#if OMPI_HAVE_ATOMIC_SPINLOCKS == 0 #if OPAL_HAVE_ATOMIC_SPINLOCKS == 0
static inline static inline
#endif #endif
void ompi_atomic_unlock(ompi_lock_t *lock); void opal_atomic_unlock(opal_atomic_lock_t *lock);
#if OMPI_HAVE_ATOMIC_SPINLOCKS == 0 #if OPAL_HAVE_ATOMIC_SPINLOCKS == 0
#undef OMPI_HAVE_ATOMIC_SPINLOCKS #undef OPAL_HAVE_ATOMIC_SPINLOCKS
#define OMPI_HAVE_ATOMIC_SPINLOCKS (OMPI_HAVE_ATOMIC_CMPSET_32 || OMPI_HAVE_ATOMIC_CMPSET_64) #define OPAL_HAVE_ATOMIC_SPINLOCKS (OPAL_HAVE_ATOMIC_CMPSET_32 || OPAL_HAVE_ATOMIC_CMPSET_64)
#define OMPI_NEED_INLINE_ATOMIC_SPINLOCKS #define OPAL_NEED_INLINE_ATOMIC_SPINLOCKS
#endif #endif
#endif /* OMPI_HAVE_ATOMIC_SPINLOCKS */ #endif /* OPAL_HAVE_ATOMIC_SPINLOCKS */
/********************************************************************** /**********************************************************************
@ -267,91 +267,91 @@ void ompi_atomic_unlock(ompi_lock_t *lock);
* Atomic math operations * Atomic math operations
* *
*********************************************************************/ *********************************************************************/
#if !defined(OMPI_HAVE_ATOMIC_CMPSET_32) && !defined(DOXYGEN) #if !defined(OPAL_HAVE_ATOMIC_CMPSET_32) && !defined(DOXYGEN)
#define OMPI_HAVE_ATOMIC_CMPSET_32 0 #define OPAL_HAVE_ATOMIC_CMPSET_32 0
#endif #endif
#if defined(DOXYGEN) || OMPI_HAVE_ATOMIC_CMPSET_32 #if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_CMPSET_32
int ompi_atomic_cmpset_32(volatile int32_t *addr, int32_t oldval, int opal_atomic_cmpset_32(volatile int32_t *addr, int32_t oldval,
int32_t newval); int32_t newval);
int ompi_atomic_cmpset_acq_32(volatile int32_t *addr, int32_t oldval, int opal_atomic_cmpset_acq_32(volatile int32_t *addr, int32_t oldval,
int32_t newval); int32_t newval);
int ompi_atomic_cmpset_rel_32(volatile int32_t *addr, int32_t oldval, int opal_atomic_cmpset_rel_32(volatile int32_t *addr, int32_t oldval,
int32_t newval); int32_t newval);
#endif #endif
#if !defined(OMPI_HAVE_ATOMIC_CMPSET_64) && !defined(DOXYGEN) #if !defined(OPAL_HAVE_ATOMIC_CMPSET_64) && !defined(DOXYGEN)
#define OMPI_HAVE_ATOMIC_CMPSET_64 0 #define OPAL_HAVE_ATOMIC_CMPSET_64 0
#endif #endif
#if defined(DOXYGEN) || OMPI_HAVE_ATOMIC_CMPSET_64 #if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_CMPSET_64
int ompi_atomic_cmpset_64(volatile int64_t *addr, int64_t oldval, int opal_atomic_cmpset_64(volatile int64_t *addr, int64_t oldval,
int64_t newval); int64_t newval);
int ompi_atomic_cmpset_acq_64(volatile int64_t *addr, int64_t oldval, int opal_atomic_cmpset_acq_64(volatile int64_t *addr, int64_t oldval,
int64_t newval); int64_t newval);
int ompi_atomic_cmpset_rel_64(volatile int64_t *addr, int64_t oldval, int opal_atomic_cmpset_rel_64(volatile int64_t *addr, int64_t oldval,
int64_t newval); int64_t newval);
#endif #endif
#if !defined(OMPI_HAVE_ATOMIC_MATH_32) && !defined(DOXYGEN) #if !defined(OPAL_HAVE_ATOMIC_MATH_32) && !defined(DOXYGEN)
/* define to 0 for these tests. WIll fix up later. */ /* define to 0 for these tests. WIll fix up later. */
#define OMPI_HAVE_ATOMIC_MATH_32 0 #define OPAL_HAVE_ATOMIC_MATH_32 0
#endif #endif
#if defined(DOXYGEN) || OMPI_HAVE_ATOMIC_MATH_32 || OMPI_HAVE_ATOMIC_CMPSET_32 #if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_MATH_32 || OPAL_HAVE_ATOMIC_CMPSET_32
#if ! OMPI_HAVE_ATOMIC_MATH_32 #if ! OPAL_HAVE_ATOMIC_MATH_32
static inline static inline
#endif #endif
int32_t ompi_atomic_add_32(volatile int32_t *addr, int delta); int32_t opal_atomic_add_32(volatile int32_t *addr, int delta);
#if ! OMPI_HAVE_ATOMIC_MATH_32 #if ! OPAL_HAVE_ATOMIC_MATH_32
static inline static inline
#endif #endif
int32_t ompi_atomic_sub_32(volatile int32_t *addr, int delta); int32_t opal_atomic_sub_32(volatile int32_t *addr, int delta);
#endif /* OMPI_HAVE_ATOMIC_MATH_32 */ #endif /* OPAL_HAVE_ATOMIC_MATH_32 */
#if ! OMPI_HAVE_ATOMIC_MATH_32 #if ! OPAL_HAVE_ATOMIC_MATH_32
/* fix up the value of ompi_have_atomic_math_32 to allow for C versions */ /* fix up the value of ompi_have_atomic_math_32 to allow for C versions */
#undef OMPI_HAVE_ATOMIC_MATH_32 #undef OPAL_HAVE_ATOMIC_MATH_32
#define OMPI_HAVE_ATOMIC_MATH_32 OMPI_HAVE_ATOMIC_CMPSET_32 #define OPAL_HAVE_ATOMIC_MATH_32 OPAL_HAVE_ATOMIC_CMPSET_32
#endif #endif
#ifndef OMPI_HAVE_ATOMIC_MATH_64 #ifndef OPAL_HAVE_ATOMIC_MATH_64
/* define to 0 for these tests. WIll fix up later. */ /* define to 0 for these tests. WIll fix up later. */
#define OMPI_HAVE_ATOMIC_MATH_64 0 #define OPAL_HAVE_ATOMIC_MATH_64 0
#endif #endif
#if defined(DOXYGEN) || OMPI_HAVE_ATOMIC_MATH_64 || OMPI_HAVE_ATOMIC_CMPSET_64 #if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_MATH_64 || OPAL_HAVE_ATOMIC_CMPSET_64
#if OMPI_HAVE_ATOMIC_CMPSET_64 #if OPAL_HAVE_ATOMIC_CMPSET_64
static inline static inline
#endif #endif
int64_t ompi_atomic_add_64(volatile int64_t *addr, int64_t delta); int64_t opal_atomic_add_64(volatile int64_t *addr, int64_t delta);
#if OMPI_HAVE_ATOMIC_CMPSET_64 #if OPAL_HAVE_ATOMIC_CMPSET_64
static inline static inline
#endif #endif
int64_t ompi_atomic_sub_64(volatile int64_t *addr, int64_t delta); int64_t opal_atomic_sub_64(volatile int64_t *addr, int64_t delta);
#endif /* OMPI_HAVE_ATOMIC_MATH_32 */ #endif /* OPAL_HAVE_ATOMIC_MATH_32 */
#if ! OMPI_HAVE_ATOMIC_MATH_64 #if ! OPAL_HAVE_ATOMIC_MATH_64
/* fix up the value of ompi_have_atomic_math_64 to allow for C versions */ /* fix up the value of ompi_have_atomic_math_64 to allow for C versions */
#undef OMPI_HAVE_ATOMIC_MATH_64 #undef OPAL_HAVE_ATOMIC_MATH_64
#define OMPI_HAVE_ATOMIC_MATH_64 OMPI_HAVE_ATOMIC_CMPSET_64 #define OPAL_HAVE_ATOMIC_MATH_64 OPAL_HAVE_ATOMIC_CMPSET_64
#endif #endif
#if defined(DOXYGEN) || (OMPI_HAVE_ATOMIC_CMPSET_32 || OMPI_HAVE_ATOMIC_CMPSET_64) #if defined(DOXYGEN) || (OPAL_HAVE_ATOMIC_CMPSET_32 || OPAL_HAVE_ATOMIC_CMPSET_64)
/* these are always done with inline functions, so always mark as /* these are always done with inline functions, so always mark as
static inline */ static inline */
static inline int ompi_atomic_cmpset_xx(volatile void* addr, int64_t oldval, static inline int opal_atomic_cmpset_xx(volatile void* addr, int64_t oldval,
int64_t newval, size_t length); int64_t newval, size_t length);
static inline int ompi_atomic_cmpset_acq_xx(volatile void* addr, static inline int opal_atomic_cmpset_acq_xx(volatile void* addr,
int64_t oldval, int64_t newval, int64_t oldval, int64_t newval,
size_t length); size_t length);
static inline int ompi_atomic_cmpset_rel_xx(volatile void* addr, static inline int opal_atomic_cmpset_rel_xx(volatile void* addr,
int64_t oldval, int64_t newval, int64_t oldval, int64_t newval,
size_t length); size_t length);
static inline int ompi_atomic_cmpset_ptr(volatile void* addr, static inline int opal_atomic_cmpset_ptr(volatile void* addr,
void* oldval, void* oldval,
void* newval); void* newval);
static inline int ompi_atomic_cmpset_acq_ptr(volatile void* addr, static inline int opal_atomic_cmpset_acq_ptr(volatile void* addr,
void* oldval, void* oldval,
void* newval); void* newval);
static inline int ompi_atomic_cmpset_rel_ptr(volatile void* addr, static inline int opal_atomic_cmpset_rel_ptr(volatile void* addr,
void* oldval, void* oldval,
void* newval); void* newval);
@ -366,10 +366,10 @@ static inline int ompi_atomic_cmpset_rel_ptr(volatile void* addr,
* @param oldval Comparison value <TYPE>. * @param oldval Comparison value <TYPE>.
* @param newval New value to set if comparision is true <TYPE>. * @param newval New value to set if comparision is true <TYPE>.
* *
* See ompi_atomic_cmpset_* for pseudo-code. * See opal_atomic_cmpset_* for pseudo-code.
*/ */
#define ompi_atomic_cmpset( ADDR, OLDVAL, NEWVAL ) \ #define opal_atomic_cmpset( ADDR, OLDVAL, NEWVAL ) \
ompi_atomic_cmpset_xx( (volatile void*)(ADDR), (int64_t)(OLDVAL), \ opal_atomic_cmpset_xx( (volatile void*)(ADDR), (int64_t)(OLDVAL), \
(int64_t)(NEWVAL), sizeof(*(ADDR)) ) (int64_t)(NEWVAL), sizeof(*(ADDR)) )
/** /**
@ -383,10 +383,10 @@ static inline int ompi_atomic_cmpset_rel_ptr(volatile void* addr,
* @param oldval Comparison value <TYPE>. * @param oldval Comparison value <TYPE>.
* @param newval New value to set if comparision is true <TYPE>. * @param newval New value to set if comparision is true <TYPE>.
* *
* See ompi_atomic_cmpset_acq_* for pseudo-code. * See opal_atomic_cmpset_acq_* for pseudo-code.
*/ */
#define ompi_atomic_cmpset_acq( ADDR, OLDVAL, NEWVAL ) \ #define opal_atomic_cmpset_acq( ADDR, OLDVAL, NEWVAL ) \
ompi_atomic_cmpset_acq_xx( (volatile void*)(ADDR), (int64_t)(OLDVAL), \ opal_atomic_cmpset_acq_xx( (volatile void*)(ADDR), (int64_t)(OLDVAL), \
(int64_t)(NEWVAL), sizeof(*(ADDR)) ) (int64_t)(NEWVAL), sizeof(*(ADDR)) )
@ -401,23 +401,23 @@ static inline int ompi_atomic_cmpset_rel_ptr(volatile void* addr,
* @param oldval Comparison value <TYPE>. * @param oldval Comparison value <TYPE>.
* @param newval New value to set if comparision is true <TYPE>. * @param newval New value to set if comparision is true <TYPE>.
* *
* See ompi_atomic_cmpsetrel_* for pseudo-code. * See opal_atomic_cmpsetrel_* for pseudo-code.
*/ */
#define ompi_atomic_cmpset_rel( ADDR, OLDVAL, NEWVAL ) \ #define opal_atomic_cmpset_rel( ADDR, OLDVAL, NEWVAL ) \
ompi_atomic_cmpset_rel_xx( (volatile void*)(ADDR), (int64_t)(OLDVAL), \ opal_atomic_cmpset_rel_xx( (volatile void*)(ADDR), (int64_t)(OLDVAL), \
(int64_t)(NEWVAL), sizeof(*(ADDR)) ) (int64_t)(NEWVAL), sizeof(*(ADDR)) )
#endif /* (OMPI_HAVE_ATOMIC_CMPSET_32 || OMPI_HAVE_ATOMIC_CMPSET_64) */ #endif /* (OPAL_HAVE_ATOMIC_CMPSET_32 || OPAL_HAVE_ATOMIC_CMPSET_64) */
#if defined(DOXYGEN) || (OMPI_HAVE_ATOMIC_MATH_32 || OMPI_HAVE_ATOMIC_MATH_64) #if defined(DOXYGEN) || (OPAL_HAVE_ATOMIC_MATH_32 || OPAL_HAVE_ATOMIC_MATH_64)
static inline void ompi_atomic_add_xx(volatile void* addr, static inline void opal_atomic_add_xx(volatile void* addr,
int32_t value, size_t length); int32_t value, size_t length);
static inline void ompi_atomic_sub_xx(volatile void* addr, static inline void opal_atomic_sub_xx(volatile void* addr,
int32_t value, size_t length); int32_t value, size_t length);
static inline int ompi_atomic_add_pt(volatile void* addr, static inline int opal_atomic_add_pt(volatile void* addr,
void* delta); void* delta);
static inline int ompi_atomic_sub_ptr(volatile void* addr, static inline int opal_atomic_sub_ptr(volatile void* addr,
void* delta); void* delta);
/** /**
@ -430,8 +430,8 @@ static inline int ompi_atomic_sub_ptr(volatile void* addr,
* @param addr Address of <TYPE> * @param addr Address of <TYPE>
* @param delta Value to add (converted to <TYPE>). * @param delta Value to add (converted to <TYPE>).
*/ */
#define ompi_atomic_add( ADDR, VALUE ) \ #define opal_atomic_add( ADDR, VALUE ) \
ompi_atomic_add_xx( (volatile void*)(ADDR), (int32_t)(VALUE), \ opal_atomic_add_xx( (volatile void*)(ADDR), (int32_t)(VALUE), \
sizeof(*(ADDR)) ) sizeof(*(ADDR)) )
/** /**
@ -444,11 +444,11 @@ static inline int ompi_atomic_sub_ptr(volatile void* addr,
* @param addr Address of <TYPE> * @param addr Address of <TYPE>
* @param delta Value to substract (converted to <TYPE>). * @param delta Value to substract (converted to <TYPE>).
*/ */
#define ompi_atomic_sub( ADDR, VALUE ) \ #define opal_atomic_sub( ADDR, VALUE ) \
ompi_atomic_sub_xx( (volatile void*)(ADDR), (int32_t)(VALUE), \ opal_atomic_sub_xx( (volatile void*)(ADDR), (int32_t)(VALUE), \
sizeof(*(ADDR)) ) sizeof(*(ADDR)) )
#endif /* OMPI_HAVE_ATOMIC_MATH_32 || OMPI_HAVE_ATOMIC_MATH_64 */ #endif /* OPAL_HAVE_ATOMIC_MATH_32 || OPAL_HAVE_ATOMIC_MATH_64 */
/********************************************************************** /**********************************************************************
@ -467,4 +467,4 @@ static inline int ompi_atomic_sub_ptr(volatile void* addr,
#endif /* OMPI_SYS_ATOMIC_H */ #endif /* OPAL_SYS_ATOMIC_H */

Просмотреть файл

@ -30,92 +30,92 @@
* undefine all those functions if there is no 64 bit cmpset * undefine all those functions if there is no 64 bit cmpset
* *
*********************************************************************/ *********************************************************************/
#if OMPI_HAVE_ATOMIC_CMPSET_32 #if OPAL_HAVE_ATOMIC_CMPSET_32
#if !defined(OMPI_HAVE_ATOMIC_ADD_32) #if !defined(OPAL_HAVE_ATOMIC_ADD_32)
#define OMPI_HAVE_ATOMIC_ADD_32 1 #define OPAL_HAVE_ATOMIC_ADD_32 1
static inline int32_t static inline int32_t
ompi_atomic_add_32(volatile int32_t *addr, int delta) opal_atomic_add_32(volatile int32_t *addr, int delta)
{ {
int32_t oldval; int32_t oldval;
do { do {
oldval = *addr; oldval = *addr;
} while (0 == ompi_atomic_cmpset_32(addr, oldval, oldval + delta)); } while (0 == opal_atomic_cmpset_32(addr, oldval, oldval + delta));
return (oldval + delta); return (oldval + delta);
} }
#endif /* OMPI_HAVE_ATOMIC_CMPSET_32 */ #endif /* OPAL_HAVE_ATOMIC_CMPSET_32 */
#if !defined(OMPI_HAVE_ATOMIC_SUB_32) #if !defined(OPAL_HAVE_ATOMIC_SUB_32)
#define OMPI_HAVE_ATOMIC_SUB_32 1 #define OPAL_HAVE_ATOMIC_SUB_32 1
static inline int32_t static inline int32_t
ompi_atomic_sub_32(volatile int32_t *addr, int delta) opal_atomic_sub_32(volatile int32_t *addr, int delta)
{ {
int32_t oldval; int32_t oldval;
do { do {
oldval = *addr; oldval = *addr;
} while (0 == ompi_atomic_cmpset_32(addr, oldval, oldval - delta)); } while (0 == opal_atomic_cmpset_32(addr, oldval, oldval - delta));
return (oldval - delta); return (oldval - delta);
} }
#endif /* OMPI_HAVE_ATOMIC_SUB_32 */ #endif /* OPAL_HAVE_ATOMIC_SUB_32 */
#endif /* OMPI_HAVE_ATOMIC_CMPSET_32 */ #endif /* OPAL_HAVE_ATOMIC_CMPSET_32 */
#if OMPI_HAVE_ATOMIC_CMPSET_64 #if OPAL_HAVE_ATOMIC_CMPSET_64
#if !defined(OMPI_HAVE_ATOMIC_ADD_64) #if !defined(OPAL_HAVE_ATOMIC_ADD_64)
#define OMPI_HAVE_ATOMIC_ADD_64 1 #define OPAL_HAVE_ATOMIC_ADD_64 1
static inline int64_t static inline int64_t
ompi_atomic_add_64(volatile int64_t *addr, int64_t delta) opal_atomic_add_64(volatile int64_t *addr, int64_t delta)
{ {
int64_t oldval; int64_t oldval;
do { do {
oldval = *addr; oldval = *addr;
} while (0 == ompi_atomic_cmpset_64(addr, oldval, oldval + delta)); } while (0 == opal_atomic_cmpset_64(addr, oldval, oldval + delta));
return (oldval + delta); return (oldval + delta);
} }
#endif /* OMPI_HAVE_ATOMIC_ADD_64 */ #endif /* OPAL_HAVE_ATOMIC_ADD_64 */
#if !defined(OMPI_HAVE_ATOMIC_SUB_64) #if !defined(OPAL_HAVE_ATOMIC_SUB_64)
#define OMPI_HAVE_ATOMIC_SUB_64 1 #define OPAL_HAVE_ATOMIC_SUB_64 1
static inline int64_t static inline int64_t
ompi_atomic_sub_64(volatile int64_t *addr, int64_t delta) opal_atomic_sub_64(volatile int64_t *addr, int64_t delta)
{ {
int64_t oldval; int64_t oldval;
do { do {
oldval = *addr; oldval = *addr;
} while (0 == ompi_atomic_cmpset_64(addr, oldval, oldval - delta)); } while (0 == opal_atomic_cmpset_64(addr, oldval, oldval - delta));
return (oldval - delta); return (oldval - delta);
} }
#endif /* OMPI_HAVE_ATOMIC_SUB_64 */ #endif /* OPAL_HAVE_ATOMIC_SUB_64 */
#endif /* OMPI_HAVE_ATOMIC_CMPSET_64 */ #endif /* OPAL_HAVE_ATOMIC_CMPSET_64 */
#if (OMPI_HAVE_ATOMIC_CMPSET_32 || OMPI_HAVE_ATOMIC_CMPSET_64) #if (OPAL_HAVE_ATOMIC_CMPSET_32 || OPAL_HAVE_ATOMIC_CMPSET_64)
static inline int static inline int
ompi_atomic_cmpset_xx(volatile void* addr, int64_t oldval, opal_atomic_cmpset_xx(volatile void* addr, int64_t oldval,
int64_t newval, size_t length) int64_t newval, size_t length)
{ {
switch( length ) { switch( length ) {
#if OMPI_HAVE_ATOMIC_CMPSET_32 #if OPAL_HAVE_ATOMIC_CMPSET_32
case 4: case 4:
return ompi_atomic_cmpset_32( (volatile int32_t*)addr, return opal_atomic_cmpset_32( (volatile int32_t*)addr,
(int32_t)oldval, (int32_t)newval ); (int32_t)oldval, (int32_t)newval );
#endif /* OMPI_HAVE_ATOMIC_CMPSET_32 */ #endif /* OPAL_HAVE_ATOMIC_CMPSET_32 */
#if OMPI_HAVE_ATOMIC_CMPSET_64 #if OPAL_HAVE_ATOMIC_CMPSET_64
case 8: case 8:
return ompi_atomic_cmpset_64( (volatile int64_t*)addr, return opal_atomic_cmpset_64( (volatile int64_t*)addr,
(int64_t)oldval, (int64_t)newval ); (int64_t)oldval, (int64_t)newval );
#endif /* OMPI_HAVE_ATOMIC_CMPSET_64 */ #endif /* OPAL_HAVE_ATOMIC_CMPSET_64 */
default: default:
/* This should never happen, so deliberately cause a seg fault /* This should never happen, so deliberately cause a seg fault
for corefile analysis */ for corefile analysis */
@ -126,21 +126,21 @@ ompi_atomic_cmpset_xx(volatile void* addr, int64_t oldval,
static inline int static inline int
ompi_atomic_cmpset_acq_xx(volatile void* addr, int64_t oldval, opal_atomic_cmpset_acq_xx(volatile void* addr, int64_t oldval,
int64_t newval, size_t length) int64_t newval, size_t length)
{ {
switch( length ) { switch( length ) {
#if OMPI_HAVE_ATOMIC_CMPSET_32 #if OPAL_HAVE_ATOMIC_CMPSET_32
case 4: case 4:
return ompi_atomic_cmpset_acq_32( (volatile int32_t*)addr, return opal_atomic_cmpset_acq_32( (volatile int32_t*)addr,
(int32_t)oldval, (int32_t)newval ); (int32_t)oldval, (int32_t)newval );
#endif /* OMPI_HAVE_ATOMIC_CMPSET_32 */ #endif /* OPAL_HAVE_ATOMIC_CMPSET_32 */
#if OMPI_HAVE_ATOMIC_CMPSET_64 #if OPAL_HAVE_ATOMIC_CMPSET_64
case 8: case 8:
return ompi_atomic_cmpset_acq_64( (volatile int64_t*)addr, return opal_atomic_cmpset_acq_64( (volatile int64_t*)addr,
(int64_t)oldval, (int64_t)newval ); (int64_t)oldval, (int64_t)newval );
#endif /* OMPI_HAVE_ATOMIC_CMPSET_64 */ #endif /* OPAL_HAVE_ATOMIC_CMPSET_64 */
default: default:
/* This should never happen, so deliberately cause a seg fault /* This should never happen, so deliberately cause a seg fault
for corefile analysis */ for corefile analysis */
@ -151,21 +151,21 @@ ompi_atomic_cmpset_acq_xx(volatile void* addr, int64_t oldval,
static inline int static inline int
ompi_atomic_cmpset_rel_xx(volatile void* addr, int64_t oldval, opal_atomic_cmpset_rel_xx(volatile void* addr, int64_t oldval,
int64_t newval, size_t length) int64_t newval, size_t length)
{ {
switch( length ) { switch( length ) {
#if OMPI_HAVE_ATOMIC_CMPSET_32 #if OPAL_HAVE_ATOMIC_CMPSET_32
case 4: case 4:
return ompi_atomic_cmpset_rel_32( (volatile int32_t*)addr, return opal_atomic_cmpset_rel_32( (volatile int32_t*)addr,
(int32_t)oldval, (int32_t)newval ); (int32_t)oldval, (int32_t)newval );
#endif /* OMPI_HAVE_ATOMIC_CMPSET_32 */ #endif /* OPAL_HAVE_ATOMIC_CMPSET_32 */
#if OMPI_HAVE_ATOMIC_CMPSET_64 #if OPAL_HAVE_ATOMIC_CMPSET_64
case 8: case 8:
return ompi_atomic_cmpset_rel_64( (volatile int64_t*)addr, return opal_atomic_cmpset_rel_64( (volatile int64_t*)addr,
(int64_t)oldval, (int64_t)newval ); (int64_t)oldval, (int64_t)newval );
#endif /* OMPI_HAVE_ATOMIC_CMPSET_64 */ #endif /* OPAL_HAVE_ATOMIC_CMPSET_64 */
default: default:
/* This should never happen, so deliberately cause a seg fault /* This should never happen, so deliberately cause a seg fault
for corefile analysis */ for corefile analysis */
@ -176,15 +176,15 @@ ompi_atomic_cmpset_rel_xx(volatile void* addr, int64_t oldval,
static inline int static inline int
ompi_atomic_cmpset_ptr(volatile void* addr, opal_atomic_cmpset_ptr(volatile void* addr,
void* oldval, void* oldval,
void* newval) void* newval)
{ {
#if SIZEOF_VOID_P == 4 && OMPI_HAVE_ATOMIC_CMPSET_32 #if SIZEOF_VOID_P == 4 && OPAL_HAVE_ATOMIC_CMPSET_32
return ompi_atomic_cmpset_32((int32_t*) addr, (unsigned long) oldval, return opal_atomic_cmpset_32((int32_t*) addr, (unsigned long) oldval,
(unsigned long) newval); (unsigned long) newval);
#elif SIZEOF_VOID_P == 8 && OMPI_HAVE_ATOMIC_CMPSET_64 #elif SIZEOF_VOID_P == 8 && OPAL_HAVE_ATOMIC_CMPSET_64
return ompi_atomic_cmpset_64((int64_t*) addr, (unsigned long) oldval, return opal_atomic_cmpset_64((int64_t*) addr, (unsigned long) oldval,
(unsigned long) newval); (unsigned long) newval);
#else #else
abort(); abort();
@ -194,15 +194,15 @@ ompi_atomic_cmpset_ptr(volatile void* addr,
static inline int static inline int
ompi_atomic_cmpset_acq_ptr(volatile void* addr, opal_atomic_cmpset_acq_ptr(volatile void* addr,
void* oldval, void* oldval,
void* newval) void* newval)
{ {
#if SIZEOF_VOID_P == 4 && OMPI_HAVE_ATOMIC_CMPSET_32 #if SIZEOF_VOID_P == 4 && OPAL_HAVE_ATOMIC_CMPSET_32
return ompi_atomic_cmpset_acq_32((int32_t*) addr, (unsigned long) oldval, return opal_atomic_cmpset_acq_32((int32_t*) addr, (unsigned long) oldval,
(unsigned long) newval); (unsigned long) newval);
#elif SIZEOF_VOID_P == 8 && OMPI_HAVE_ATOMIC_CMPSET_64 #elif SIZEOF_VOID_P == 8 && OPAL_HAVE_ATOMIC_CMPSET_64
return ompi_atomic_cmpset_acq_64((int64_t*) addr, (unsigned long) oldval, return opal_atomic_cmpset_acq_64((int64_t*) addr, (unsigned long) oldval,
(unsigned long) newval); (unsigned long) newval);
#else #else
abort(); abort();
@ -211,15 +211,15 @@ ompi_atomic_cmpset_acq_ptr(volatile void* addr,
} }
static inline int ompi_atomic_cmpset_rel_ptr(volatile void* addr, static inline int opal_atomic_cmpset_rel_ptr(volatile void* addr,
void* oldval, void* oldval,
void* newval) void* newval)
{ {
#if SIZEOF_VOID_P == 4 && OMPI_HAVE_ATOMIC_CMPSET_32 #if SIZEOF_VOID_P == 4 && OPAL_HAVE_ATOMIC_CMPSET_32
return ompi_atomic_cmpset_rel_32((int32_t*) addr, (unsigned long) oldval, return opal_atomic_cmpset_rel_32((int32_t*) addr, (unsigned long) oldval,
(unsigned long) newval); (unsigned long) newval);
#elif SIZEOF_VOID_P == 8 && OMPI_HAVE_ATOMIC_CMPSET_64 #elif SIZEOF_VOID_P == 8 && OPAL_HAVE_ATOMIC_CMPSET_64
return ompi_atomic_cmpset_rel_64((int64_t*) addr, (unsigned long) oldval, return opal_atomic_cmpset_rel_64((int64_t*) addr, (unsigned long) oldval,
(unsigned long) newval); (unsigned long) newval);
#else #else
abort(); abort();
@ -227,26 +227,26 @@ static inline int ompi_atomic_cmpset_rel_ptr(volatile void* addr,
#endif #endif
} }
#endif /* (OMPI_HAVE_ATOMIC_CMPSET_32 || OMPI_HAVE_ATOMIC_CMPSET_64) */ #endif /* (OPAL_HAVE_ATOMIC_CMPSET_32 || OPAL_HAVE_ATOMIC_CMPSET_64) */
#if OMPI_HAVE_ATOMIC_MATH_32 || OMPI_HAVE_ATOMIC_MATH_64 #if OPAL_HAVE_ATOMIC_MATH_32 || OPAL_HAVE_ATOMIC_MATH_64
static inline void static inline void
ompi_atomic_add_xx(volatile void* addr, int32_t value, size_t length) opal_atomic_add_xx(volatile void* addr, int32_t value, size_t length)
{ {
switch( length ) { switch( length ) {
#if OMPI_HAVE_ATOMIC_CMPSET_32 #if OPAL_HAVE_ATOMIC_CMPSET_32
case 4: case 4:
ompi_atomic_add_32( (volatile int32_t*)addr, (int32_t)value ); opal_atomic_add_32( (volatile int32_t*)addr, (int32_t)value );
break; break;
#endif /* OMPI_HAVE_ATOMIC_CMPSET_32 */ #endif /* OPAL_HAVE_ATOMIC_CMPSET_32 */
#if OMPI_HAVE_ATOMIC_CMPSET_64 #if OPAL_HAVE_ATOMIC_CMPSET_64
case 8: case 8:
ompi_atomic_add_64( (volatile int64_t*)addr, (int64_t)value ); opal_atomic_add_64( (volatile int64_t*)addr, (int64_t)value );
break; break;
#endif /* OMPI_HAVE_ATOMIC_CMPSET_64 */ #endif /* OPAL_HAVE_ATOMIC_CMPSET_64 */
default: default:
/* This should never happen, so deliberately cause a seg fault /* This should never happen, so deliberately cause a seg fault
for corefile analysis */ for corefile analysis */
@ -256,20 +256,20 @@ ompi_atomic_add_xx(volatile void* addr, int32_t value, size_t length)
static inline void static inline void
ompi_atomic_sub_xx(volatile void* addr, int32_t value, size_t length) opal_atomic_sub_xx(volatile void* addr, int32_t value, size_t length)
{ {
switch( length ) { switch( length ) {
#if OMPI_HAVE_ATOMIC_CMPSET_32 #if OPAL_HAVE_ATOMIC_CMPSET_32
case 4: case 4:
ompi_atomic_sub_32( (volatile int32_t*)addr, (int32_t)value ); opal_atomic_sub_32( (volatile int32_t*)addr, (int32_t)value );
break; break;
#endif /* OMPI_HAVE_ATOMIC_CMPSET_32 */ #endif /* OPAL_HAVE_ATOMIC_CMPSET_32 */
#if OMPI_HAVE_ATOMIC_CMPSET_64 #if OPAL_HAVE_ATOMIC_CMPSET_64
case 8: case 8:
ompi_atomic_sub_64( (volatile int64_t*)addr, (int64_t)value ); opal_atomic_sub_64( (volatile int64_t*)addr, (int64_t)value );
break; break;
#endif /* OMPI_HAVE_ATOMIC_CMPSET_64 */ #endif /* OPAL_HAVE_ATOMIC_CMPSET_64 */
default: default:
/* This should never happen, so deliberately cause a seg fault /* This should never happen, so deliberately cause a seg fault
for corefile analysis */ for corefile analysis */
@ -277,13 +277,13 @@ ompi_atomic_sub_xx(volatile void* addr, int32_t value, size_t length)
} }
} }
static inline int ompi_atomic_add_pt(volatile void* addr, static inline int opal_atomic_add_pt(volatile void* addr,
void* delta) void* delta)
{ {
#if SIZEOF_VOID_P == 4 && OMPI_HAVE_ATOMIC_CMPSET_32 #if SIZEOF_VOID_P == 4 && OPAL_HAVE_ATOMIC_CMPSET_32
return ompi_atomic_add_32((int32_t*) addr, (unsigned long) delta); return opal_atomic_add_32((int32_t*) addr, (unsigned long) delta);
#elif SIZEOF_VOID_P == 8 && OMPI_HAVE_ATOMIC_CMPSET_64 #elif SIZEOF_VOID_P == 8 && OPAL_HAVE_ATOMIC_CMPSET_64
return ompi_atomic_add_64((int64_t*) addr, (unsigned long) delta); return opal_atomic_add_64((int64_t*) addr, (unsigned long) delta);
#else #else
abort(); abort();
return 0; return 0;
@ -291,52 +291,52 @@ static inline int ompi_atomic_add_pt(volatile void* addr,
} }
static inline int ompi_atomic_sub_ptr(volatile void* addr, static inline int opal_atomic_sub_ptr(volatile void* addr,
void* delta) void* delta)
{ {
#if SIZEOF_VOID_P == 4 && OMPI_HAVE_ATOMIC_CMPSET_32 #if SIZEOF_VOID_P == 4 && OPAL_HAVE_ATOMIC_CMPSET_32
return ompi_atomic_sub_32((int32_t*) addr, (unsigned long) delta); return opal_atomic_sub_32((int32_t*) addr, (unsigned long) delta);
#elif SIZEOF_VOID_P == 8 && OMPI_HAVE_ATOMIC_CMPSET_64 #elif SIZEOF_VOID_P == 8 && OPAL_HAVE_ATOMIC_CMPSET_64
return ompi_atomic_sub_64((int64_t*) addr, (unsigned long) delta); return opal_atomic_sub_64((int64_t*) addr, (unsigned long) delta);
#else #else
abort(); abort();
return 0; return 0;
#endif #endif
} }
#endif /* OMPI_HAVE_ATOMIC_MATH_32 || OMPI_HAVE_ATOMIC_MATH_64 */ #endif /* OPAL_HAVE_ATOMIC_MATH_32 || OPAL_HAVE_ATOMIC_MATH_64 */
/********************************************************************** /**********************************************************************
* *
* Atomic spinlocks * Atomic spinlocks
* *
*********************************************************************/ *********************************************************************/
#ifdef OMPI_NEED_INLINE_ATOMIC_SPINLOCKS #ifdef OPAL_NEED_INLINE_ATOMIC_SPINLOCKS
/* /*
* Lock initialization function. It set the lock to UNLOCKED. * Lock initialization function. It set the lock to UNLOCKED.
*/ */
static inline void static inline void
ompi_atomic_init( ompi_lock_t* lock, int value ) opal_atomic_init( opal_atomic_lock_t* lock, int value )
{ {
lock->u.lock = value; lock->u.lock = value;
} }
static inline int static inline int
ompi_atomic_trylock(ompi_lock_t *lock) opal_atomic_trylock(opal_atomic_lock_t *lock)
{ {
return ompi_atomic_cmpset_acq( &(lock->u.lock), return opal_atomic_cmpset_acq( &(lock->u.lock),
OMPI_ATOMIC_UNLOCKED, OMPI_ATOMIC_LOCKED); OPAL_ATOMIC_UNLOCKED, OPAL_ATOMIC_LOCKED);
} }
static inline void static inline void
ompi_atomic_lock(ompi_lock_t *lock) opal_atomic_lock(opal_atomic_lock_t *lock)
{ {
while( !ompi_atomic_cmpset_acq( &(lock->u.lock), while( !opal_atomic_cmpset_acq( &(lock->u.lock),
OMPI_ATOMIC_UNLOCKED, OMPI_ATOMIC_LOCKED) ) { OPAL_ATOMIC_UNLOCKED, OPAL_ATOMIC_LOCKED) ) {
while (lock->u.lock == OMPI_ATOMIC_LOCKED) { while (lock->u.lock == OPAL_ATOMIC_LOCKED) {
/* spin */ ; /* spin */ ;
} }
} }
@ -344,13 +344,13 @@ ompi_atomic_lock(ompi_lock_t *lock)
static inline void static inline void
ompi_atomic_unlock(ompi_lock_t *lock) opal_atomic_unlock(opal_atomic_lock_t *lock)
{ {
/* /*
ompi_atomic_cmpset_rel( &(lock->u.lock), opal_atomic_cmpset_rel( &(lock->u.lock),
OMPI_ATOMIC_LOCKED, OMPI_ATOMIC_UNLOCKED); OPAL_ATOMIC_LOCKED, OPAL_ATOMIC_UNLOCKED);
*/ */
lock->u.lock=OMPI_ATOMIC_UNLOCKED; lock->u.lock=OPAL_ATOMIC_UNLOCKED;
} }
#endif /* OMPI_HAVE_ATOMIC_SPINLOCKS */ #endif /* OPAL_HAVE_ATOMIC_SPINLOCKS */

Просмотреть файл

@ -35,15 +35,15 @@
* Define constants for IA32 * Define constants for IA32
* *
*********************************************************************/ *********************************************************************/
#define OMPI_HAVE_ATOMIC_MEM_BARRIER 1 #define OPAL_HAVE_ATOMIC_MEM_BARRIER 1
#define OMPI_HAVE_ATOMIC_CMPSET_32 1 #define OPAL_HAVE_ATOMIC_CMPSET_32 1
#define OMPI_HAVE_ATOMIC_MATH_32 1 #define OPAL_HAVE_ATOMIC_MATH_32 1
#define OMPI_HAVE_ATOMIC_ADD_32 1 #define OPAL_HAVE_ATOMIC_ADD_32 1
#define OMPI_HAVE_ATOMIC_SUB_32 1 #define OPAL_HAVE_ATOMIC_SUB_32 1
#define OMPI_HAVE_ATOMIC_CMPSET_64 1 #define OPAL_HAVE_ATOMIC_CMPSET_64 1
/********************************************************************** /**********************************************************************
@ -53,19 +53,19 @@
*********************************************************************/ *********************************************************************/
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline void ompi_atomic_mb(void) static inline void opal_atomic_mb(void)
{ {
MB(); MB();
} }
static inline void ompi_atomic_rmb(void) static inline void opal_atomic_rmb(void)
{ {
MB(); MB();
} }
static inline void ompi_atomic_wmb(void) static inline void opal_atomic_wmb(void)
{ {
MB(); MB();
} }
@ -80,7 +80,7 @@ static inline void ompi_atomic_wmb(void)
*********************************************************************/ *********************************************************************/
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline int ompi_atomic_cmpset_32(volatile int32_t *addr, static inline int opal_atomic_cmpset_32(volatile int32_t *addr,
int32_t oldval, int32_t oldval,
int32_t newval) int32_t newval)
{ {
@ -97,8 +97,8 @@ static inline int ompi_atomic_cmpset_32(volatile int32_t *addr,
#endif /* OMPI_GCC_INLINE_ASSEMBLY */ #endif /* OMPI_GCC_INLINE_ASSEMBLY */
#define ompi_atomic_cmpset_acq_32 ompi_atomic_cmpset_32 #define opal_atomic_cmpset_acq_32 opal_atomic_cmpset_32
#define ompi_atomic_cmpset_rel_32 ompi_atomic_cmpset_32 #define opal_atomic_cmpset_rel_32 opal_atomic_cmpset_32
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
@ -119,7 +119,7 @@ static inline int ompi_atomic_cmpset_32(volatile int32_t *addr,
* This conflict force us to save the EBX before the cmpxchg8b * This conflict force us to save the EBX before the cmpxchg8b
* and to restore it afterward. * and to restore it afterward.
*/ */
static inline int ompi_atomic_cmpset_64(volatile int64_t *addr, static inline int opal_atomic_cmpset_64(volatile int64_t *addr,
int64_t oldval, int64_t oldval,
int64_t newval) int64_t newval)
{ {
@ -145,8 +145,8 @@ static inline int ompi_atomic_cmpset_64(volatile int64_t *addr,
#endif /* OMPI_GCC_INLINE_ASSEMBLY */ #endif /* OMPI_GCC_INLINE_ASSEMBLY */
#define ompi_atomic_cmpset_acq_64 ompi_atomic_cmpset_64 #define opal_atomic_cmpset_acq_64 opal_atomic_cmpset_64
#define ompi_atomic_cmpset_rel_64 ompi_atomic_cmpset_64 #define opal_atomic_cmpset_rel_64 opal_atomic_cmpset_64
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
@ -157,7 +157,7 @@ static inline int ompi_atomic_cmpset_64(volatile int64_t *addr,
* *
* Atomically adds @i to @v. * Atomically adds @i to @v.
*/ */
static inline int32_t ompi_atomic_add_32(volatile int32_t* v, int i) static inline int32_t opal_atomic_add_32(volatile int32_t* v, int i)
{ {
__asm__ __volatile__( __asm__ __volatile__(
SMPLOCK "addl %1,%0" SMPLOCK "addl %1,%0"
@ -174,7 +174,7 @@ static inline int32_t ompi_atomic_add_32(volatile int32_t* v, int i)
* *
* Atomically subtracts @i from @v. * Atomically subtracts @i from @v.
*/ */
static inline int32_t ompi_atomic_sub_32(volatile int32_t* v, int i) static inline int32_t opal_atomic_sub_32(volatile int32_t* v, int i)
{ {
__asm__ __volatile__( __asm__ __volatile__(
SMPLOCK "subl %1,%0" SMPLOCK "subl %1,%0"

Просмотреть файл

@ -15,7 +15,7 @@
# $HEADER$ # $HEADER$
# #
CFILE=/tmp/ompi_atomic_$$.c CFILE=/tmp/opal_atomic_$$.c
trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15

Просмотреть файл

@ -34,10 +34,10 @@
* Define constants for IA64 * Define constants for IA64
* *
*********************************************************************/ *********************************************************************/
#define OMPI_HAVE_ATOMIC_MEM_BARRIER 1 #define OPAL_HAVE_ATOMIC_MEM_BARRIER 1
#define OMPI_HAVE_ATOMIC_CMPSET_32 1 #define OPAL_HAVE_ATOMIC_CMPSET_32 1
#define OMPI_HAVE_ATOMIC_CMPSET_64 1 #define OPAL_HAVE_ATOMIC_CMPSET_64 1
/********************************************************************** /**********************************************************************
* *
@ -46,19 +46,19 @@
*********************************************************************/ *********************************************************************/
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline void ompi_atomic_mb(void) static inline void opal_atomic_mb(void)
{ {
MB(); MB();
} }
static inline void ompi_atomic_rmb(void) static inline void opal_atomic_rmb(void)
{ {
MB(); MB();
} }
static inline void ompi_atomic_wmb(void) static inline void opal_atomic_wmb(void)
{ {
MB(); MB();
} }
@ -80,7 +80,7 @@ static inline void ompi_atomic_wmb(void)
ia64_intri_res; \ ia64_intri_res; \
}) })
static inline int ompi_atomic_cmpset_acq_32( volatile int32_t *addr, static inline int opal_atomic_cmpset_acq_32( volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
int64_t ret; int64_t ret;
@ -93,7 +93,7 @@ static inline int ompi_atomic_cmpset_acq_32( volatile int32_t *addr,
} }
static inline int ompi_atomic_cmpset_rel_32( volatile int32_t *addr, static inline int opal_atomic_cmpset_rel_32( volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
int64_t ret; int64_t ret;
@ -108,11 +108,11 @@ static inline int ompi_atomic_cmpset_rel_32( volatile int32_t *addr,
#endif /* OMPI_GCC_INLINE_ASSEMBLY */ #endif /* OMPI_GCC_INLINE_ASSEMBLY */
#define ompi_atomic_cmpset_32 ompi_atomic_cmpset_acq_32 #define opal_atomic_cmpset_32 opal_atomic_cmpset_acq_32
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline int ompi_atomic_cmpset_acq_64( volatile int64_t *addr, static inline int opal_atomic_cmpset_acq_64( volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
int64_t ret; int64_t ret;
@ -125,7 +125,7 @@ static inline int ompi_atomic_cmpset_acq_64( volatile int64_t *addr,
} }
static inline int ompi_atomic_cmpset_rel_64( volatile int64_t *addr, static inline int opal_atomic_cmpset_rel_64( volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
int64_t ret; int64_t ret;
@ -139,6 +139,6 @@ static inline int ompi_atomic_cmpset_rel_64( volatile int64_t *addr,
#endif /* OMPI_GCC_INLINE_ASSEMBLY */ #endif /* OMPI_GCC_INLINE_ASSEMBLY */
#define ompi_atomic_cmpset_64 ompi_atomic_cmpset_acq_64 #define opal_atomic_cmpset_64 opal_atomic_cmpset_acq_64
#endif /* ! OMPI_SYS_ARCH_ATOMIC_H */ #endif /* ! OMPI_SYS_ARCH_ATOMIC_H */

Просмотреть файл

@ -15,7 +15,7 @@
# $HEADER$ # $HEADER$
# #
CFILE=/tmp/ompi_atomic_$$.c CFILE=/tmp/opal_atomic_$$.c
trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15

Просмотреть файл

@ -41,10 +41,10 @@
* Define constants for MIPS * Define constants for MIPS
* *
*********************************************************************/ *********************************************************************/
#define OMPI_HAVE_ATOMIC_MEM_BARRIER 1 #define OPAL_HAVE_ATOMIC_MEM_BARRIER 1
#define OMPI_HAVE_ATOMIC_CMPSET_32 1 #define OPAL_HAVE_ATOMIC_CMPSET_32 1
#define OMPI_HAVE_ATOMIC_CMPSET_64 1 #define OPAL_HAVE_ATOMIC_CMPSET_64 1
/********************************************************************** /**********************************************************************
@ -55,21 +55,21 @@
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline static inline
void ompi_atomic_mb(void) void opal_atomic_mb(void)
{ {
MB(); MB();
} }
static inline static inline
void ompi_atomic_rmb(void) void opal_atomic_rmb(void)
{ {
RMB(); RMB();
} }
static inline static inline
void ompi_atomic_wmb(void) void opal_atomic_wmb(void)
{ {
WMB(); WMB();
} }
@ -83,7 +83,7 @@ void ompi_atomic_wmb(void)
*********************************************************************/ *********************************************************************/
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline int ompi_atomic_cmpset_32(volatile int32_t *addr, static inline int opal_atomic_cmpset_32(volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
int32_t ret; int32_t ret;
@ -112,27 +112,27 @@ static inline int ompi_atomic_cmpset_32(volatile int32_t *addr,
atomic_?mb can be inlined). Instead, we "inline" them by hand in atomic_?mb can be inlined). Instead, we "inline" them by hand in
the assembly, meaning there is one function call overhead instead the assembly, meaning there is one function call overhead instead
of two */ of two */
static inline int ompi_atomic_cmpset_acq_32(volatile int32_t *addr, static inline int opal_atomic_cmpset_acq_32(volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
int rc; int rc;
rc = ompi_atomic_cmpset_32(addr, oldval, newval); rc = opal_atomic_cmpset_32(addr, oldval, newval);
ompi_atomic_rmb(); opal_atomic_rmb();
return rc; return rc;
} }
static inline int ompi_atomic_cmpset_rel_32(volatile int32_t *addr, static inline int opal_atomic_cmpset_rel_32(volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
ompi_atomic_wmb(); opal_atomic_wmb();
return ompi_atomic_cmpset_32(addr, oldval, newval); return opal_atomic_cmpset_32(addr, oldval, newval);
} }
static inline int ompi_atomic_cmpset_64(volatile int64_t *addr, static inline int opal_atomic_cmpset_64(volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
int64_t ret; int64_t ret;
@ -163,23 +163,23 @@ static inline int ompi_atomic_cmpset_64(volatile int64_t *addr,
atomic_?mb can be inlined). Instead, we "inline" them by hand in atomic_?mb can be inlined). Instead, we "inline" them by hand in
the assembly, meaning there is one function call overhead instead the assembly, meaning there is one function call overhead instead
of two */ of two */
static inline int ompi_atomic_cmpset_acq_64(volatile int64_t *addr, static inline int opal_atomic_cmpset_acq_64(volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
int rc; int rc;
rc = ompi_atomic_cmpset_64(addr, oldval, newval); rc = opal_atomic_cmpset_64(addr, oldval, newval);
ompi_atomic_rmb(); opal_atomic_rmb();
return rc; return rc;
} }
static inline int ompi_atomic_cmpset_rel_64(volatile int64_t *addr, static inline int opal_atomic_cmpset_rel_64(volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
ompi_atomic_wmb(); opal_atomic_wmb();
return ompi_atomic_cmpset_64(addr, oldval, newval); return opal_atomic_cmpset_64(addr, oldval, newval);
} }
#endif /* OMPI_GCC_INLINE_ASSEMBLY */ #endif /* OMPI_GCC_INLINE_ASSEMBLY */

Просмотреть файл

@ -15,7 +15,7 @@
# $HEADER$ # $HEADER$
# #
CFILE=/tmp/ompi_atomic_$$.c CFILE=/tmp/opal_atomic_$$.c
trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15

Просмотреть файл

@ -21,12 +21,12 @@ typedef int affinity_t;
#ifndef ENABLE_NUMA #ifndef ENABLE_NUMA
static inline int ompi_set_affinity(void *addr, size_t size, affinity_t affinity) static inline int opal_set_affinity(void *addr, size_t size, affinity_t affinity)
{ {
return 1; return 1;
} }
static inline int ompi_get_cpu_set(void) static inline int opal_get_cpu_set(void)
{ {
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
@ -35,8 +35,8 @@ static inline int ompi_get_cpu_set(void)
/* OS / architecture specific implementation elsewhere */ /* OS / architecture specific implementation elsewhere */
int ompi_set_affinity(void *addr, size_t size, affinity_t affinity); int opal_set_affinity(void *addr, size_t size, affinity_t affinity);
int ompi_get_cpu_set(void) int opal_get_cpu_set(void)
#endif #endif

Просмотреть файл

@ -45,17 +45,17 @@
* Define constants for PowerPC 32 * Define constants for PowerPC 32
* *
*********************************************************************/ *********************************************************************/
#define OMPI_HAVE_ATOMIC_MEM_BARRIER 1 #define OPAL_HAVE_ATOMIC_MEM_BARRIER 1
#define OMPI_HAVE_ATOMIC_CMPSET_32 1 #define OPAL_HAVE_ATOMIC_CMPSET_32 1
#define OMPI_HAVE_ATOMIC_MATH_32 1 #define OPAL_HAVE_ATOMIC_MATH_32 1
#define OMPI_HAVE_ATOMIC_ADD_32 1 #define OPAL_HAVE_ATOMIC_ADD_32 1
#define OMPI_HAVE_ATOMIC_SUB_32 1 #define OPAL_HAVE_ATOMIC_SUB_32 1
#if (OMPI_ASSEMBLY_ARCH == OMPI_POWERPC64) || OMPI_ASM_SUPPORT_64BIT #if (OMPI_ASSEMBLY_ARCH == OMPI_POWERPC64) || OMPI_ASM_SUPPORT_64BIT
#define OMPI_HAVE_ATOMIC_CMPSET_64 1 #define OPAL_HAVE_ATOMIC_CMPSET_64 1
#endif #endif
@ -67,21 +67,21 @@
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline static inline
void ompi_atomic_mb(void) void opal_atomic_mb(void)
{ {
MB(); MB();
} }
static inline static inline
void ompi_atomic_rmb(void) void opal_atomic_rmb(void)
{ {
RMB(); RMB();
} }
static inline static inline
void ompi_atomic_wmb(void) void opal_atomic_wmb(void)
{ {
WMB(); WMB();
} }
@ -94,23 +94,23 @@ void ompi_atomic_wmb(void)
* containing the right hex for the instructions). * containing the right hex for the instructions).
*/ */
void ompi_atomic_mb(void); void opal_atomic_mb(void);
#pragma mc_func ompi_atomic_mb { "7c0004ac" } /* sync */ #pragma mc_func opal_atomic_mb { "7c0004ac" } /* sync */
#pragma reg_killed_by ompi_atomic_mb /* none */ #pragma reg_killed_by opal_atomic_mb /* none */
void ompi_atomic_rmb(void); void opal_atomic_rmb(void);
#pragma mc_func ompi_atomic_rmb { "7c2004ac" } /* lwsync */ #pragma mc_func opal_atomic_rmb { "7c2004ac" } /* lwsync */
#pragma reg_killed_by ompi_atomic_rmb /* none */ #pragma reg_killed_by opal_atomic_rmb /* none */
void ompi_atomic_wmb(void); void opal_atomic_wmb(void);
#pragma mc_func ompi_atomic_wmb { "7c0006ac" } /* eieio */ #pragma mc_func opal_atomic_wmb { "7c0006ac" } /* eieio */
#pragma reg_killed_by ompi_atomic_wmb /* none */ #pragma reg_killed_by opal_atomic_wmb /* none */
#else /* end OMPI_XLC_INLINE_ASSEMBLY */ #else /* end OMPI_XLC_INLINE_ASSEMBLY */
void ompi_atomic_mb(void); void opal_atomic_mb(void);
void ompi_atomic_rmb(void); void opal_atomic_rmb(void);
void ompi_atomic_wmb(void); void opal_atomic_wmb(void);
#endif #endif
@ -121,7 +121,7 @@ void ompi_atomic_wmb(void);
*********************************************************************/ *********************************************************************/
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline int ompi_atomic_cmpset_32(volatile int32_t *addr, static inline int opal_atomic_cmpset_32(volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
int32_t ret; int32_t ret;
@ -145,31 +145,31 @@ static inline int ompi_atomic_cmpset_32(volatile int32_t *addr,
atomic_?mb can be inlined). Instead, we "inline" them by hand in atomic_?mb can be inlined). Instead, we "inline" them by hand in
the assembly, meaning there is one function call overhead instead the assembly, meaning there is one function call overhead instead
of two */ of two */
static inline int ompi_atomic_cmpset_acq_32(volatile int32_t *addr, static inline int opal_atomic_cmpset_acq_32(volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
int rc; int rc;
rc = ompi_atomic_cmpset_32(addr, oldval, newval); rc = opal_atomic_cmpset_32(addr, oldval, newval);
ompi_atomic_rmb(); opal_atomic_rmb();
return rc; return rc;
} }
static inline int ompi_atomic_cmpset_rel_32(volatile int32_t *addr, static inline int opal_atomic_cmpset_rel_32(volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
ompi_atomic_wmb(); opal_atomic_wmb();
return ompi_atomic_cmpset_32(addr, oldval, newval); return opal_atomic_cmpset_32(addr, oldval, newval);
} }
#else #else
int ompi_atomic_cmpset_32(volatile int32_t *addr, int opal_atomic_cmpset_32(volatile int32_t *addr,
int32_t oldval, int32_t newval); int32_t oldval, int32_t newval);
int ompi_atomic_cmpset_acq_32(volatile int32_t *addr, int opal_atomic_cmpset_acq_32(volatile int32_t *addr,
int32_t oldval, int32_t newval); int32_t oldval, int32_t newval);
int ompi_atomic_cmpset_rel_32(volatile int32_t *addr, int opal_atomic_cmpset_rel_32(volatile int32_t *addr,
int32_t oldval, int32_t newval); int32_t oldval, int32_t newval);
#endif /* OMPI_GCC_INLINE_ASSEMBLY */ #endif /* OMPI_GCC_INLINE_ASSEMBLY */
@ -177,7 +177,7 @@ int ompi_atomic_cmpset_rel_32(volatile int32_t *addr,
#if (OMPI_ASSEMBLY_ARCH == OMPI_POWERPC64) #if (OMPI_ASSEMBLY_ARCH == OMPI_POWERPC64)
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline int ompi_atomic_cmpset_64(volatile int64_t *addr, static inline int opal_atomic_cmpset_64(volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
int64_t ret; int64_t ret;
@ -201,32 +201,32 @@ static inline int ompi_atomic_cmpset_64(volatile int64_t *addr,
atomic_?mb can be inlined). Instead, we "inline" them by hand in atomic_?mb can be inlined). Instead, we "inline" them by hand in
the assembly, meaning there is one function call overhead instead the assembly, meaning there is one function call overhead instead
of two */ of two */
static inline int ompi_atomic_cmpset_acq_64(volatile int64_t *addr, static inline int opal_atomic_cmpset_acq_64(volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
int rc; int rc;
rc = ompi_atomic_cmpset_64(addr, oldval, newval); rc = opal_atomic_cmpset_64(addr, oldval, newval);
ompi_atomic_rmb(); opal_atomic_rmb();
return rc; return rc;
} }
static inline int ompi_atomic_cmpset_rel_64(volatile int64_t *addr, static inline int opal_atomic_cmpset_rel_64(volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
ompi_atomic_wmb(); opal_atomic_wmb();
return ompi_atomic_cmpset_64(addr, oldval, newval); return opal_atomic_cmpset_64(addr, oldval, newval);
} }
#else /* OMPI_GCC_INLINE_ASSEMBLY */ #else /* OMPI_GCC_INLINE_ASSEMBLY */
int ompi_atomic_cmpset_64(volatile int64_t *addr, int opal_atomic_cmpset_64(volatile int64_t *addr,
int64_t oldval, int64_t newval); int64_t oldval, int64_t newval);
int ompi_atomic_cmpset_acq_64(volatile int64_t *addr, int opal_atomic_cmpset_acq_64(volatile int64_t *addr,
int64_t oldval, int64_t newval); int64_t oldval, int64_t newval);
int ompi_atomic_cmpset_rel_64(volatile int64_t *addr, int opal_atomic_cmpset_rel_64(volatile int64_t *addr,
int64_t oldval, int64_t newval); int64_t oldval, int64_t newval);
#endif /* OMPI_GCC_INLINE_ASSEMBLY */ #endif /* OMPI_GCC_INLINE_ASSEMBLY */
@ -240,7 +240,7 @@ int ompi_atomic_cmpset_rel_64(volatile int64_t *addr,
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline int ompi_atomic_cmpset_64(volatile int64_t *addr, static inline int opal_atomic_cmpset_64(volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
int ret; int ret;
@ -281,32 +281,32 @@ static inline int ompi_atomic_cmpset_64(volatile int64_t *addr,
atomic_?mb can be inlined). Instead, we "inline" them by hand in atomic_?mb can be inlined). Instead, we "inline" them by hand in
the assembly, meaning there is one function call overhead instead the assembly, meaning there is one function call overhead instead
of two */ of two */
static inline int ompi_atomic_cmpset_acq_64(volatile int64_t *addr, static inline int opal_atomic_cmpset_acq_64(volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
int rc; int rc;
rc = ompi_atomic_cmpset_64(addr, oldval, newval); rc = opal_atomic_cmpset_64(addr, oldval, newval);
ompi_atomic_rmb(); opal_atomic_rmb();
return rc; return rc;
} }
static inline int ompi_atomic_cmpset_rel_64(volatile int64_t *addr, static inline int opal_atomic_cmpset_rel_64(volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
ompi_atomic_wmb(); opal_atomic_wmb();
return ompi_atomic_cmpset_64(addr, oldval, newval); return opal_atomic_cmpset_64(addr, oldval, newval);
} }
#else /* OMPI_GCC_INLINE_ASSEMBLY */ #else /* OMPI_GCC_INLINE_ASSEMBLY */
int ompi_atomic_cmpset_64(volatile int64_t *addr, int opal_atomic_cmpset_64(volatile int64_t *addr,
int64_t oldval, int64_t newval); int64_t oldval, int64_t newval);
int ompi_atomic_cmpset_acq_64(volatile int64_t *addr, int opal_atomic_cmpset_acq_64(volatile int64_t *addr,
int64_t oldval, int64_t newval); int64_t oldval, int64_t newval);
int ompi_atomic_cmpset_rel_64(volatile int64_t *addr, int opal_atomic_cmpset_rel_64(volatile int64_t *addr,
int64_t oldval, int64_t newval); int64_t oldval, int64_t newval);
#endif /* OMPI_GCC_INLINE_ASSEMBLY */ #endif /* OMPI_GCC_INLINE_ASSEMBLY */
@ -316,7 +316,7 @@ int ompi_atomic_cmpset_rel_64(volatile int64_t *addr,
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline int32_t ompi_atomic_add_32(volatile int32_t* v, int inc) static inline int32_t opal_atomic_add_32(volatile int32_t* v, int inc)
{ {
int32_t t; int32_t t;
@ -333,7 +333,7 @@ static inline int32_t ompi_atomic_add_32(volatile int32_t* v, int inc)
} }
static inline int32_t ompi_atomic_sub_32(volatile int32_t* v, int dec) static inline int32_t opal_atomic_sub_32(volatile int32_t* v, int dec)
{ {
int32_t t; int32_t t;

Просмотреть файл

@ -15,7 +15,7 @@
# $HEADER$ # $HEADER$
# #
CFILE=/tmp/ompi_atomic_$$.c CFILE=/tmp/opal_atomic_$$.c
trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15

Просмотреть файл

@ -25,14 +25,14 @@
#endif #endif
#ifdef OMPI_GENERATE_ASM_FILE #ifdef OMPI_GENERATE_ASM_FILE
struct ompi_lock_t { struct opal_atomic_lock_t {
union { union {
volatile int lock; /**< The lock address (an integer) */ volatile int lock; /**< The lock address (an integer) */
volatile unsigned char sparc_lock; /**< The lock address on sparc */ volatile unsigned char sparc_lock; /**< The lock address on sparc */
char padding[sizeof(int)]; /**< Array for optional padding */ char padding[sizeof(int)]; /**< Array for optional padding */
} u; } u;
}; };
typedef struct ompi_lock_t ompi_lock_t; typedef struct opal_atomic_lock_t opal_atomic_lock_t;
#endif #endif
/********************************************************************** /**********************************************************************
@ -40,16 +40,16 @@ typedef struct ompi_lock_t ompi_lock_t;
* Define constants for Sparc * Define constants for Sparc
* *
*********************************************************************/ *********************************************************************/
#define OMPI_HAVE_ATOMIC_MEM_BARRIER 1 #define OPAL_HAVE_ATOMIC_MEM_BARRIER 1
#define OMPI_HAVE_ATOMIC_CMPSET_32 0 #define OPAL_HAVE_ATOMIC_CMPSET_32 0
#define OMPI_HAVE_ATOMIC_CMPSET_64 0 #define OPAL_HAVE_ATOMIC_CMPSET_64 0
#define OMPI_HAVE_ATOMIC_MATH_32 1 #define OPAL_HAVE_ATOMIC_MATH_32 1
#define OMPI_HAVE_ATOMIC_SUB_32 1 #define OPAL_HAVE_ATOMIC_SUB_32 1
#define OMPI_HAVE_ATOMIC_ADD_32 1 #define OPAL_HAVE_ATOMIC_ADD_32 1
#define OMPI_HAVE_ATOMIC_SPINLOCKS 1 #define OPAL_HAVE_ATOMIC_SPINLOCKS 1
/********************************************************************** /**********************************************************************
* *
@ -58,19 +58,19 @@ typedef struct ompi_lock_t ompi_lock_t;
*********************************************************************/ *********************************************************************/
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline void ompi_atomic_mb(void) static inline void opal_atomic_mb(void)
{ {
MB(); MB();
} }
static inline void ompi_atomic_rmb(void) static inline void opal_atomic_rmb(void)
{ {
MB(); MB();
} }
static inline void ompi_atomic_wmb(void) static inline void opal_atomic_wmb(void)
{ {
MB(); MB();
} }
@ -89,13 +89,13 @@ static inline void ompi_atomic_wmb(void)
attempt to leave it as OMPI_LOCKED whenever possible */ attempt to leave it as OMPI_LOCKED whenever possible */
static inline void ompi_atomic_init(ompi_lock_t* lock, int value) static inline void opal_atomic_init(opal_atomic_lock_t* lock, int value)
{ {
lock->u.sparc_lock = (unsigned char) value; lock->u.sparc_lock = (unsigned char) value;
} }
static inline int ompi_atomic_trylock(ompi_lock_t *lock) static inline int opal_atomic_trylock(opal_atomic_lock_t *lock)
{ {
unsigned char result; unsigned char result;
@ -112,7 +112,7 @@ static inline int ompi_atomic_trylock(ompi_lock_t *lock)
} }
static inline void ompi_atomic_lock(ompi_lock_t *lock) static inline void opal_atomic_lock(opal_atomic_lock_t *lock)
{ {
/* From page 264 of The SPARC Architecture Manual, Version 8 */ /* From page 264 of The SPARC Architecture Manual, Version 8 */
__asm__ __volatile__ ( __asm__ __volatile__ (
@ -135,7 +135,7 @@ static inline void ompi_atomic_lock(ompi_lock_t *lock)
} }
static inline void ompi_atomic_unlock(ompi_lock_t *lock) static inline void opal_atomic_unlock(opal_atomic_lock_t *lock)
{ {
/* 0 out that byte in memory */ /* 0 out that byte in memory */
__asm__ __volatile__ ("\t" __asm__ __volatile__ ("\t"

Просмотреть файл

@ -15,7 +15,7 @@
# $HEADER$ # $HEADER$
# #
CFILE=/tmp/ompi_atomic_$$.c CFILE=/tmp/opal_atomic_$$.c
trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15

Просмотреть файл

@ -35,11 +35,11 @@
* Define constants for Sparc v9 (Ultra Sparc) * Define constants for Sparc v9 (Ultra Sparc)
* *
*********************************************************************/ *********************************************************************/
#define OMPI_HAVE_ATOMIC_MEM_BARRIER 1 #define OPAL_HAVE_ATOMIC_MEM_BARRIER 1
#define OMPI_HAVE_ATOMIC_CMPSET_32 1 #define OPAL_HAVE_ATOMIC_CMPSET_32 1
#define OMPI_HAVE_ATOMIC_CMPSET_64 1 #define OPAL_HAVE_ATOMIC_CMPSET_64 1
/********************************************************************** /**********************************************************************
@ -49,19 +49,19 @@
*********************************************************************/ *********************************************************************/
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline void ompi_atomic_mb(void) static inline void opal_atomic_mb(void)
{ {
MEMBAR("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad"); MEMBAR("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad");
} }
static inline void ompi_atomic_rmb(void) static inline void opal_atomic_rmb(void)
{ {
MEMBAR("#LoadLoad"); MEMBAR("#LoadLoad");
} }
static inline void ompi_atomic_wmb(void) static inline void opal_atomic_wmb(void)
{ {
MEMBAR("#StoreStore"); MEMBAR("#StoreStore");
} }
@ -76,7 +76,7 @@ static inline void ompi_atomic_wmb(void)
*********************************************************************/ *********************************************************************/
#if OMPI_GCC_INLINE_ASSEMBLY #if OMPI_GCC_INLINE_ASSEMBLY
static inline int ompi_atomic_cmpset_32( volatile int32_t *addr, static inline int opal_atomic_cmpset_32( volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
/* casa [reg(rs1)] %asi, reg(rs2), reg(rd) /* casa [reg(rs1)] %asi, reg(rs2), reg(rd)
@ -96,29 +96,29 @@ static inline int ompi_atomic_cmpset_32( volatile int32_t *addr,
} }
static inline int ompi_atomic_cmpset_acq_32( volatile int32_t *addr, static inline int opal_atomic_cmpset_acq_32( volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
int rc; int rc;
rc = ompi_atomic_cmpset_32(addr, oldval, newval); rc = opal_atomic_cmpset_32(addr, oldval, newval);
ompi_atomic_rmb(); opal_atomic_rmb();
return rc; return rc;
} }
static inline int ompi_atomic_cmpset_rel_32( volatile int32_t *addr, static inline int opal_atomic_cmpset_rel_32( volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
ompi_atomic_wmb(); opal_atomic_wmb();
return ompi_atomic_cmpset_32(addr, oldval, newval); return opal_atomic_cmpset_32(addr, oldval, newval);
} }
#if OMPI_ASSEMBLY_ARCH == OMPI_SPARCV9_64 #if OMPI_ASSEMBLY_ARCH == OMPI_SPARCV9_64
static inline int ompi_atomic_cmpset_64( volatile int64_t *addr, static inline int opal_atomic_cmpset_64( volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
/* casa [reg(rs1)] %asi, reg(rs2), reg(rd) /* casa [reg(rs1)] %asi, reg(rs2), reg(rd)
@ -138,7 +138,7 @@ static inline int ompi_atomic_cmpset_64( volatile int64_t *addr,
#else /* OMPI_ASSEMBLY_ARCH == OMPI_SPARCV9_64 */ #else /* OMPI_ASSEMBLY_ARCH == OMPI_SPARCV9_64 */
static inline int ompi_atomic_cmpset_64( volatile int64_t *addr, static inline int opal_atomic_cmpset_64( volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
/* casa [reg(rs1)] %asi, reg(rs2), reg(rd) /* casa [reg(rs1)] %asi, reg(rs2), reg(rd)
@ -166,23 +166,23 @@ static inline int ompi_atomic_cmpset_64( volatile int64_t *addr,
#endif /* OMPI_ASSEMBLY_ARCH == OMPI_SPARCV9_64 */ #endif /* OMPI_ASSEMBLY_ARCH == OMPI_SPARCV9_64 */
static inline int ompi_atomic_cmpset_acq_64( volatile int64_t *addr, static inline int opal_atomic_cmpset_acq_64( volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
int rc; int rc;
rc = ompi_atomic_cmpset_64(addr, oldval, newval); rc = opal_atomic_cmpset_64(addr, oldval, newval);
ompi_atomic_rmb(); opal_atomic_rmb();
return rc; return rc;
} }
static inline int ompi_atomic_cmpset_rel_64( volatile int64_t *addr, static inline int opal_atomic_cmpset_rel_64( volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
ompi_atomic_wmb(); opal_atomic_wmb();
return ompi_atomic_cmpset_64(addr, oldval, newval); return opal_atomic_cmpset_64(addr, oldval, newval);
} }
#endif /* OMPI_GCC_INLINE_ASSEMBLY */ #endif /* OMPI_GCC_INLINE_ASSEMBLY */

Просмотреть файл

@ -15,7 +15,7 @@
# $HEADER$ # $HEADER$
# #
CFILE=/tmp/ompi_atomic_$$.c CFILE=/tmp/opal_atomic_$$.c
trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15

Просмотреть файл

@ -22,9 +22,9 @@
* Memory Barriers * Memory Barriers
* *
*********************************************************************/ *********************************************************************/
#define OMPI_HAVE_ATOMIC_MEM_BARRIER 1 #define OPAL_HAVE_ATOMIC_MEM_BARRIER 1
static inline void ompi_atomic_mb(void) static inline void opal_atomic_mb(void)
{ {
#if 0 #if 0
return KeMemoryBarrier(); return KeMemoryBarrier();
@ -32,7 +32,7 @@ static inline void ompi_atomic_mb(void)
} }
static inline void ompi_atomic_rmb(void) static inline void opal_atomic_rmb(void)
{ {
#if 0 #if 0
return KeMemoryBarrier(); return KeMemoryBarrier();
@ -40,7 +40,7 @@ static inline void ompi_atomic_rmb(void)
} }
static inline void ompi_atomic_wmb(void) static inline void opal_atomic_wmb(void)
{ {
#if 0 #if 0
return KeMemoryBarrier(); return KeMemoryBarrier();
@ -54,8 +54,8 @@ static inline void ompi_atomic_wmb(void)
* *
*********************************************************************/ *********************************************************************/
#define OMPI_HAVE_ATOMIC_CMPSET_32 1 #define OPAL_HAVE_ATOMIC_CMPSET_32 1
static inline int ompi_atomic_cmpset_acq_32( volatile int32_t *addr, static inline int opal_atomic_cmpset_acq_32( volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
#if 0 #if 0
@ -68,7 +68,7 @@ static inline int ompi_atomic_cmpset_acq_32( volatile int32_t *addr,
} }
static inline int ompi_atomic_cmpset_rel_32( volatile int32_t *addr, static inline int opal_atomic_cmpset_rel_32( volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
#if 0 #if 0
@ -80,7 +80,7 @@ static inline int ompi_atomic_cmpset_rel_32( volatile int32_t *addr,
#endif #endif
} }
static inline int ompi_atomic_cmpset_32( volatile int32_t *addr, static inline int opal_atomic_cmpset_32( volatile int32_t *addr,
int32_t oldval, int32_t newval) int32_t oldval, int32_t newval)
{ {
#if 0 #if 0
@ -93,8 +93,8 @@ static inline int ompi_atomic_cmpset_32( volatile int32_t *addr,
#endif #endif
} }
#define OMPI_HAVE_ATOMIC_CMPSET_64 1 #define OPAL_HAVE_ATOMIC_CMPSET_64 1
static inline int ompi_atomic_cmpset_acq_64( volatile int64_t *addr, static inline int opal_atomic_cmpset_acq_64( volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
#if 0 #if 0
@ -106,7 +106,7 @@ static inline int ompi_atomic_cmpset_acq_64( volatile int64_t *addr,
#endif #endif
} }
static inline int ompi_atomic_cmpset_rel_64( volatile int64_t *addr, static inline int opal_atomic_cmpset_rel_64( volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
#if 0 #if 0
@ -119,7 +119,7 @@ static inline int ompi_atomic_cmpset_rel_64( volatile int64_t *addr,
} }
static inline int ompi_atomic_cmpset_64( volatile int64_t *addr, static inline int opal_atomic_cmpset_64( volatile int64_t *addr,
int64_t oldval, int64_t newval) int64_t oldval, int64_t newval)
{ {
#if 0 #if 0
@ -131,20 +131,20 @@ static inline int ompi_atomic_cmpset_64( volatile int64_t *addr,
#endif #endif
} }
#define OMPI_HAVE_ATOMIC_MATH_32 1 #define OPAL_HAVE_ATOMIC_MATH_32 1
#define OMPI_HAVE_ATOMIC_ADD_32 1 #define OPAL_HAVE_ATOMIC_ADD_32 1
static inline int32_t ompi_atomic_add_32(volatile int32_t *addr, int32_t delta) static inline int32_t opal_atomic_add_32(volatile int32_t *addr, int32_t delta)
{ {
return InterlockedExchangeAdd ((LONG volatile *) addr, return InterlockedExchangeAdd ((LONG volatile *) addr,
(int32_t) delta); (int32_t) delta);
} }
#define OMPI_HAVE_ATOMIC_MATH_64 1 #define OPAL_HAVE_ATOMIC_MATH_64 1
#define OMPI_HAVE_ATOMIC_ADD_64 1 #define OPAL_HAVE_ATOMIC_ADD_64 1
static inline int64_t ompi_atomic_add_64(volatile int64_t *addr, int64_t delta) static inline int64_t opal_atomic_add_64(volatile int64_t *addr, int64_t delta)
{ {
#if 0 #if 0
return InterlockedExchangeAdd64 ((int64_t volatile *) addr, return InterlockedExchangeAdd64 ((int64_t volatile *) addr,
@ -155,16 +155,16 @@ static inline int64_t ompi_atomic_add_64(volatile int64_t *addr, int64_t delta)
} }
#define OMPI_HAVE_ATOMIC_SUB_32 1 #define OPAL_HAVE_ATOMIC_SUB_32 1
static inline int32_t ompi_atomic_sub_32(volatile int32_t *addr, int32_t delta) static inline int32_t opal_atomic_sub_32(volatile int32_t *addr, int32_t delta)
{ {
return InterlockedExchangeAdd( (LONG volatile *) addr, return InterlockedExchangeAdd( (LONG volatile *) addr,
(int32_t) (-delta)); (int32_t) (-delta));
} }
#define OMPI_HAVE_ATOMIC_SUB_64 1 #define OPAL_HAVE_ATOMIC_SUB_64 1
static inline int64_t ompi_atomic_sub_64(volatile int64_t *addr, int64_t delta) static inline int64_t opal_atomic_sub_64(volatile int64_t *addr, int64_t delta)
{ {
#if 0 #if 0
return InterlockedExchangeAdd64 ((int64_t volatile *) addr, return InterlockedExchangeAdd64 ((int64_t volatile *) addr,

Просмотреть файл

@ -35,7 +35,7 @@ static const int ompi_progress_default_tick_rate = 100;
* Local variables * Local variables
*/ */
#if OMPI_HAVE_THREAD_SUPPORT #if OMPI_HAVE_THREAD_SUPPORT
static ompi_lock_t progress_lock; static opal_atomic_lock_t progress_lock;
#endif /* OMPI_HAVE_THREAD_SUPPORT */ #endif /* OMPI_HAVE_THREAD_SUPPORT */
/* callbacks to progress */ /* callbacks to progress */
@ -61,7 +61,7 @@ ompi_progress_init(void)
{ {
/* reentrant issues */ /* reentrant issues */
#if OMPI_HAVE_THREAD_SUPPORT #if OMPI_HAVE_THREAD_SUPPORT
ompi_atomic_init(&progress_lock, OMPI_ATOMIC_UNLOCKED); opal_atomic_init(&progress_lock, OPAL_ATOMIC_UNLOCKED);
#endif /* OMPI_HAVE_THREAD_SUPPORT */ #endif /* OMPI_HAVE_THREAD_SUPPORT */
/* always call sched yield when in the rte only... */ /* always call sched yield when in the rte only... */
@ -144,7 +144,7 @@ ompi_progress_finalize(void)
/* free memory associated with the callbacks */ /* free memory associated with the callbacks */
#if OMPI_HAVE_THREAD_SUPPORT #if OMPI_HAVE_THREAD_SUPPORT
ompi_atomic_lock(&progress_lock); opal_atomic_lock(&progress_lock);
#endif #endif
if (NULL != callbacks) { if (NULL != callbacks) {
@ -155,7 +155,7 @@ ompi_progress_finalize(void)
callbacks_size = 0; callbacks_size = 0;
#if OMPI_HAVE_THREAD_SUPPORT #if OMPI_HAVE_THREAD_SUPPORT
ompi_atomic_unlock(&progress_lock); opal_atomic_unlock(&progress_lock);
#endif #endif
return OMPI_SUCCESS; return OMPI_SUCCESS;
@ -196,7 +196,7 @@ ompi_progress(void)
via ompi_progress (which is usually only called when there are via ompi_progress (which is usually only called when there are
no PROGRESS_THREADS running). This should be made more fine-grained no PROGRESS_THREADS running). This should be made more fine-grained
at some point in the future. */ at some point in the future. */
if (! ompi_atomic_trylock(&progress_lock)) { if (! opal_atomic_trylock(&progress_lock)) {
/* someone is already progressing - return */ /* someone is already progressing - return */
return; return;
} }
@ -228,7 +228,7 @@ ompi_progress(void)
#if OMPI_HAVE_THREAD_SUPPORT #if OMPI_HAVE_THREAD_SUPPORT
/* release the lock before yielding, for obvious reasons */ /* release the lock before yielding, for obvious reasons */
ompi_atomic_unlock(&progress_lock); opal_atomic_unlock(&progress_lock);
#endif /* OMPI_HAVE_THREAD_SUPPORT */ #endif /* OMPI_HAVE_THREAD_SUPPORT */
if (call_yield && events <= 0) { if (call_yield && events <= 0) {
@ -251,7 +251,7 @@ ompi_progress_register(ompi_progress_callback_t cb)
int ret = OMPI_SUCCESS; int ret = OMPI_SUCCESS;
#if OMPI_HAVE_THREAD_SUPPORT #if OMPI_HAVE_THREAD_SUPPORT
ompi_atomic_lock(&progress_lock); opal_atomic_lock(&progress_lock);
#endif #endif
/* see if we need to allocate more space */ /* see if we need to allocate more space */
@ -272,7 +272,7 @@ ompi_progress_register(ompi_progress_callback_t cb)
cleanup: cleanup:
#if OMPI_HAVE_THREAD_SUPPORT #if OMPI_HAVE_THREAD_SUPPORT
ompi_atomic_unlock(&progress_lock); opal_atomic_unlock(&progress_lock);
#endif #endif
return ret; return ret;
@ -285,7 +285,7 @@ ompi_progress_unregister(ompi_progress_callback_t cb)
int ret = OMPI_ERR_NOT_FOUND; int ret = OMPI_ERR_NOT_FOUND;
#if OMPI_HAVE_THREAD_SUPPORT #if OMPI_HAVE_THREAD_SUPPORT
ompi_atomic_lock(&progress_lock); opal_atomic_lock(&progress_lock);
#endif #endif
for (i = 0 ; i < callbacks_len ; ++i) { for (i = 0 ; i < callbacks_len ; ++i) {
@ -313,7 +313,7 @@ ompi_progress_unregister(ompi_progress_callback_t cb)
} }
#if OMPI_HAVE_THREAD_SUPPORT #if OMPI_HAVE_THREAD_SUPPORT
ompi_atomic_unlock(&progress_lock); opal_atomic_unlock(&progress_lock);
#endif #endif
return ret; return ret;
@ -324,7 +324,7 @@ int
ompi_progress_event_increment() ompi_progress_event_increment()
{ {
int32_t val; int32_t val;
val = ompi_atomic_add_32(&event_num_mpi_users, 1); val = opal_atomic_add_32(&event_num_mpi_users, 1);
/* always reset the tick rate - can't hurt */ /* always reset the tick rate - can't hurt */
event_progress_counter = 0; event_progress_counter = 0;
@ -336,7 +336,7 @@ int
ompi_progress_event_decrement() ompi_progress_event_decrement()
{ {
int32_t val; int32_t val;
val = ompi_atomic_sub_32(&event_num_mpi_users, 1); val = opal_atomic_sub_32(&event_num_mpi_users, 1);
if (val >= 0) { if (val >= 0) {
event_progress_counter = event_progress_counter_reset; event_progress_counter = event_progress_counter_reset;
} }

Просмотреть файл

@ -44,8 +44,8 @@ static void ompi_mutex_construct(ompi_mutex_t *m)
#if OMPI_HAVE_POSIX_THREADS #if OMPI_HAVE_POSIX_THREADS
pthread_mutex_init(&m->m_lock_pthread, 0); pthread_mutex_init(&m->m_lock_pthread, 0);
#endif #endif
#if OMPI_HAVE_ATOMIC_SPINLOCKS #if OPAL_HAVE_ATOMIC_SPINLOCKS
ompi_atomic_init( &m->m_lock_atomic, OMPI_ATOMIC_UNLOCKED ); opal_atomic_init( &m->m_lock_atomic, OPAL_ATOMIC_UNLOCKED );
#endif #endif
} }

Просмотреть файл

@ -250,7 +250,7 @@ static inline bool ompi_set_using_threads(bool have)
#if OMPI_HAVE_THREAD_SUPPORT #if OMPI_HAVE_THREAD_SUPPORT
#define OMPI_THREAD_ADD32(x,y) \ #define OMPI_THREAD_ADD32(x,y) \
((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \ ((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \
ompi_atomic_add_32(x,y) : (*x += y)) opal_atomic_add_32(x,y) : (*x += y))
#else #else
#define OMPI_THREAD_ADD32(x,y) (*x += y) #define OMPI_THREAD_ADD32(x,y) (*x += y)
#endif #endif
@ -258,7 +258,7 @@ static inline bool ompi_set_using_threads(bool have)
#if OMPI_HAVE_THREAD_SUPPORT #if OMPI_HAVE_THREAD_SUPPORT
#define OMPI_THREAD_ADD64(x,y) \ #define OMPI_THREAD_ADD64(x,y) \
((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \ ((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \
ompi_atomic_add_64(x,y) : (*x += y)) opal_atomic_add_64(x,y) : (*x += y))
#else #else
#define OMPI_THREAD_ADD64(x,y) (*x += y) #define OMPI_THREAD_ADD64(x,y) (*x += y)
#endif #endif
@ -267,11 +267,11 @@ static inline bool ompi_set_using_threads(bool have)
#if OMPI_SIZEOF_SIZE_T == 4 #if OMPI_SIZEOF_SIZE_T == 4
#define OMPI_THREAD_ADD_SIZE_T(x,y) \ #define OMPI_THREAD_ADD_SIZE_T(x,y) \
((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \ ((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \
ompi_atomic_add_32(x,y) : (*x += y)) opal_atomic_add_32(x,y) : (*x += y))
#elif OMPI_SIZEOF_SIZE_T == 8 #elif OMPI_SIZEOF_SIZE_T == 8
#define OMPI_THREAD_ADD_SIZE_T(x,y) \ #define OMPI_THREAD_ADD_SIZE_T(x,y) \
((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \ ((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \
ompi_atomic_add_64(x,y) : (*x += y)) opal_atomic_add_64(x,y) : (*x += y))
#endif #endif
#else #else
#define OMPI_THREAD_ADD_SIZE_T(x,y) (*x += y) #define OMPI_THREAD_ADD_SIZE_T(x,y) (*x += y)

Просмотреть файл

@ -46,13 +46,13 @@ struct ompi_mutex_t {
#if OMPI_HAVE_POSIX_THREADS #if OMPI_HAVE_POSIX_THREADS
pthread_mutex_t m_lock_pthread; pthread_mutex_t m_lock_pthread;
#endif #endif
ompi_lock_t m_lock_atomic; opal_atomic_lock_t m_lock_atomic;
}; };
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_mutex_t); OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_mutex_t);
#if OMPI_HAVE_ATOMIC_SPINLOCKS && OMPI_HAVE_POSIX_THREADS #if OPAL_HAVE_ATOMIC_SPINLOCKS && OMPI_HAVE_POSIX_THREADS
/* /*
* ompi_mutex_* implemented using pthreads * ompi_mutex_* implemented using pthreads
@ -77,17 +77,17 @@ static inline void ompi_mutex_unlock(ompi_mutex_t *m)
static inline void ompi_mutex_atomic_lock(ompi_mutex_t *m) static inline void ompi_mutex_atomic_lock(ompi_mutex_t *m)
{ {
ompi_atomic_lock(&m->m_lock_atomic); opal_atomic_lock(&m->m_lock_atomic);
} }
static inline int ompi_mutex_atomic_trylock(ompi_mutex_t *m) static inline int ompi_mutex_atomic_trylock(ompi_mutex_t *m)
{ {
return ompi_atomic_trylock(&m->m_lock_atomic); return opal_atomic_trylock(&m->m_lock_atomic);
} }
static inline void ompi_mutex_atomic_unlock(ompi_mutex_t *m) static inline void ompi_mutex_atomic_unlock(ompi_mutex_t *m)
{ {
ompi_atomic_unlock(&m->m_lock_atomic); opal_atomic_unlock(&m->m_lock_atomic);
} }
@ -129,7 +129,7 @@ static inline void ompi_mutex_atomic_unlock(ompi_mutex_t *m)
} }
#elif OMPI_HAVE_ATOMIC_SPINLOCKS #elif OPAL_HAVE_ATOMIC_SPINLOCKS
/* /*
* ompi_mutex_* and ompi_mutex_atomic_* implemented using atomic * ompi_mutex_* and ompi_mutex_atomic_* implemented using atomic
@ -138,17 +138,17 @@ static inline void ompi_mutex_atomic_unlock(ompi_mutex_t *m)
static inline int ompi_mutex_trylock(ompi_mutex_t *m) static inline int ompi_mutex_trylock(ompi_mutex_t *m)
{ {
return ompi_atomic_trylock(&m->m_lock_atomic); return opal_atomic_trylock(&m->m_lock_atomic);
} }
static inline void ompi_mutex_lock(ompi_mutex_t *m) static inline void ompi_mutex_lock(ompi_mutex_t *m)
{ {
ompi_atomic_lock(&m->m_lock_atomic); opal_atomic_lock(&m->m_lock_atomic);
} }
static inline void ompi_mutex_unlock(ompi_mutex_t *m) static inline void ompi_mutex_unlock(ompi_mutex_t *m)
{ {
ompi_atomic_unlock(&m->m_lock_atomic); opal_atomic_unlock(&m->m_lock_atomic);
} }

Просмотреть файл

@ -22,15 +22,15 @@
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
#if OMPI_HAVE_ATOMIC_MEM_BARRIER #if OPAL_HAVE_ATOMIC_MEM_BARRIER
/* there really isn't a great way to test that the barriers /* there really isn't a great way to test that the barriers
actually barrier, but at least make sure they don't kill the actually barrier, but at least make sure they don't kill the
machine.*/ machine.*/
ompi_atomic_mb(); opal_atomic_mb();
ompi_atomic_rmb(); opal_atomic_rmb();
ompi_atomic_wmb(); opal_atomic_wmb();
return 0; return 0;
#else #else

Просмотреть файл

@ -42,7 +42,7 @@ int32_t val32;
int32_t old32; int32_t old32;
int32_t new32; int32_t new32;
#if OMPI_HAVE_ATOMIC_MATH_64 #if OPAL_HAVE_ATOMIC_MATH_64
volatile int64_t vol64; volatile int64_t vol64;
int64_t val64; int64_t val64;
int64_t old64; int64_t old64;
@ -68,11 +68,11 @@ static void *thread_main(void *arg)
/* thread tests */ /* thread tests */
for (i = 0; i < nreps; i++) { for (i = 0; i < nreps; i++) {
ompi_atomic_add_32(&val32, 5); opal_atomic_add_32(&val32, 5);
#if OMPI_HAVE_ATOMIC_MATH_64 #if OPAL_HAVE_ATOMIC_MATH_64
ompi_atomic_add_64(&val64, 5); opal_atomic_add_64(&val64, 5);
#endif #endif
ompi_atomic_add(&valint, 5); opal_atomic_add(&valint, 5);
} }
return (void *) (unsigned long) (rank + 1000); return (void *) (unsigned long) (rank + 1000);
@ -99,151 +99,151 @@ int main(int argc, char *argv[])
/* -- cmpset 32-bit tests -- */ /* -- cmpset 32-bit tests -- */
vol32 = 42, old32 = 42, new32 = 50; vol32 = 42, old32 = 42, new32 = 50;
assert(ompi_atomic_cmpset_32(&vol32, old32, new32) == 1); assert(opal_atomic_cmpset_32(&vol32, old32, new32) == 1);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(vol32 == new32); assert(vol32 == new32);
vol32 = 42, old32 = 420, new32 = 50; vol32 = 42, old32 = 420, new32 = 50;
assert(ompi_atomic_cmpset_32(&vol32, old32, new32) == 0); assert(opal_atomic_cmpset_32(&vol32, old32, new32) == 0);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(vol32 == 42); assert(vol32 == 42);
vol32 = 42, old32 = 42, new32 = 50; vol32 = 42, old32 = 42, new32 = 50;
assert(ompi_atomic_cmpset_acq_32(&vol32, old32, new32) == 1); assert(opal_atomic_cmpset_acq_32(&vol32, old32, new32) == 1);
assert(vol32 == new32); assert(vol32 == new32);
vol32 = 42, old32 = 420, new32 = 50; vol32 = 42, old32 = 420, new32 = 50;
assert(ompi_atomic_cmpset_acq_32(&vol32, old32, new32) == 0); assert(opal_atomic_cmpset_acq_32(&vol32, old32, new32) == 0);
assert(vol32 == 42); assert(vol32 == 42);
vol32 = 42, old32 = 42, new32 = 50; vol32 = 42, old32 = 42, new32 = 50;
assert(ompi_atomic_cmpset_rel_32(&vol32, old32, new32) == 1); assert(opal_atomic_cmpset_rel_32(&vol32, old32, new32) == 1);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(vol32 == new32); assert(vol32 == new32);
vol32 = 42, old32 = 420, new32 = 50; vol32 = 42, old32 = 420, new32 = 50;
assert(ompi_atomic_cmpset_rel_32(&vol32, old32, new32) == 0); assert(opal_atomic_cmpset_rel_32(&vol32, old32, new32) == 0);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(vol32 == 42); assert(vol32 == 42);
/* -- cmpset 64-bit tests -- */ /* -- cmpset 64-bit tests -- */
#if OMPI_HAVE_ATOMIC_MATH_64 #if OPAL_HAVE_ATOMIC_MATH_64
vol64 = 42, old64 = 42, new64 = 50; vol64 = 42, old64 = 42, new64 = 50;
assert(1 == ompi_atomic_cmpset_64(&vol64, old64, new64)); assert(1 == opal_atomic_cmpset_64(&vol64, old64, new64));
ompi_atomic_rmb(); opal_atomic_rmb();
assert(new64 == vol64); assert(new64 == vol64);
vol64 = 42, old64 = 420, new64 = 50; vol64 = 42, old64 = 420, new64 = 50;
assert(ompi_atomic_cmpset_64(&vol64, old64, new64) == 0); assert(opal_atomic_cmpset_64(&vol64, old64, new64) == 0);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(vol64 == 42); assert(vol64 == 42);
vol64 = 42, old64 = 42, new64 = 50; vol64 = 42, old64 = 42, new64 = 50;
assert(ompi_atomic_cmpset_acq_64(&vol64, old64, new64) == 1); assert(opal_atomic_cmpset_acq_64(&vol64, old64, new64) == 1);
assert(vol64 == new64); assert(vol64 == new64);
vol64 = 42, old64 = 420, new64 = 50; vol64 = 42, old64 = 420, new64 = 50;
assert(ompi_atomic_cmpset_acq_64(&vol64, old64, new64) == 0); assert(opal_atomic_cmpset_acq_64(&vol64, old64, new64) == 0);
assert(vol64 == 42); assert(vol64 == 42);
vol64 = 42, old64 = 42, new64 = 50; vol64 = 42, old64 = 42, new64 = 50;
assert(ompi_atomic_cmpset_rel_64(&vol64, old64, new64) == 1); assert(opal_atomic_cmpset_rel_64(&vol64, old64, new64) == 1);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(vol64 == new64); assert(vol64 == new64);
vol64 = 42, old64 = 420, new64 = 50; vol64 = 42, old64 = 420, new64 = 50;
assert(ompi_atomic_cmpset_rel_64(&vol64, old64, new64) == 0); assert(opal_atomic_cmpset_rel_64(&vol64, old64, new64) == 0);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(vol64 == 42); assert(vol64 == 42);
#endif #endif
/* -- cmpset int tests -- */ /* -- cmpset int tests -- */
volint = 42, oldint = 42, newint = 50; volint = 42, oldint = 42, newint = 50;
assert(ompi_atomic_cmpset(&volint, oldint, newint) == 1); assert(opal_atomic_cmpset(&volint, oldint, newint) == 1);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(volint ==newint); assert(volint ==newint);
volint = 42, oldint = 420, newint = 50; volint = 42, oldint = 420, newint = 50;
assert(ompi_atomic_cmpset(&volint, oldint, newint) == 0); assert(opal_atomic_cmpset(&volint, oldint, newint) == 0);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(volint == 42); assert(volint == 42);
volint = 42, oldint = 42, newint = 50; volint = 42, oldint = 42, newint = 50;
assert(ompi_atomic_cmpset_acq(&volint, oldint, newint) == 1); assert(opal_atomic_cmpset_acq(&volint, oldint, newint) == 1);
assert(volint == newint); assert(volint == newint);
volint = 42, oldint = 420, newint = 50; volint = 42, oldint = 420, newint = 50;
assert(ompi_atomic_cmpset_acq(&volint, oldint, newint) == 0); assert(opal_atomic_cmpset_acq(&volint, oldint, newint) == 0);
assert(volint == 42); assert(volint == 42);
volint = 42, oldint = 42, newint = 50; volint = 42, oldint = 42, newint = 50;
assert(ompi_atomic_cmpset_rel(&volint, oldint, newint) == 1); assert(opal_atomic_cmpset_rel(&volint, oldint, newint) == 1);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(volint == newint); assert(volint == newint);
volint = 42, oldint = 420, newint = 50; volint = 42, oldint = 420, newint = 50;
assert(ompi_atomic_cmpset_rel(&volint, oldint, newint) == 0); assert(opal_atomic_cmpset_rel(&volint, oldint, newint) == 0);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(volint == 42); assert(volint == 42);
/* -- cmpset ptr tests -- */ /* -- cmpset ptr tests -- */
volptr = (void *) 42, oldptr = (void *) 42, newptr = (void *) 50; volptr = (void *) 42, oldptr = (void *) 42, newptr = (void *) 50;
assert(ompi_atomic_cmpset_ptr(&volptr, oldptr, newptr) == 1); assert(opal_atomic_cmpset_ptr(&volptr, oldptr, newptr) == 1);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(volptr == newptr); assert(volptr == newptr);
volptr = (void *) 42, oldptr = (void *) 420, newptr = (void *) 50; volptr = (void *) 42, oldptr = (void *) 420, newptr = (void *) 50;
assert(ompi_atomic_cmpset_ptr(&volptr, oldptr, newptr) == 0); assert(opal_atomic_cmpset_ptr(&volptr, oldptr, newptr) == 0);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(volptr == (void *) 42); assert(volptr == (void *) 42);
volptr = (void *) 42, oldptr = (void *) 42, newptr = (void *) 50; volptr = (void *) 42, oldptr = (void *) 42, newptr = (void *) 50;
assert(ompi_atomic_cmpset_acq_ptr(&volptr, oldptr, newptr) == 1); assert(opal_atomic_cmpset_acq_ptr(&volptr, oldptr, newptr) == 1);
assert(volptr == newptr); assert(volptr == newptr);
volptr = (void *) 42, oldptr = (void *) 420, newptr = (void *) 50; volptr = (void *) 42, oldptr = (void *) 420, newptr = (void *) 50;
assert(ompi_atomic_cmpset_acq_ptr(&volptr, oldptr, newptr) == 0); assert(opal_atomic_cmpset_acq_ptr(&volptr, oldptr, newptr) == 0);
assert(volptr == (void *) 42); assert(volptr == (void *) 42);
volptr = (void *) 42, oldptr = (void *) 42, newptr = (void *) 50; volptr = (void *) 42, oldptr = (void *) 42, newptr = (void *) 50;
assert(ompi_atomic_cmpset_rel_ptr(&volptr, oldptr, newptr) == 1); assert(opal_atomic_cmpset_rel_ptr(&volptr, oldptr, newptr) == 1);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(volptr == newptr); assert(volptr == newptr);
volptr = (void *) 42, oldptr = (void *) 420, newptr = (void *) 50; volptr = (void *) 42, oldptr = (void *) 420, newptr = (void *) 50;
assert(ompi_atomic_cmpset_rel_ptr(&volptr, oldptr, newptr) == 0); assert(opal_atomic_cmpset_rel_ptr(&volptr, oldptr, newptr) == 0);
ompi_atomic_rmb(); opal_atomic_rmb();
assert(volptr == (void *) 42); assert(volptr == (void *) 42);
/* -- add_32 tests -- */ /* -- add_32 tests -- */
val32 = 42; val32 = 42;
assert(ompi_atomic_add_32(&val32, 5) == (42 + 5)); assert(opal_atomic_add_32(&val32, 5) == (42 + 5));
ompi_atomic_rmb(); opal_atomic_rmb();
assert((42 + 5) == val32); assert((42 + 5) == val32);
/* -- add_64 tests -- */ /* -- add_64 tests -- */
#if OMPI_HAVE_ATOMIC_MATH_64 #if OPAL_HAVE_ATOMIC_MATH_64
val64 = 42; val64 = 42;
assert(ompi_atomic_add_64(&val64, 5) == (42 + 5)); assert(opal_atomic_add_64(&val64, 5) == (42 + 5));
ompi_atomic_rmb(); opal_atomic_rmb();
assert((42 + 5) == val64); assert((42 + 5) == val64);
#endif #endif
/* -- add_int tests -- */ /* -- add_int tests -- */
valint = 42; valint = 42;
ompi_atomic_add(&valint, 5); opal_atomic_add(&valint, 5);
ompi_atomic_rmb(); opal_atomic_rmb();
assert((42 + 5) == valint); assert((42 + 5) == valint);
/* threaded tests */ /* threaded tests */
val32 = 0; val32 = 0;
#if OMPI_HAVE_ATOMIC_MATH_64 #if OPAL_HAVE_ATOMIC_MATH_64
val64 = 0ul; val64 = 0ul;
#endif #endif
valint = 0; valint = 0;
@ -274,13 +274,13 @@ int main(int argc, char *argv[])
} }
free(th); free(th);
ompi_atomic_rmb(); opal_atomic_rmb();
assert((5 * nthreads * nreps) == val32); assert((5 * nthreads * nreps) == val32);
#if OMPI_HAVE_ATOMIC_MATH_64 #if OPAL_HAVE_ATOMIC_MATH_64
ompi_atomic_rmb(); opal_atomic_rmb();
assert((5 * nthreads * nreps) == val64); assert((5 * nthreads * nreps) == val64);
#endif #endif
ompi_atomic_rmb(); opal_atomic_rmb();
assert((5 * nthreads * nreps) == valint); assert((5 * nthreads * nreps) == valint);
#endif #endif

Просмотреть файл

@ -28,7 +28,7 @@
#define TEST_REPS 500 #define TEST_REPS 500
int32_t val32 = 0; int32_t val32 = 0;
#if OMPI_HAVE_ATOMIC_MATH_64 #if OPAL_HAVE_ATOMIC_MATH_64
int64_t val64 = 0; int64_t val64 = 0;
#endif #endif
int valint = 0; int valint = 0;
@ -39,11 +39,11 @@ static void* atomic_math_test(void* arg)
int i; int i;
for (i = 0 ; i < count ; ++i) { for (i = 0 ; i < count ; ++i) {
ompi_atomic_add_32(&val32, 5); opal_atomic_add_32(&val32, 5);
#if OMPI_HAVE_ATOMIC_MATH_64 #if OPAL_HAVE_ATOMIC_MATH_64
ompi_atomic_add_64(&val64, 6); opal_atomic_add_64(&val64, 6);
#endif #endif
ompi_atomic_add(&valint, 4); opal_atomic_add(&valint, 4);
} }
return NULL; return NULL;
@ -117,17 +117,17 @@ main(int argc, char *argv[])
ret = atomic_math_test_th(TEST_REPS, num_threads); ret = atomic_math_test_th(TEST_REPS, num_threads);
if (ret == 77) return ret; if (ret == 77) return ret;
ompi_atomic_mb(); opal_atomic_mb();
if (val32 != TEST_REPS * num_threads * 5) { if (val32 != TEST_REPS * num_threads * 5) {
printf("ompi_atomic_add32 failed. Expected %d, got %d.\n", printf("opal_atomic_add32 failed. Expected %d, got %d.\n",
TEST_REPS * num_threads * 5, val32); TEST_REPS * num_threads * 5, val32);
ret = 1; ret = 1;
} }
#if OMPI_HAVE_ATOMIC_MATH_64 #if OPAL_HAVE_ATOMIC_MATH_64
if (val64 != TEST_REPS * num_threads * 6) { if (val64 != TEST_REPS * num_threads * 6) {
/* Safe to case to (int) here because we know it's going to be /* Safe to case to (int) here because we know it's going to be
a small value */ a small value */
printf("ompi_atomic_add32 failed. Expected %d, got %d.\n", printf("opal_atomic_add32 failed. Expected %d, got %d.\n",
TEST_REPS * num_threads * 6, (int) val64); TEST_REPS * num_threads * 6, (int) val64);
ret = 1; ret = 1;
} }
@ -135,7 +135,7 @@ main(int argc, char *argv[])
printf(" * skipping 64 bit tests\n"); printf(" * skipping 64 bit tests\n");
#endif #endif
if (valint != TEST_REPS * num_threads * 4) { if (valint != TEST_REPS * num_threads * 4) {
printf("ompi_atomic_add32 failed. Expected %d, got %d.\n", printf("opal_atomic_add32 failed. Expected %d, got %d.\n",
TEST_REPS * num_threads * 4, valint); TEST_REPS * num_threads * 4, valint);
ret = 1; ret = 1;
} }

Просмотреть файл

@ -32,10 +32,10 @@ int atomic_verbose = 0;
struct start_info { struct start_info {
int tid; int tid;
int count; int count;
ompi_lock_t *lock; opal_atomic_lock_t *lock;
}; };
static int atomic_spinlock_test(ompi_lock_t *lock, int count, int id); static int atomic_spinlock_test(opal_atomic_lock_t *lock, int count, int id);
#if OMPI_HAVE_POSIX_THREADS #if OMPI_HAVE_POSIX_THREADS
static void* atomic_spinlock_start(void* arg) static void* atomic_spinlock_start(void* arg)
@ -49,7 +49,7 @@ static void* atomic_spinlock_start(void* arg)
static int static int
atomic_spinlock_test_th(ompi_lock_t *lock, int count, int id, int thr_count) atomic_spinlock_test_th(opal_atomic_lock_t *lock, int count, int id, int thr_count)
{ {
#if OMPI_HAVE_POSIX_THREADS #if OMPI_HAVE_POSIX_THREADS
pthread_t *th; pthread_t *th;
@ -94,18 +94,18 @@ atomic_spinlock_test_th(ompi_lock_t *lock, int count, int id, int thr_count)
static int static int
atomic_spinlock_test(ompi_lock_t *lock, int count, int id) atomic_spinlock_test(opal_atomic_lock_t *lock, int count, int id)
{ {
int i; int i;
for (i = 0 ; i < count ; ++i) { for (i = 0 ; i < count ; ++i) {
ompi_atomic_lock(lock); opal_atomic_lock(lock);
if (atomic_verbose) { printf("id %03d has the lock (lock)\n", id); } if (atomic_verbose) { printf("id %03d has the lock (lock)\n", id); }
ompi_atomic_unlock(lock); opal_atomic_unlock(lock);
while (ompi_atomic_trylock(lock)) { ; } while (opal_atomic_trylock(lock)) { ; }
if (atomic_verbose) { printf("id %03d has the lock (trylock)\n", id); } if (atomic_verbose) { printf("id %03d has the lock (trylock)\n", id); }
ompi_atomic_unlock(lock); opal_atomic_unlock(lock);
} }
return 0; return 0;
@ -116,7 +116,7 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
int ret = 77; int ret = 77;
ompi_lock_t lock; opal_atomic_lock_t lock;
int num_threads = 1; int num_threads = 1;
if (argc != 2) { if (argc != 2) {
@ -125,7 +125,7 @@ main(int argc, char *argv[])
} }
num_threads = atoi(argv[1]); num_threads = atoi(argv[1]);
ompi_atomic_init(&lock, OMPI_ATOMIC_UNLOCKED); opal_atomic_init(&lock, OPAL_ATOMIC_UNLOCKED);
ret = atomic_spinlock_test_th(&lock, TEST_REPS, 0, num_threads); ret = atomic_spinlock_test_th(&lock, TEST_REPS, 0, num_threads);
return ret; return ret;

Просмотреть файл

@ -25,13 +25,13 @@ static volatile int count = 0;
static void* thr1_run(opal_object_t* obj) static void* thr1_run(opal_object_t* obj)
{ {
ompi_atomic_add(&count, 1); opal_atomic_add(&count, 1);
return NULL; return NULL;
} }
static void* thr2_run(opal_object_t* obj) static void* thr2_run(opal_object_t* obj)
{ {
ompi_atomic_add(&count, 2); opal_atomic_add(&count, 2);
return NULL; return NULL;
} }