From 9da0b4fe1d8dc237a625b4f6ec92f4cbca7f4e11 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Sun, 3 Jul 2005 21:38:51 +0000 Subject: [PATCH] * rename all the atomic functions from ompi to opal This commit was SVN r6325. --- ompi/class/ompi_circular_buffer_fifo.h | 10 +- ompi/class/ompi_fifo.h | 4 +- ompi/mca/btl/sm/btl_sm.c | 8 +- ompi/mca/btl/sm/btl_sm_component.c | 12 +- ompi/mca/btl/sm/btl_sm_fifo.h | 6 +- ompi/mca/common/sm/common_sm_mmap.c | 6 +- ompi/mca/common/sm/common_sm_mmap.h | 2 +- ompi/mca/pml/ob1/pml_ob1_endpoint.h | 4 +- ompi/mca/ptl/elan/src/ptl_elan.c | 2 +- ompi/mca/ptl/elan/src/ptl_elan_frag.c | 4 +- ompi/mca/ptl/elan/src/ptl_elan_priv.c | 2 +- ompi/mca/ptl/gm/ptl_gm.c | 4 +- ompi/mca/ptl/gm/ptl_gm_priv.c | 16 +- ompi/mca/ptl/gm/ptl_gm_sendfrag.c | 2 +- ompi/mca/ptl/mx/ptl_mx_sendfrag.h | 2 +- ompi/mca/ptl/sm/src/ptl_sm.c | 18 +-- ompi/mca/ptl/sm/src/ptl_sm_component.c | 12 +- ompi/mca/ptl/sm/src/ptl_sm_send.c | 6 +- ompi/mca/ptl/tcp/ptl_tcp_recvfrag.h | 2 +- ompi/mca/ptl/tcp/ptl_tcp_sendfrag.h | 2 +- ompi/mpi/c/request_get_status.c | 2 +- ompi/request/req_test.c | 4 +- ompi/request/req_wait.c | 2 +- ompi/request/request.h | 2 +- opal/asm/asm.c | 32 ++-- opal/asm/base/AMD64.asm | 20 +-- opal/asm/base/IA32.asm | 28 ++-- opal/asm/base/IA64.asm | 56 +++---- opal/asm/base/MIPS.asm | 36 ++--- opal/asm/base/POWERPC32.asm | 44 +++--- opal/asm/base/POWERPC64.asm | 52 +++--- opal/asm/base/SPARC.asm | 28 ++-- opal/asm/base/SPARCV9_32.asm | 36 ++--- opal/asm/base/SPARCV9_64.asm | 36 ++--- opal/class/opal_list.c | 2 +- opal/class/opal_object.c | 8 +- opal/class/opal_object.h | 2 +- opal/include/sys/alpha/atomic.h | 40 ++--- opal/include/sys/alpha/update.sh | 2 +- opal/include/sys/amd64/atomic.h | 24 +-- opal/include/sys/amd64/update.sh | 2 +- opal/include/sys/atomic.h | 210 ++++++++++++------------- opal/include/sys/atomic_impl.h | 204 ++++++++++++------------ opal/include/sys/ia32/atomic.h | 34 ++-- opal/include/sys/ia32/update.sh | 2 +- opal/include/sys/ia64/atomic.h | 24 +-- opal/include/sys/ia64/update.sh | 2 +- opal/include/sys/mips/atomic.h | 40 ++--- opal/include/sys/mips/update.sh | 2 +- opal/include/sys/numa.h | 8 +- opal/include/sys/powerpc/atomic.h | 106 ++++++------- opal/include/sys/powerpc/update.sh | 2 +- opal/include/sys/sparc/atomic.h | 32 ++-- opal/include/sys/sparc/update.sh | 2 +- opal/include/sys/sparcv9/atomic.h | 42 ++--- opal/include/sys/sparcv9/update.sh | 2 +- opal/include/sys/win32/atomic.h | 44 +++--- opal/runtime/ompi_progress.c | 24 +-- opal/threads/mutex.c | 4 +- opal/threads/mutex.h | 8 +- opal/threads/mutex_unix.h | 18 +-- test/asm/atomic_barrier.c | 8 +- test/asm/atomic_cmpset.c | 116 +++++++------- test/asm/atomic_math.c | 20 +-- test/asm/atomic_spinlock.c | 20 +-- test/threads/ompi_thread.c | 4 +- 66 files changed, 780 insertions(+), 780 deletions(-) diff --git a/ompi/class/ompi_circular_buffer_fifo.h b/ompi/class/ompi_circular_buffer_fifo.h index 7df0727349..ac0cc2b255 100644 --- a/ompi/class/ompi_circular_buffer_fifo.h +++ b/ompi/class/ompi_circular_buffer_fifo.h @@ -48,7 +48,7 @@ */ struct ompi_cb_fifo_ctl_t { /* spin-lock for access control */ - ompi_lock_t lock; + opal_atomic_lock_t lock; /* current queue 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 */ - ompi_atomic_unlock(&(fifo->head->lock)); + opal_atomic_unlock(&(fifo->head->lock)); fifo->head->fifo_index=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 */ - ompi_atomic_unlock(&(fifo->tail->lock)); + opal_atomic_unlock(&(fifo->tail->lock)); fifo->tail->fifo_index=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 */ - ompi_atomic_unlock(&(fifo->head->lock)); + opal_atomic_unlock(&(fifo->head->lock)); fifo->head->fifo_index=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 */ - ompi_atomic_unlock(&(fifo->tail->lock)); + opal_atomic_unlock(&(fifo->tail->lock)); fifo->tail->fifo_index=0; fifo->tail->num_to_clear=0; diff --git a/ompi/class/ompi_fifo.h b/ompi/class/ompi_fifo.h index 804f212d5e..9ba14bf2e6 100644 --- a/ompi/class/ompi_fifo.h +++ b/ompi/class/ompi_fifo.h @@ -67,8 +67,8 @@ struct ompi_fifo_t { volatile ompi_cb_fifo_wrapper_t *tail; /* locks for thread synchronization */ - ompi_lock_t head_lock; - ompi_lock_t tail_lock; + opal_atomic_lock_t head_lock; + opal_atomic_lock_t tail_lock; }; diff --git a/ompi/mca/btl/sm/btl_sm.c b/ompi/mca/btl/sm/btl_sm.c index db0f1515bd..4e42a982f9 100644 --- a/ompi/mca/btl/sm/btl_sm.c +++ b/ompi/mca/btl/sm/btl_sm.c @@ -400,7 +400,7 @@ int mca_btl_sm_add_procs_same_base_addr( /* memory barrier to ensure this flag is set before other * flags are set */ - ompi_atomic_mb(); + opal_atomic_mb(); } /* 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); /* memory barrier to ensure this flag is set before other * flags are set */ - ompi_atomic_mb(); + opal_atomic_mb(); mca_btl_sm_component.sm_ctl_header->segment_header. 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++ ) { my_fifos[j].head=OMPI_CB_FREE; my_fifos[j].tail=OMPI_CB_FREE; - ompi_atomic_unlock(&(my_fifos[j].head_lock)); - ompi_atomic_unlock(&(my_fifos[j].tail_lock)); + opal_atomic_unlock(&(my_fifos[j].head_lock)); + opal_atomic_unlock(&(my_fifos[j].tail_lock)); } fifo_tmp=(ompi_fifo_t * volatile *) ( (char *)(mca_btl_sm_component.sm_ctl_header->fifo) + diff --git a/ompi/mca/btl/sm/btl_sm_component.c b/ompi/mca/btl/sm/btl_sm_component.c index ff2896bad4..dab460aa09 100644 --- a/ompi/mca/btl/sm/btl_sm_component.c +++ b/ompi/mca/btl/sm/btl_sm_component.c @@ -347,7 +347,7 @@ int mca_btl_sm_component_progress(void) /* aquire thread lock */ 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 @@ -357,14 +357,14 @@ int mca_btl_sm_component_progress(void) if( OMPI_CB_FREE == frag ) { /* release thread lock */ if( ompi_using_threads() ) { - ompi_atomic_unlock(&(fifo->tail_lock)); + opal_atomic_unlock(&(fifo->tail_lock)); } continue; } /* release thread lock */ if( ompi_using_threads() ) { - ompi_atomic_unlock(&(fifo->tail_lock)); + opal_atomic_unlock(&(fifo->tail_lock)); } /* dispatch fragment by type */ @@ -424,7 +424,7 @@ int mca_btl_sm_component_progress(void) /* aquire thread lock */ 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 @@ -434,14 +434,14 @@ int mca_btl_sm_component_progress(void) if( OMPI_CB_FREE == frag ) { /* release thread lock */ if( ompi_using_threads() ) { - ompi_atomic_unlock(&(fifo->tail_lock)); + opal_atomic_unlock(&(fifo->tail_lock)); } continue; } /* release thread lock */ 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 diff --git a/ompi/mca/btl/sm/btl_sm_fifo.h b/ompi/mca/btl/sm/btl_sm_fifo.h index 8cc2bbf4fd..31892117ae 100644 --- a/ompi/mca/btl/sm/btl_sm_fifo.h +++ b/ompi/mca/btl/sm/btl_sm_fifo.h @@ -12,7 +12,7 @@ do { \ \ /* thread lock */ \ if(ompi_using_threads()) \ - ompi_atomic_lock(&fifo->head_lock); \ + opal_atomic_lock(&fifo->head_lock); \ if(OMPI_CB_FREE == fifo->head) { \ /* no queues have been allocated - allocate now */ \ rc=ompi_fifo_init_same_base_addr( \ @@ -24,7 +24,7 @@ do { \ fifo, mca_btl_sm_component.sm_mpool); \ if( rc != OMPI_SUCCESS ) { \ if(ompi_using_threads()) \ - ompi_atomic_unlock(&(fifo->head_lock)); \ + opal_atomic_unlock(&(fifo->head_lock)); \ break; \ } \ } \ @@ -37,7 +37,7 @@ do { \ rc=OMPI_SUCCESS; \ } \ if(ompi_using_threads()) \ - ompi_atomic_unlock(&fifo->head_lock); \ + opal_atomic_unlock(&fifo->head_lock); \ } while(0) diff --git a/ompi/mca/common/sm/common_sm_mmap.c b/ompi/mca/common/sm/common_sm_mmap.c index 3323658722..ff9723c73a 100644 --- a/ompi/mca/common/sm/common_sm_mmap.c +++ b/ompi/mca/common/sm/common_sm_mmap.c @@ -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 */ if( !file_previously_opened ) { - ompi_atomic_unlock(&seg->seg_lock); + opal_atomic_unlock(&seg->seg_lock); seg->seg_inited = false; seg->seg_offset = mem_offset; 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; void* addr; - ompi_atomic_lock(&seg->seg_lock); + opal_atomic_lock(&seg->seg_lock); if(seg->seg_offset + *size > map->map_size) { addr = NULL; } else { @@ -230,7 +230,7 @@ void* mca_common_sm_mmap_seg_alloc( addr = map->data_addr + seg->seg_offset; seg->seg_offset += *size; } - ompi_atomic_unlock(&seg->seg_lock); + opal_atomic_unlock(&seg->seg_lock); return addr; } diff --git a/ompi/mca/common/sm/common_sm_mmap.h b/ompi/mca/common/sm/common_sm_mmap.h index 88e52284da..fe5ce44044 100644 --- a/ompi/mca/common/sm/common_sm_mmap.h +++ b/ompi/mca/common/sm/common_sm_mmap.h @@ -33,7 +33,7 @@ struct mca_mpool_base_module_t; struct mca_common_sm_file_header_t { /* lock to control atomic access */ - ompi_lock_t seg_lock; + opal_atomic_lock_t seg_lock; /* is the segment ready for use */ volatile bool seg_inited; diff --git a/ompi/mca/pml/ob1/pml_ob1_endpoint.h b/ompi/mca/pml/ob1/pml_ob1_endpoint.h index 4959799aaa..6a5fffdc0b 100644 --- a/ompi/mca/pml/ob1/pml_ob1_endpoint.h +++ b/ompi/mca/pml/ob1/pml_ob1_endpoint.h @@ -182,7 +182,7 @@ static inline mca_pml_ob1_endpoint_t* mca_pml_ob1_ep_array_find( do { \ if(NULL != (descriptor = endpoint->btl_cache)) { \ /* 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; \ } else { \ 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) \ do { \ 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); \ } \ } else { \ diff --git a/ompi/mca/ptl/elan/src/ptl_elan.c b/ompi/mca/ptl/elan/src/ptl_elan.c index 23f5cecaab..e2ff367091 100644 --- a/ompi/mca/ptl/elan/src/ptl_elan.c +++ b/ompi/mca/ptl/elan/src/ptl_elan.c @@ -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); if (!set) { /* IN TCP case, IO_VEC is first allocated. diff --git a/ompi/mca/ptl/elan/src/ptl_elan_frag.c b/ompi/mca/ptl/elan/src/ptl_elan_frag.c index 86a0506c89..ff3869de38 100644 --- a/ompi/mca/ptl/elan/src/ptl_elan_frag.c +++ b/ompi/mca/ptl/elan/src/ptl_elan_frag.c @@ -172,7 +172,7 @@ mca_ptl_elan_send_desc_done ( #if OMPI_PTL_ELAN_ENABLE_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, (mca_pml_base_recv_request_t *) req, frag->frag_base.frag_size, @@ -198,7 +198,7 @@ mca_ptl_elan_send_desc_done ( (opal_list_item_t *) frag); } else if (0 == (header->hdr_common.hdr_flags & MCA_PTL_FLAGS_ACK) || 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( (struct mca_ptl_base_module_t*) ptl, diff --git a/ompi/mca/ptl/elan/src/ptl_elan_priv.c b/ompi/mca/ptl/elan/src/ptl_elan_priv.c index 47ea09f696..28c9556399 100644 --- a/ompi/mca/ptl/elan/src/ptl_elan_priv.c +++ b/ompi/mca/ptl/elan/src/ptl_elan_priv.c @@ -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_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( (struct mca_ptl_base_module_t*) ptl, req, header->hdr_ack.hdr_dst_size); diff --git a/ompi/mca/ptl/gm/ptl_gm.c b/ompi/mca/ptl/gm/ptl_gm.c index 039f59dc6f..9693982265 100644 --- a/ompi/mca/ptl/gm/ptl_gm.c +++ b/ompi/mca/ptl/gm/ptl_gm.c @@ -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) ); /* 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 @@ -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); OMPI_THREAD_UNLOCK (&mca_ptl_gm_component.gm_lock); } 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 ); hdr = (mca_ptl_base_header_t*)item; diff --git a/ompi/mca/ptl/gm/ptl_gm_priv.c b/ompi/mca/ptl/gm/ptl_gm_priv.c index e4eb2febee..27d89cf3c7 100644 --- a/ompi/mca/ptl/gm/ptl_gm_priv.c +++ b/ompi/mca/ptl/gm/ptl_gm_priv.c @@ -47,7 +47,7 @@ static void mca_ptl_gm_basic_frag_callback( struct gm_port* port, void* context, case GM_SUCCESS: OMPI_GM_FREE_LIST_RETURN( &(gm_ptl->gm_send_dma_frags), ((opal_list_item_t*)header) ); /* release the send token */ - ompi_atomic_add( &(gm_ptl->num_send_tokens), 1 ); + opal_atomic_add( &(gm_ptl->num_send_tokens), 1 ); break; case GM_SEND_TIMED_OUT: 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; 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->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 ) { opal_list_item_t* item; 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; } 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 ) { 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; } @@ -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) ); /* 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 @@ -523,7 +523,7 @@ int mca_ptl_gm_peer_send( struct mca_ptl_base_module_t* ptl, char* sendbuf; 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; 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) ); /* 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, @@ -668,7 +668,7 @@ static int mca_ptl_gm_send_quick_fin_message( struct mca_ptl_gm_peer_t* ptl_peer int 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->hdr_common.hdr_type = MCA_PTL_HDR_TYPE_FIN; diff --git a/ompi/mca/ptl/gm/ptl_gm_sendfrag.c b/ompi/mca/ptl/gm/ptl_gm_sendfrag.c index 184f0ae09c..a0495580ee 100644 --- a/ompi/mca/ptl/gm/ptl_gm_sendfrag.c +++ b/ompi/mca/ptl/gm/ptl_gm_sendfrag.c @@ -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; /* And then get some DMA memory to put the data */ 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 ); frag->send_buf = (void*)item; diff --git a/ompi/mca/ptl/mx/ptl_mx_sendfrag.h b/ompi/mca/ptl/mx/ptl_mx_sendfrag.h index d7e0fb4391..40351cf43e 100644 --- a/ompi/mca/ptl/mx/ptl_mx_sendfrag.h +++ b/ompi/mca/ptl/mx/ptl_mx_sendfrag.h @@ -103,7 +103,7 @@ do { \ */ \ frag_ack = (frag->frag_send.frag_base.frag_header. \ 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 */ \ frag->frag_send.frag_base.frag_owner->ptl_send_progress( \ diff --git a/ompi/mca/ptl/sm/src/ptl_sm.c b/ompi/mca/ptl/sm/src/ptl_sm.c index 4210493cca..f847408dfb 100644 --- a/ompi/mca/ptl/sm/src/ptl_sm.c +++ b/ompi/mca/ptl/sm/src/ptl_sm.c @@ -409,7 +409,7 @@ int mca_ptl_sm_add_procs_same_base_addr( /* memory barrier to ensure this flag is set before other * flags are set */ - ompi_atomic_mb(); + opal_atomic_mb(); } /* 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); /* memory barrier to ensure this flag is set before other * flags are set */ - ompi_atomic_mb(); + opal_atomic_mb(); mca_ptl_sm_component.sm_ctl_header->segment_header. 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++ ) { my_fifos[j].head=OMPI_CB_FREE; my_fifos[j].tail=OMPI_CB_FREE; - ompi_atomic_unlock(&(my_fifos[j].head_lock)); - ompi_atomic_unlock(&(my_fifos[j].tail_lock)); + opal_atomic_unlock(&(my_fifos[j].head_lock)); + opal_atomic_unlock(&(my_fifos[j].tail_lock)); } fifo_tmp=(ompi_fifo_t * volatile *) ( (char *)(mca_ptl_sm_component.sm_ctl_header->fifo) + @@ -851,7 +851,7 @@ int mca_ptl_sm_send( /* thread lock */ 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) { /* no queues have been allocated - allocate now */ 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); if( return_status != OMPI_SUCCESS ) { if(ompi_using_threads()) - ompi_atomic_unlock(&(send_fifo->head_lock)); + opal_atomic_unlock(&(send_fifo->head_lock)); return return_status; } } @@ -876,7 +876,7 @@ int mca_ptl_sm_send( return_status=OMPI_SUCCESS; } 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(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 * implementation, such mutex's don't work correctly */ if(ompi_using_threads()) - ompi_atomic_lock(&send_fifo->head_lock); + opal_atomic_lock(&send_fifo->head_lock); /* post descriptor */ 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 */ if(ompi_using_threads()) - ompi_atomic_unlock(&send_fifo->head_lock); + opal_atomic_unlock(&send_fifo->head_lock); return return_status; } diff --git a/ompi/mca/ptl/sm/src/ptl_sm_component.c b/ompi/mca/ptl/sm/src/ptl_sm_component.c index e8dcef3fcc..494f7cbbae 100644 --- a/ompi/mca/ptl/sm/src/ptl_sm_component.c +++ b/ompi/mca/ptl/sm/src/ptl_sm_component.c @@ -394,7 +394,7 @@ int mca_ptl_sm_component_progress(mca_ptl_tstamp_t tstamp) /* aquire thread lock */ 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 @@ -404,14 +404,14 @@ int mca_ptl_sm_component_progress(mca_ptl_tstamp_t tstamp) if( OMPI_CB_FREE == header_ptr ) { /* release thread lock */ if( ompi_using_threads() ) { - ompi_atomic_unlock(&(send_fifo->tail_lock)); + opal_atomic_unlock(&(send_fifo->tail_lock)); } continue; } /* release thread lock */ 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 */ @@ -490,7 +490,7 @@ int mca_ptl_sm_component_progress(mca_ptl_tstamp_t tstamp) /* aquire thread lock */ 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 @@ -500,14 +500,14 @@ int mca_ptl_sm_component_progress(mca_ptl_tstamp_t tstamp) if( OMPI_CB_FREE == header_ptr ) { /* release thread lock */ if( ompi_using_threads() ) { - ompi_atomic_unlock(&(send_fifo->tail_lock)); + opal_atomic_unlock(&(send_fifo->tail_lock)); } continue; } /* release thread lock */ 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 diff --git a/ompi/mca/ptl/sm/src/ptl_sm_send.c b/ompi/mca/ptl/sm/src/ptl_sm_send.c index 1b0caade00..f980cd1ae5 100644 --- a/ompi/mca/ptl/sm/src/ptl_sm_send.c +++ b/ompi/mca/ptl/sm/src/ptl_sm_send.c @@ -122,7 +122,7 @@ void mca_ptl_sm_matched( /* lock as multiple processes can attempt to init the head */ 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 */ if(OMPI_CB_FREE == send_fifo->head) { @@ -136,7 +136,7 @@ void mca_ptl_sm_matched( send_fifo, mca_ptl_sm_component.sm_mpool); if( return_status != OMPI_SUCCESS ) { if(ompi_using_threads()) - ompi_atomic_unlock(&send_fifo->head_lock); + opal_atomic_unlock(&send_fifo->head_lock); return; } } @@ -152,7 +152,7 @@ void mca_ptl_sm_matched( send_fifo, mca_ptl_sm_component.sm_mpool); 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( 0 > return_status ) { diff --git a/ompi/mca/ptl/tcp/ptl_tcp_recvfrag.h b/ompi/mca/ptl/tcp/ptl_tcp_recvfrag.h index 580c4f350a..241d93aef0 100644 --- a/ompi/mca/ptl/tcp/ptl_tcp_recvfrag.h +++ b/ompi/mca/ptl/tcp/ptl_tcp_recvfrag.h @@ -131,7 +131,7 @@ static inline void mca_ptl_tcp_recv_frag_progress(mca_ptl_tcp_recv_frag_t* frag) uint32_t iov_count; size_t max_data; 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 * the match has been made and all data has arrived. So this routine is diff --git a/ompi/mca/ptl/tcp/ptl_tcp_sendfrag.h b/ompi/mca/ptl/tcp/ptl_tcp_sendfrag.h index 7551089fe1..c53dc90e5f 100644 --- a/ompi/mca/ptl/tcp/ptl_tcp_sendfrag.h +++ b/ompi/mca/ptl/tcp/ptl_tcp_sendfrag.h @@ -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. 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 */ frag->frag_send.frag_base.frag_owner->ptl_send_progress( diff --git a/ompi/mpi/c/request_get_status.c b/ompi/mpi/c/request_get_status.c index 2544c6e3d8..52598c22a6 100644 --- a/ompi/mpi/c/request_get_status.c +++ b/ompi/mpi/c/request_get_status.c @@ -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) ) { *flag = true; if( MPI_STATUS_IGNORE != status ) { diff --git a/ompi/request/req_test.c b/ompi/request/req_test.c index da3d25d71c..920f5ad6ce 100644 --- a/ompi/request/req_test.c +++ b/ompi/request/req_test.c @@ -32,7 +32,7 @@ int ompi_request_test_any( ompi_request_t **rptr; ompi_request_t *request; - ompi_atomic_mb(); + opal_atomic_mb(); rptr = requests; for (i = 0; i < count; i++, rptr++) { request = *rptr; @@ -79,7 +79,7 @@ int ompi_request_test_all( size_t num_completed = 0; ompi_request_t *request; - ompi_atomic_mb(); + opal_atomic_mb(); rptr = requests; for (i = 0; i < count; i++, rptr++) { request = *rptr; diff --git a/ompi/request/req_wait.c b/ompi/request/req_wait.c index ad37a2293e..de74f77c47 100644 --- a/ompi/request/req_wait.c +++ b/ompi/request/req_wait.c @@ -36,7 +36,7 @@ int ompi_request_wait_any( #if OMPI_ENABLE_PROGRESS_THREADS /* poll for completion */ - ompi_atomic_mb(); + opal_atomic_mb(); for (c = 0; completed < 0 && c < ompi_request_poll_iterations; c++) { rptr = requests; num_requests_null_inactive = 0; diff --git a/ompi/request/request.h b/ompi/request/request.h index 2bbbbd0572..0498352206 100644 --- a/ompi/request/request.h +++ b/ompi/request/request.h @@ -208,7 +208,7 @@ static inline int ompi_request_test( ompi_status_public_t * status) { ompi_request_t *request = *rptr; - ompi_atomic_mb(); + opal_atomic_mb(); if (request == MPI_REQUEST_NULL || request->req_state == OMPI_REQUEST_INACTIVE) { *completed = true; diff --git a/opal/asm/asm.c b/opal/asm/asm.c index 560d58ba4a..246e833a35 100644 --- a/opal/asm/asm.c +++ b/opal/asm/asm.c @@ -29,15 +29,15 @@ (LOCKS_TABLE_SIZE - 1)])) /* have to fix if you change LOCKS_TABLE_SIZE */ -static ompi_lock_t locks_table[LOCKS_TABLE_SIZE] = { - { { OMPI_ATOMIC_UNLOCKED } }, - { { OMPI_ATOMIC_UNLOCKED } }, - { { OMPI_ATOMIC_UNLOCKED } }, - { { OMPI_ATOMIC_UNLOCKED } }, - { { OMPI_ATOMIC_UNLOCKED } }, - { { OMPI_ATOMIC_UNLOCKED } }, - { { OMPI_ATOMIC_UNLOCKED } }, - { { OMPI_ATOMIC_UNLOCKED } } +static opal_atomic_lock_t locks_table[LOCKS_TABLE_SIZE] = { + { { OPAL_ATOMIC_UNLOCKED } }, + { { OPAL_ATOMIC_UNLOCKED } }, + { { OPAL_ATOMIC_UNLOCKED } }, + { { OPAL_ATOMIC_UNLOCKED } }, + { { OPAL_ATOMIC_UNLOCKED } }, + { { OPAL_ATOMIC_UNLOCKED } }, + { { OPAL_ATOMIC_UNLOCKED } }, + { { OPAL_ATOMIC_UNLOCKED } } }; # else /* OMPI_WANT_SMP_LOCKS */ @@ -45,36 +45,36 @@ static ompi_lock_t locks_table[LOCKS_TABLE_SIZE] = { #define LOCKS_TABLE_SIZE 1 #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 */ 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; - ompi_atomic_lock(FIND_LOCK(addr)); + opal_atomic_lock(FIND_LOCK(addr)); ret = (*addr += delta); - ompi_atomic_unlock(FIND_LOCK(addr)); + opal_atomic_unlock(FIND_LOCK(addr)); return ret; } 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; - ompi_atomic_lock(FIND_LOCK(addr)); + opal_atomic_lock(FIND_LOCK(addr)); ret = (*addr -= delta); - ompi_atomic_unlock(FIND_LOCK(addr)); + opal_atomic_unlock(FIND_LOCK(addr)); return ret; } diff --git a/opal/asm/base/AMD64.asm b/opal/asm/base/AMD64.asm index 4f4c95b015..bf57a1844d 100644 --- a/opal/asm/base/AMD64.asm +++ b/opal/asm/base/AMD64.asm @@ -1,31 +1,31 @@ START_FILE TEXT -START_FUNC(ompi_atomic_mb) +START_FUNC(opal_atomic_mb) pushq %rbp movq %rsp, %rbp leave ret -END_FUNC(ompi_atomic_mb) +END_FUNC(opal_atomic_mb) -START_FUNC(ompi_atomic_rmb) +START_FUNC(opal_atomic_rmb) pushq %rbp movq %rsp, %rbp leave ret -END_FUNC(ompi_atomic_rmb) +END_FUNC(opal_atomic_rmb) -START_FUNC(ompi_atomic_wmb) +START_FUNC(opal_atomic_wmb) pushq %rbp movq %rsp, %rbp leave 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 movq %rsp, %rbp movq %rdi, -8(%rbp) @@ -48,10 +48,10 @@ START_FUNC(ompi_atomic_cmpset_32) movl -28(%rbp), %eax leave 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 movq %rsp, %rbp movq %rdi, -8(%rbp) @@ -71,4 +71,4 @@ START_FUNC(ompi_atomic_cmpset_64) movzbl %al, %eax leave ret -END_FUNC(ompi_atomic_cmpset_64) +END_FUNC(opal_atomic_cmpset_64) diff --git a/opal/asm/base/IA32.asm b/opal/asm/base/IA32.asm index 197e64d1f8..ddfdaf5337 100644 --- a/opal/asm/base/IA32.asm +++ b/opal/asm/base/IA32.asm @@ -1,31 +1,31 @@ START_FILE TEXT -START_FUNC(ompi_atomic_mb) +START_FUNC(opal_atomic_mb) pushl %ebp movl %esp, %ebp leave ret -END_FUNC(ompi_atomic_mb) +END_FUNC(opal_atomic_mb) -START_FUNC(ompi_atomic_rmb) +START_FUNC(opal_atomic_rmb) pushl %ebp movl %esp, %ebp leave ret -END_FUNC(ompi_atomic_rmb) +END_FUNC(opal_atomic_rmb) -START_FUNC(ompi_atomic_wmb) +START_FUNC(opal_atomic_wmb) pushl %ebp movl %esp, %ebp leave 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 movl %esp, %ebp movl 8(%ebp), %edx @@ -39,10 +39,10 @@ START_FUNC(ompi_atomic_cmpset_32) movzbl %dl, %eax leave 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 movl %esp, %ebp subl $32, %esp @@ -78,10 +78,10 @@ START_FUNC(ompi_atomic_cmpset_64) movl %ebp, %esp popl %ebp 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 movl %esp, %ebp movl 8(%ebp), %eax @@ -92,10 +92,10 @@ START_FUNC(ompi_atomic_add_32) movl (%eax), %eax leave 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 movl %esp, %ebp movl 8(%ebp), %eax @@ -106,4 +106,4 @@ START_FUNC(ompi_atomic_sub_32) movl (%eax), %eax leave ret -END_FUNC(ompi_atomic_sub_32) +END_FUNC(opal_atomic_sub_32) diff --git a/opal/asm/base/IA64.asm b/opal/asm/base/IA64.asm index 39c7be4cc4..fc1472434c 100644 --- a/opal/asm/base/IA64.asm +++ b/opal/asm/base/IA64.asm @@ -3,36 +3,36 @@ START_FILE .pred.safe_across_calls p1-p5,p16-p63 .text .align 16 - .global ompi_atomic_mb# - .proc ompi_atomic_mb# -ompi_atomic_mb: + .global opal_atomic_mb# + .proc opal_atomic_mb# +opal_atomic_mb: .prologue .body br.ret.sptk.many b0 ;; - .endp ompi_atomic_mb# + .endp opal_atomic_mb# .align 16 - .global ompi_atomic_rmb# - .proc ompi_atomic_rmb# -ompi_atomic_rmb: + .global opal_atomic_rmb# + .proc opal_atomic_rmb# +opal_atomic_rmb: .prologue .body br.ret.sptk.many b0 ;; - .endp ompi_atomic_rmb# + .endp opal_atomic_rmb# .align 16 - .global ompi_atomic_wmb# - .proc ompi_atomic_wmb# -ompi_atomic_wmb: + .global opal_atomic_wmb# + .proc opal_atomic_wmb# +opal_atomic_wmb: .prologue .body br.ret.sptk.many b0 ;; - .endp ompi_atomic_wmb# + .endp opal_atomic_wmb# .align 16 - .global ompi_atomic_cmpset_acq_32# - .proc ompi_atomic_cmpset_acq_32# -ompi_atomic_cmpset_acq_32: + .global opal_atomic_cmpset_acq_32# + .proc opal_atomic_cmpset_acq_32# +opal_atomic_cmpset_acq_32: .prologue .body mov ar.ccv=r33;; @@ -44,11 +44,11 @@ ompi_atomic_cmpset_acq_32: (p7) mov r8 = r0 br.ret.sptk.many b0 ;; - .endp ompi_atomic_cmpset_acq_32# + .endp opal_atomic_cmpset_acq_32# .align 16 - .global ompi_atomic_cmpset_rel_32# - .proc ompi_atomic_cmpset_rel_32# -ompi_atomic_cmpset_rel_32: + .global opal_atomic_cmpset_rel_32# + .proc opal_atomic_cmpset_rel_32# +opal_atomic_cmpset_rel_32: .prologue .body mov ar.ccv=r33;; @@ -60,11 +60,11 @@ ompi_atomic_cmpset_rel_32: (p7) mov r8 = r0 br.ret.sptk.many b0 ;; - .endp ompi_atomic_cmpset_rel_32# + .endp opal_atomic_cmpset_rel_32# .align 16 - .global ompi_atomic_cmpset_acq_64# - .proc ompi_atomic_cmpset_acq_64# -ompi_atomic_cmpset_acq_64: + .global opal_atomic_cmpset_acq_64# + .proc opal_atomic_cmpset_acq_64# +opal_atomic_cmpset_acq_64: .prologue .body mov ar.ccv=r33;; @@ -78,11 +78,11 @@ ompi_atomic_cmpset_acq_64: (p7) mov r8 = r0 br.ret.sptk.many b0 ;; - .endp ompi_atomic_cmpset_acq_64# + .endp opal_atomic_cmpset_acq_64# .align 16 - .global ompi_atomic_cmpset_rel_64# - .proc ompi_atomic_cmpset_rel_64# -ompi_atomic_cmpset_rel_64: + .global opal_atomic_cmpset_rel_64# + .proc opal_atomic_cmpset_rel_64# +opal_atomic_cmpset_rel_64: .prologue .body mov ar.ccv=r33;; @@ -96,5 +96,5 @@ ompi_atomic_cmpset_rel_64: (p7) mov r8 = r0 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)" diff --git a/opal/asm/base/MIPS.asm b/opal/asm/base/MIPS.asm index dafb3f9e39..fab445ad50 100644 --- a/opal/asm/base/MIPS.asm +++ b/opal/asm/base/MIPS.asm @@ -6,32 +6,32 @@ START_FILE TEXT ALIGN(8) -LEAF(ompi_atomic_mb) +LEAF(opal_atomic_mb) #APP sync #NO_APP j ra -END(ompi_atomic_mb) +END(opal_atomic_mb) ALIGN(8) -LEAF(ompi_atomic_rmb) +LEAF(opal_atomic_rmb) #APP sync #NO_APP j ra -END(ompi_atomic_rmb) +END(opal_atomic_rmb) -LEAF(ompi_atomic_wmb) +LEAF(opal_atomic_wmb) #APP sync #NO_APP j ra -END(ompi_atomic_wmb) +END(opal_atomic_wmb) -LEAF(ompi_atomic_cmpset_32) +LEAF(opal_atomic_cmpset_32) #APP .set noreorder retry1: @@ -47,10 +47,10 @@ done1: xor $3,$3,$5 j ra 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 .set noreorder retry2: @@ -67,10 +67,10 @@ done2: xor $3,$3,$5 j ra 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 .set noreorder sync @@ -87,10 +87,10 @@ done3: xor $3,$3,$5 j ra 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 .set noreorder retry4: @@ -106,10 +106,10 @@ done4: xor $4,$3,$5 j ra 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 .set noreorder retry5: @@ -125,10 +125,10 @@ done5: xor $4,$3,$5 j ra 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 .set noreorder sync @@ -145,4 +145,4 @@ done6: xor $4,$3,$5 j ra sltu $3,$4,1 -END(ompi_atomic_cmpset_rel_64) +END(opal_atomic_cmpset_rel_64) diff --git a/opal/asm/base/POWERPC32.asm b/opal/asm/base/POWERPC32.asm index db9328ea23..e613b9ccf1 100644 --- a/opal/asm/base/POWERPC32.asm +++ b/opal/asm/base/POWERPC32.asm @@ -2,25 +2,25 @@ START_FILE TEXT ALIGN(4) -START_FUNC(ompi_atomic_mb) +START_FUNC(opal_atomic_mb) sync blr -END_FUNC(ompi_atomic_mb) +END_FUNC(opal_atomic_mb) -START_FUNC(ompi_atomic_rmb) +START_FUNC(opal_atomic_rmb) lwsync blr -END_FUNC(ompi_atomic_rmb) +END_FUNC(opal_atomic_rmb) -START_FUNC(ompi_atomic_wmb) +START_FUNC(opal_atomic_wmb) eieio 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 cmpw 0, r0, r4 bne- REFLSYM(2) @@ -31,10 +31,10 @@ START_FUNC(ompi_atomic_cmpset_32) subfic r5,r3,0 adde r3,r5,r3 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 cmpw 0, r0, r4 bne- REFLSYM(4) @@ -47,10 +47,10 @@ START_FUNC(ompi_atomic_cmpset_acq_32) adde r3,r5,r3 lwsync 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 LSYM(5) lwarx r0, 0, r3 cmpw 0, r0, r4 @@ -63,10 +63,10 @@ START_FUNC(ompi_atomic_cmpset_rel_32) subfic r5,r3,0 adde r3,r5,r3 blr -END_FUNC(ompi_atomic_cmpset_rel_32) +END_FUNC(opal_atomic_cmpset_rel_32) #START_64BIT -START_FUNC(ompi_atomic_cmpset_64) +START_FUNC(opal_atomic_cmpset_64) stw r4,-32(r1) stw r5,-28(r1) stw r6,-24(r1) @@ -83,10 +83,10 @@ START_FUNC(ompi_atomic_cmpset_64) subfic r5,r3,0 adde r3,r5,r3 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 r5,-28(r1) stw r6,-24(r1) @@ -106,10 +106,10 @@ START_FUNC(ompi_atomic_cmpset_acq_64) blr lwsync 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 r5,-28(r1) stw r6,-24(r1) @@ -130,11 +130,11 @@ START_FUNC(ompi_atomic_cmpset_rel_64) blr lwsync blr -END_FUNC(ompi_atomic_cmpset_rel_64) +END_FUNC(opal_atomic_cmpset_rel_64) #END_64BIT -START_FUNC(ompi_atomic_add_32) +START_FUNC(opal_atomic_add_32) LSYM(13) lwarx r0, 0, r3 add r0, r4, r0 stwcx. r0, 0, r3 @@ -142,10 +142,10 @@ START_FUNC(ompi_atomic_add_32) lwz r3,0(r3) 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 subf r0,r4,r0 stwcx. r0,0,r3 @@ -153,4 +153,4 @@ START_FUNC(ompi_atomic_sub_32) lwz r3,0(r3) blr -END_FUNC(ompi_atomic_sub_32) +END_FUNC(opal_atomic_sub_32) diff --git a/opal/asm/base/POWERPC64.asm b/opal/asm/base/POWERPC64.asm index 103b32957c..c66c441c29 100644 --- a/opal/asm/base/POWERPC64.asm +++ b/opal/asm/base/POWERPC64.asm @@ -2,25 +2,25 @@ START_FILE TEXT ALIGN(4) -START_FUNC(ompi_atomic_mb) +START_FUNC(opal_atomic_mb) sync blr -END_FUNC(ompi_atomic_mb) +END_FUNC(opal_atomic_mb) -START_FUNC(ompi_atomic_rmb) +START_FUNC(opal_atomic_rmb) lwsync blr -END_FUNC(ompi_atomic_rmb) +END_FUNC(opal_atomic_rmb) -START_FUNC(ompi_atomic_wmb) +START_FUNC(opal_atomic_wmb) eieio 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 cmpw 0, r0, r4 bne- REFLSYM(2) @@ -31,27 +31,27 @@ START_FUNC(ompi_atomic_cmpset_32) mfcr r3 rlwinm r3,r3,31,1 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 std r29,-24(r1) std r0,16(r1) stdu r1,-144(r1) - bl REFGSYM(ompi_atomic_cmpset_32) + bl REFGSYM(opal_atomic_cmpset_32) mr r29,r3 - bl REFGSYM(ompi_atomic_rmb) + bl REFGSYM(opal_atomic_rmb) mr r3,r29 addi r1,r1,144 ld r0,16(r1) mtlr r0 ld r29,-24(r1) 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 std r27,-40(r1) std r28,-32(r1) @@ -61,11 +61,11 @@ START_FUNC(ompi_atomic_cmpset_rel_32) mr r29,r3 mr r28,r4 mr r27,r5 - bl REFGSYM(ompi_atomic_wmb) + bl REFGSYM(opal_atomic_wmb) mr r3,r29 mr r4,r28 mr r5,r27 - bl REFGSYM(ompi_atomic_cmpset_32) + bl REFGSYM(opal_atomic_cmpset_32) addi r1,r1,160 ld r0,16(r1) mtlr r0 @@ -73,10 +73,10 @@ START_FUNC(ompi_atomic_cmpset_rel_32) ld r28,-32(r1) ld r29,-24(r1) 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 cmpd 0, r0, r4 bne- REFLSYM(4) @@ -87,10 +87,10 @@ START_FUNC(ompi_atomic_cmpset_64) subfic r5,r3,0 adde r3,r5,r3 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 cmpd 0, r0, r4 bne- REFLSYM(8) @@ -102,10 +102,10 @@ START_FUNC(ompi_atomic_cmpset_acq_64) subfic r5,r3,0 adde r3,r5,r3 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 LSYM(9) ldarx r0, 0, r3 cmpd 0, r0, r4 @@ -117,10 +117,10 @@ START_FUNC(ompi_atomic_cmpset_rel_64) subfic r5,r3,0 adde r3,r5,r3 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 add r0, r4, r0 stwcx. r0, 0, r3 @@ -129,10 +129,10 @@ START_FUNC(ompi_atomic_add_32) lwz r3,0(r3) extsw r3,r3 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 subf r0,r4,r0 stwcx. r0,0,r3 @@ -141,4 +141,4 @@ START_FUNC(ompi_atomic_sub_32) lwz r3,0(r3) extsw r3,r3 blr -END_FUNC(ompi_atomic_sub_32) +END_FUNC(opal_atomic_sub_32) diff --git a/opal/asm/base/SPARC.asm b/opal/asm/base/SPARC.asm index bd24b157f7..66f6fe67b4 100644 --- a/opal/asm/base/SPARC.asm +++ b/opal/asm/base/SPARC.asm @@ -3,40 +3,40 @@ START_FILE ALIGN(4) -START_FUNC(ompi_atomic_mb) +START_FUNC(opal_atomic_mb) !#PROLOGUE# 0 !#PROLOGUE# 1 retl nop -END_FUNC(ompi_atomic_mb) +END_FUNC(opal_atomic_mb) -START_FUNC(ompi_atomic_rmb) +START_FUNC(opal_atomic_rmb) !#PROLOGUE# 0 !#PROLOGUE# 1 retl nop -END_FUNC(ompi_atomic_rmb) +END_FUNC(opal_atomic_rmb) -START_FUNC(ompi_atomic_wmb) +START_FUNC(opal_atomic_wmb) !#PROLOGUE# 0 !#PROLOGUE# 1 retl nop -END_FUNC(ompi_atomic_wmb) +END_FUNC(opal_atomic_wmb) -START_FUNC(ompi_atomic_init) +START_FUNC(opal_atomic_init) !#PROLOGUE# 0 !#PROLOGUE# 1 stb %o1, [%o0] retl nop -END_FUNC(ompi_atomic_init) +END_FUNC(opal_atomic_init) -START_FUNC(ompi_atomic_trylock) +START_FUNC(opal_atomic_trylock) !#PROLOGUE# 0 !#PROLOGUE# 1 ldstub [%o0], %o0 @@ -44,10 +44,10 @@ START_FUNC(ompi_atomic_trylock) subcc %g0, %o0, %g0 retl 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 save %sp, -112, %sp !#PROLOGUE# 1 @@ -66,10 +66,10 @@ LSYM(out) nop ret restore -END_FUNC(ompi_atomic_lock) +END_FUNC(opal_atomic_lock) -START_FUNC(ompi_atomic_unlock) +START_FUNC(opal_atomic_unlock) !#PROLOGUE# 0 !#PROLOGUE# 1 stbar @@ -77,4 +77,4 @@ START_FUNC(ompi_atomic_unlock) retl nop -END_FUNC(ompi_atomic_unlock) +END_FUNC(opal_atomic_unlock) diff --git a/opal/asm/base/SPARCV9_32.asm b/opal/asm/base/SPARCV9_32.asm index 0177902abd..c2f8d8b6ca 100644 --- a/opal/asm/base/SPARCV9_32.asm +++ b/opal/asm/base/SPARCV9_32.asm @@ -4,34 +4,34 @@ START_FILE ALIGN(4) -START_FUNC(ompi_atomic_mb) +START_FUNC(opal_atomic_mb) !#PROLOGUE# 0 !#PROLOGUE# 1 membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad retl nop -END_FUNC(ompi_atomic_mb) +END_FUNC(opal_atomic_mb) -START_FUNC(ompi_atomic_rmb) +START_FUNC(opal_atomic_rmb) !#PROLOGUE# 0 !#PROLOGUE# 1 membar #LoadLoad retl nop -END_FUNC(ompi_atomic_rmb) +END_FUNC(opal_atomic_rmb) -START_FUNC(ompi_atomic_wmb) +START_FUNC(opal_atomic_wmb) !#PROLOGUE# 0 !#PROLOGUE# 1 membar #StoreStore retl 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# 1 casa [%o0] 0x80, %o1, %o2 @@ -39,10 +39,10 @@ START_FUNC(ompi_atomic_cmpset_32) subcc %g0, %o2, %g0 retl 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# 1 casa [%o0] 0x80, %o1, %o2 @@ -52,10 +52,10 @@ START_FUNC(ompi_atomic_cmpset_acq_32) membar #LoadLoad retl 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# 1 membar #StoreStore @@ -64,10 +64,10 @@ START_FUNC(ompi_atomic_cmpset_rel_32) subcc %g0, %o2, %g0 retl 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 save %sp, -128, %sp !#PROLOGUE# 1 @@ -94,10 +94,10 @@ START_FUNC(ompi_atomic_cmpset_64) LSYM(12) ret 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 save %sp, -128, %sp !#PROLOGUE# 1 @@ -126,10 +126,10 @@ LSYM(16) membar #LoadLoad ret 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 save %sp, -128, %sp !#PROLOGUE# 1 @@ -158,4 +158,4 @@ START_FUNC(ompi_atomic_cmpset_rel_64) LSYM(21) ret restore -END_FUNC(ompi_atomic_cmpset_rel_64) +END_FUNC(opal_atomic_cmpset_rel_64) diff --git a/opal/asm/base/SPARCV9_64.asm b/opal/asm/base/SPARCV9_64.asm index dab19b47c8..0265aeff13 100644 --- a/opal/asm/base/SPARCV9_64.asm +++ b/opal/asm/base/SPARCV9_64.asm @@ -4,34 +4,34 @@ START_FILE ALIGN(4) -START_FUNC(ompi_atomic_mb) +START_FUNC(opal_atomic_mb) !#PROLOGUE# 0 !#PROLOGUE# 1 membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad retl nop -END_FUNC(ompi_atomic_mb) +END_FUNC(opal_atomic_mb) -START_FUNC(ompi_atomic_rmb) +START_FUNC(opal_atomic_rmb) !#PROLOGUE# 0 !#PROLOGUE# 1 membar #LoadLoad retl nop -END_FUNC(ompi_atomic_rmb) +END_FUNC(opal_atomic_rmb) -START_FUNC(ompi_atomic_wmb) +START_FUNC(opal_atomic_wmb) !#PROLOGUE# 0 !#PROLOGUE# 1 membar #StoreStore retl 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# 1 casa [%o0] 0x80, %o1, %o2 @@ -39,10 +39,10 @@ START_FUNC(ompi_atomic_cmpset_32) subcc %g0, %o2, %g0 retl 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# 1 casa [%o0] 0x80, %o1, %o2 @@ -52,10 +52,10 @@ START_FUNC(ompi_atomic_cmpset_acq_32) membar #LoadLoad retl 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# 1 membar #StoreStore @@ -64,10 +64,10 @@ START_FUNC(ompi_atomic_cmpset_rel_32) subcc %g0, %o2, %g0 retl 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# 1 casxa [%o0] 0x80, %o1, %o2 @@ -75,10 +75,10 @@ START_FUNC(ompi_atomic_cmpset_64) xor %o2, %o1, %o2 retl 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# 1 casxa [%o0] 0x80, %o1, %o2 @@ -88,10 +88,10 @@ START_FUNC(ompi_atomic_cmpset_acq_64) membar #LoadLoad retl 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# 1 membar #StoreStore @@ -100,4 +100,4 @@ START_FUNC(ompi_atomic_cmpset_rel_64) xor %o2, %o1, %o2 retl movre %o2, 1, %o0 -END_FUNC(ompi_atomic_cmpset_rel_64) +END_FUNC(opal_atomic_cmpset_rel_64) diff --git a/opal/class/opal_list.c b/opal/class/opal_list.c index e2b8a0d1e4..a95181be36 100644 --- a/opal/class/opal_list.c +++ b/opal/class/opal_list.c @@ -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 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); item->opal_list_item_belong_to = list; #endif diff --git a/opal/class/opal_object.c b/opal/class/opal_object.c index 8c77a1eed4..ca7fe0a978 100644 --- a/opal/class/opal_object.c +++ b/opal/class/opal_object.c @@ -47,7 +47,7 @@ opal_class_t opal_object_t_class = { /* * 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 int num_classes = 0; static int max_classes = 0; @@ -77,14 +77,14 @@ void opal_class_initialize(opal_class_t *cls) if (1 == cls->cls_initialized) { return; } - ompi_atomic_lock(&class_lock); + opal_atomic_lock(&class_lock); /* If another thread initializing this same class came in at roughly the same time, it may have gotten the lock and initialized. So check again. */ if (1 == cls->cls_initialized) { - ompi_atomic_unlock(&class_lock); + opal_atomic_unlock(&class_lock); return; } @@ -122,7 +122,7 @@ void opal_class_initialize(opal_class_t *cls) /* All done */ - ompi_atomic_unlock(&class_lock); + opal_atomic_unlock(&class_lock); } diff --git a/opal/class/opal_object.h b/opal/class/opal_object.h index 3187a8f1e4..640e332a48 100644 --- a/opal/class/opal_object.h +++ b/opal/class/opal_object.h @@ -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) { #if OMPI_HAVE_THREAD_SUPPORT - ompi_atomic_add(&(object->obj_reference_count), inc ); + opal_atomic_add(&(object->obj_reference_count), inc ); #else object->obj_reference_count += inc; #endif diff --git a/opal/include/sys/alpha/atomic.h b/opal/include/sys/alpha/atomic.h index 415bf8ceac..961ecaa13c 100644 --- a/opal/include/sys/alpha/atomic.h +++ b/opal/include/sys/alpha/atomic.h @@ -41,11 +41,11 @@ * 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 -static inline void ompi_atomic_mb(void) +static inline void opal_atomic_mb(void) { MB(); } -static inline void ompi_atomic_rmb(void) +static inline void opal_atomic_rmb(void) { RMB(); } -static inline void ompi_atomic_wmb(void) +static inline void opal_atomic_wmb(void) { WMB(); } @@ -82,7 +82,7 @@ static inline void ompi_atomic_wmb(void) *********************************************************************/ #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 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 newval) { int rc; - rc = ompi_atomic_cmpset_32(addr, oldval, newval); - ompi_atomic_rmb(); + rc = opal_atomic_cmpset_32(addr, oldval, newval); + opal_atomic_rmb(); 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) { - ompi_atomic_wmb(); - return ompi_atomic_cmpset_32(addr, oldval, newval); + opal_atomic_wmb(); + 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) { 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 newval) { int rc; - rc = ompi_atomic_cmpset_64(addr, oldval, newval); - ompi_atomic_rmb(); + rc = opal_atomic_cmpset_64(addr, oldval, newval); + opal_atomic_rmb(); 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) { - ompi_atomic_wmb(); - return ompi_atomic_cmpset_64(addr, oldval, newval); + opal_atomic_wmb(); + return opal_atomic_cmpset_64(addr, oldval, newval); } diff --git a/opal/include/sys/alpha/update.sh b/opal/include/sys/alpha/update.sh index cafec68cd0..92ff8cff5e 100644 --- a/opal/include/sys/alpha/update.sh +++ b/opal/include/sys/alpha/update.sh @@ -15,7 +15,7 @@ # $HEADER$ # -CFILE=/tmp/ompi_atomic_$$.c +CFILE=/tmp/opal_atomic_$$.c trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 diff --git a/opal/include/sys/amd64/atomic.h b/opal/include/sys/amd64/atomic.h index a5e0da3519..245d9dc0a0 100644 --- a/opal/include/sys/amd64/atomic.h +++ b/opal/include/sys/amd64/atomic.h @@ -35,11 +35,11 @@ * 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 -static inline void ompi_atomic_mb(void) +static inline void opal_atomic_mb(void) { MB(); } -static inline void ompi_atomic_rmb(void) +static inline void opal_atomic_rmb(void) { MB(); } -static inline void ompi_atomic_wmb(void) +static inline void opal_atomic_wmb(void) { MB(); } @@ -76,7 +76,7 @@ static inline void ompi_atomic_wmb(void) *********************************************************************/ #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) { unsigned long prev; @@ -89,12 +89,12 @@ static inline int ompi_atomic_cmpset_32( volatile int32_t *addr, #endif /* OMPI_GCC_INLINE_ASSEMBLY */ -#define ompi_atomic_cmpset_acq_32 ompi_atomic_cmpset_32 -#define ompi_atomic_cmpset_rel_32 ompi_atomic_cmpset_32 +#define opal_atomic_cmpset_acq_32 opal_atomic_cmpset_32 +#define opal_atomic_cmpset_rel_32 opal_atomic_cmpset_32 #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 prev; @@ -110,7 +110,7 @@ static inline int ompi_atomic_cmpset_64( volatile int64_t *addr, #endif /* OMPI_GCC_INLINE_ASSEMBLY */ -#define ompi_atomic_cmpset_acq_64 ompi_atomic_cmpset_64 -#define ompi_atomic_cmpset_rel_64 ompi_atomic_cmpset_64 +#define opal_atomic_cmpset_acq_64 opal_atomic_cmpset_64 +#define opal_atomic_cmpset_rel_64 opal_atomic_cmpset_64 #endif /* ! OMPI_SYS_ARCH_ATOMIC_H */ diff --git a/opal/include/sys/amd64/update.sh b/opal/include/sys/amd64/update.sh index cafec68cd0..92ff8cff5e 100644 --- a/opal/include/sys/amd64/update.sh +++ b/opal/include/sys/amd64/update.sh @@ -15,7 +15,7 @@ # $HEADER$ # -CFILE=/tmp/ompi_atomic_$$.c +CFILE=/tmp/opal_atomic_$$.c trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 diff --git a/opal/include/sys/atomic.h b/opal/include/sys/atomic.h index a6a3951531..e1eff75eca 100644 --- a/opal/include/sys/atomic.h +++ b/opal/include/sys/atomic.h @@ -29,18 +29,18 @@ * The following #defines will be true / false based on * assembly support: * - * - \c OMPI_HAVE_MEM_BARRIER atomic memory barriers - * - \c OMPI_HAVE_ATOMIC_SPINLOCKS atomic spinlocks - * - \c OMPI_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_MEM_BARRIER atomic memory barriers + * - \c OPAL_HAVE_ATOMIC_SPINLOCKS atomic spinlocks + * - \c OPAL_HAVE_ATOMIC_MATH_32 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 - * 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. */ -#ifndef OMPI_SYS_ATOMIC_H -#define OMPI_SYS_ATOMIC_H 1 +#ifndef OPAL_SYS_ATOMIC_H +#define OPAL_SYS_ATOMIC_H 1 #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 * informed either way. */ -struct ompi_lock_t { +struct opal_atomic_lock_t { union { volatile int lock; /**< The lock address (an integer) */ volatile unsigned char sparc_lock; /**< The lock address on sparc */ char padding[sizeof(int)]; /**< Array for optional padding */ } 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, so if these defines aren't already set, they should be set to 0 now */ -#ifndef OMPI_HAVE_ATOMIC_CMPSET_32 -#define OMPI_HAVE_ATOMIC_CMPSET_32 0 +#ifndef OPAL_HAVE_ATOMIC_CMPSET_32 +#define OPAL_HAVE_ATOMIC_CMPSET_32 0 #endif -#ifndef OMPI_HAVE_ATOMIC_CMPSET_64 -#define OMPI_HAVE_ATOMIC_CMPSET_64 0 +#ifndef OPAL_HAVE_ATOMIC_CMPSET_64 +#define OPAL_HAVE_ATOMIC_CMPSET_64 0 #endif #endif /* DOXYGEN */ @@ -138,18 +138,18 @@ typedef struct ompi_lock_t ompi_lock_t; * 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 */ -#define OMPI_HAVE_ATOMIC_MEM_BARRIER 0 +#define OPAL_HAVE_ATOMIC_MEM_BARRIER 0 #endif -#if defined(DOXYGEN) || OMPI_HAVE_ATOMIC_MEM_BARRIER +#if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_MEM_BARRIER /** * Memory barrier * * Will use system-specific features to instruct the processor and * 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. * * \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 * if you need *both* read and write barriers. */ -void ompi_atomic_mb(void); +void opal_atomic_mb(void); /** * Read memory barrier * * Use system-specific features to instruct the processor and memory * 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 - * \c ompi_atomic_rmb(). + * \c opal_atomic_rmb(). */ -void ompi_atomic_rmb(void); +void opal_atomic_rmb(void); /** * Write memory barrier. * * Use system-specific features to instruct the processor and memory * 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 - * \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 the static inline functions are declared */ -#define OMPI_HAVE_ATOMIC_SPINLOCKS 0 +#define OPAL_HAVE_ATOMIC_SPINLOCKS 0 #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 */ enum { - OMPI_ATOMIC_UNLOCKED = 0, - OMPI_ATOMIC_LOCKED = 1 + OPAL_ATOMIC_UNLOCKED = 0, + OPAL_ATOMIC_LOCKED = 1 }; @@ -213,10 +213,10 @@ enum { * @param lock Address of the lock * @param value Initial value to set lock to */ -#if OMPI_HAVE_ATOMIC_SPINLOCKS == 0 +#if OPAL_HAVE_ATOMIC_SPINLOCKS == 0 static inline #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. * @return 0 if the lock was acquired, 1 otherwise. */ -#if OMPI_HAVE_ATOMIC_SPINLOCKS == 0 +#if OPAL_HAVE_ATOMIC_SPINLOCKS == 0 static inline #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. */ -#if OMPI_HAVE_ATOMIC_SPINLOCKS == 0 +#if OPAL_HAVE_ATOMIC_SPINLOCKS == 0 static inline #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. */ -#if OMPI_HAVE_ATOMIC_SPINLOCKS == 0 +#if OPAL_HAVE_ATOMIC_SPINLOCKS == 0 static inline #endif -void ompi_atomic_unlock(ompi_lock_t *lock); +void opal_atomic_unlock(opal_atomic_lock_t *lock); -#if OMPI_HAVE_ATOMIC_SPINLOCKS == 0 -#undef OMPI_HAVE_ATOMIC_SPINLOCKS -#define OMPI_HAVE_ATOMIC_SPINLOCKS (OMPI_HAVE_ATOMIC_CMPSET_32 || OMPI_HAVE_ATOMIC_CMPSET_64) -#define OMPI_NEED_INLINE_ATOMIC_SPINLOCKS +#if OPAL_HAVE_ATOMIC_SPINLOCKS == 0 +#undef OPAL_HAVE_ATOMIC_SPINLOCKS +#define OPAL_HAVE_ATOMIC_SPINLOCKS (OPAL_HAVE_ATOMIC_CMPSET_32 || OPAL_HAVE_ATOMIC_CMPSET_64) +#define OPAL_NEED_INLINE_ATOMIC_SPINLOCKS #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 * *********************************************************************/ -#if !defined(OMPI_HAVE_ATOMIC_CMPSET_32) && !defined(DOXYGEN) -#define OMPI_HAVE_ATOMIC_CMPSET_32 0 +#if !defined(OPAL_HAVE_ATOMIC_CMPSET_32) && !defined(DOXYGEN) +#define OPAL_HAVE_ATOMIC_CMPSET_32 0 #endif -#if defined(DOXYGEN) || OMPI_HAVE_ATOMIC_CMPSET_32 -int ompi_atomic_cmpset_32(volatile int32_t *addr, int32_t oldval, +#if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_CMPSET_32 +int opal_atomic_cmpset_32(volatile int32_t *addr, int32_t oldval, 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); -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); #endif -#if !defined(OMPI_HAVE_ATOMIC_CMPSET_64) && !defined(DOXYGEN) -#define OMPI_HAVE_ATOMIC_CMPSET_64 0 +#if !defined(OPAL_HAVE_ATOMIC_CMPSET_64) && !defined(DOXYGEN) +#define OPAL_HAVE_ATOMIC_CMPSET_64 0 #endif -#if defined(DOXYGEN) || OMPI_HAVE_ATOMIC_CMPSET_64 -int ompi_atomic_cmpset_64(volatile int64_t *addr, int64_t oldval, +#if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_CMPSET_64 +int opal_atomic_cmpset_64(volatile int64_t *addr, int64_t oldval, 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); -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); #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 OMPI_HAVE_ATOMIC_MATH_32 0 +#define OPAL_HAVE_ATOMIC_MATH_32 0 #endif -#if defined(DOXYGEN) || OMPI_HAVE_ATOMIC_MATH_32 || OMPI_HAVE_ATOMIC_CMPSET_32 -#if ! OMPI_HAVE_ATOMIC_MATH_32 +#if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_MATH_32 || OPAL_HAVE_ATOMIC_CMPSET_32 +#if ! OPAL_HAVE_ATOMIC_MATH_32 static inline #endif -int32_t ompi_atomic_add_32(volatile int32_t *addr, int delta); -#if ! OMPI_HAVE_ATOMIC_MATH_32 +int32_t opal_atomic_add_32(volatile int32_t *addr, int delta); +#if ! OPAL_HAVE_ATOMIC_MATH_32 static inline #endif -int32_t ompi_atomic_sub_32(volatile int32_t *addr, int delta); -#endif /* OMPI_HAVE_ATOMIC_MATH_32 */ -#if ! OMPI_HAVE_ATOMIC_MATH_32 +int32_t opal_atomic_sub_32(volatile int32_t *addr, int delta); +#endif /* OPAL_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 */ -#undef OMPI_HAVE_ATOMIC_MATH_32 -#define OMPI_HAVE_ATOMIC_MATH_32 OMPI_HAVE_ATOMIC_CMPSET_32 +#undef OPAL_HAVE_ATOMIC_MATH_32 +#define OPAL_HAVE_ATOMIC_MATH_32 OPAL_HAVE_ATOMIC_CMPSET_32 #endif -#ifndef OMPI_HAVE_ATOMIC_MATH_64 +#ifndef OPAL_HAVE_ATOMIC_MATH_64 /* 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 -#if defined(DOXYGEN) || OMPI_HAVE_ATOMIC_MATH_64 || OMPI_HAVE_ATOMIC_CMPSET_64 -#if OMPI_HAVE_ATOMIC_CMPSET_64 +#if defined(DOXYGEN) || OPAL_HAVE_ATOMIC_MATH_64 || OPAL_HAVE_ATOMIC_CMPSET_64 +#if OPAL_HAVE_ATOMIC_CMPSET_64 static inline #endif -int64_t ompi_atomic_add_64(volatile int64_t *addr, int64_t delta); -#if OMPI_HAVE_ATOMIC_CMPSET_64 +int64_t opal_atomic_add_64(volatile int64_t *addr, int64_t delta); +#if OPAL_HAVE_ATOMIC_CMPSET_64 static inline #endif -int64_t ompi_atomic_sub_64(volatile int64_t *addr, int64_t delta); -#endif /* OMPI_HAVE_ATOMIC_MATH_32 */ -#if ! OMPI_HAVE_ATOMIC_MATH_64 +int64_t opal_atomic_sub_64(volatile int64_t *addr, int64_t delta); +#endif /* OPAL_HAVE_ATOMIC_MATH_32 */ +#if ! OPAL_HAVE_ATOMIC_MATH_64 /* fix up the value of ompi_have_atomic_math_64 to allow for C versions */ -#undef OMPI_HAVE_ATOMIC_MATH_64 -#define OMPI_HAVE_ATOMIC_MATH_64 OMPI_HAVE_ATOMIC_CMPSET_64 +#undef OPAL_HAVE_ATOMIC_MATH_64 +#define OPAL_HAVE_ATOMIC_MATH_64 OPAL_HAVE_ATOMIC_CMPSET_64 #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 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); -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, 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, 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* 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* 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* newval); @@ -366,10 +366,10 @@ static inline int ompi_atomic_cmpset_rel_ptr(volatile void* addr, * @param oldval Comparison value . * @param newval New value to set if comparision is true . * - * See ompi_atomic_cmpset_* for pseudo-code. + * See opal_atomic_cmpset_* for pseudo-code. */ -#define ompi_atomic_cmpset( ADDR, OLDVAL, NEWVAL ) \ - ompi_atomic_cmpset_xx( (volatile void*)(ADDR), (int64_t)(OLDVAL), \ +#define opal_atomic_cmpset( ADDR, OLDVAL, NEWVAL ) \ + opal_atomic_cmpset_xx( (volatile void*)(ADDR), (int64_t)(OLDVAL), \ (int64_t)(NEWVAL), sizeof(*(ADDR)) ) /** @@ -383,10 +383,10 @@ static inline int ompi_atomic_cmpset_rel_ptr(volatile void* addr, * @param oldval Comparison value . * @param newval New value to set if comparision is true . * - * See ompi_atomic_cmpset_acq_* for pseudo-code. + * See opal_atomic_cmpset_acq_* for pseudo-code. */ -#define ompi_atomic_cmpset_acq( ADDR, OLDVAL, NEWVAL ) \ - ompi_atomic_cmpset_acq_xx( (volatile void*)(ADDR), (int64_t)(OLDVAL), \ +#define opal_atomic_cmpset_acq( ADDR, OLDVAL, NEWVAL ) \ + opal_atomic_cmpset_acq_xx( (volatile void*)(ADDR), (int64_t)(OLDVAL), \ (int64_t)(NEWVAL), sizeof(*(ADDR)) ) @@ -401,23 +401,23 @@ static inline int ompi_atomic_cmpset_rel_ptr(volatile void* addr, * @param oldval Comparison value . * @param newval New value to set if comparision is true . * - * See ompi_atomic_cmpsetrel_* for pseudo-code. + * See opal_atomic_cmpsetrel_* for pseudo-code. */ -#define ompi_atomic_cmpset_rel( ADDR, OLDVAL, NEWVAL ) \ - ompi_atomic_cmpset_rel_xx( (volatile void*)(ADDR), (int64_t)(OLDVAL), \ +#define opal_atomic_cmpset_rel( ADDR, OLDVAL, NEWVAL ) \ + opal_atomic_cmpset_rel_xx( (volatile void*)(ADDR), (int64_t)(OLDVAL), \ (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); -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); -static inline int ompi_atomic_add_pt(volatile void* addr, +static inline int opal_atomic_add_pt(volatile void* addr, void* delta); -static inline int ompi_atomic_sub_ptr(volatile void* addr, +static inline int opal_atomic_sub_ptr(volatile void* addr, void* delta); /** @@ -430,8 +430,8 @@ static inline int ompi_atomic_sub_ptr(volatile void* addr, * @param addr Address of * @param delta Value to add (converted to ). */ -#define ompi_atomic_add( ADDR, VALUE ) \ - ompi_atomic_add_xx( (volatile void*)(ADDR), (int32_t)(VALUE), \ +#define opal_atomic_add( ADDR, VALUE ) \ + opal_atomic_add_xx( (volatile void*)(ADDR), (int32_t)(VALUE), \ sizeof(*(ADDR)) ) /** @@ -444,11 +444,11 @@ static inline int ompi_atomic_sub_ptr(volatile void* addr, * @param addr Address of * @param delta Value to substract (converted to ). */ -#define ompi_atomic_sub( ADDR, VALUE ) \ - ompi_atomic_sub_xx( (volatile void*)(ADDR), (int32_t)(VALUE), \ +#define opal_atomic_sub( ADDR, VALUE ) \ + opal_atomic_sub_xx( (volatile void*)(ADDR), (int32_t)(VALUE), \ 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 */ diff --git a/opal/include/sys/atomic_impl.h b/opal/include/sys/atomic_impl.h index 1f030dafee..9cf2f6f674 100644 --- a/opal/include/sys/atomic_impl.h +++ b/opal/include/sys/atomic_impl.h @@ -30,92 +30,92 @@ * 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) -#define OMPI_HAVE_ATOMIC_ADD_32 1 +#if !defined(OPAL_HAVE_ATOMIC_ADD_32) +#define OPAL_HAVE_ATOMIC_ADD_32 1 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; do { 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); } -#endif /* OMPI_HAVE_ATOMIC_CMPSET_32 */ +#endif /* OPAL_HAVE_ATOMIC_CMPSET_32 */ -#if !defined(OMPI_HAVE_ATOMIC_SUB_32) -#define OMPI_HAVE_ATOMIC_SUB_32 1 +#if !defined(OPAL_HAVE_ATOMIC_SUB_32) +#define OPAL_HAVE_ATOMIC_SUB_32 1 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; do { 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); } -#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) -#define OMPI_HAVE_ATOMIC_ADD_64 1 +#if !defined(OPAL_HAVE_ATOMIC_ADD_64) +#define OPAL_HAVE_ATOMIC_ADD_64 1 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; do { 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); } -#endif /* OMPI_HAVE_ATOMIC_ADD_64 */ +#endif /* OPAL_HAVE_ATOMIC_ADD_64 */ -#if !defined(OMPI_HAVE_ATOMIC_SUB_64) -#define OMPI_HAVE_ATOMIC_SUB_64 1 +#if !defined(OPAL_HAVE_ATOMIC_SUB_64) +#define OPAL_HAVE_ATOMIC_SUB_64 1 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; do { 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); } -#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 -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) { switch( length ) { -#if OMPI_HAVE_ATOMIC_CMPSET_32 +#if OPAL_HAVE_ATOMIC_CMPSET_32 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 ); -#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: - return ompi_atomic_cmpset_64( (volatile int64_t*)addr, + return opal_atomic_cmpset_64( (volatile int64_t*)addr, (int64_t)oldval, (int64_t)newval ); -#endif /* OMPI_HAVE_ATOMIC_CMPSET_64 */ +#endif /* OPAL_HAVE_ATOMIC_CMPSET_64 */ default: /* This should never happen, so deliberately cause a seg fault for corefile analysis */ @@ -126,21 +126,21 @@ ompi_atomic_cmpset_xx(volatile void* addr, int64_t oldval, 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) { switch( length ) { -#if OMPI_HAVE_ATOMIC_CMPSET_32 +#if OPAL_HAVE_ATOMIC_CMPSET_32 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 ); -#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: - 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 ); -#endif /* OMPI_HAVE_ATOMIC_CMPSET_64 */ +#endif /* OPAL_HAVE_ATOMIC_CMPSET_64 */ default: /* This should never happen, so deliberately cause a seg fault for corefile analysis */ @@ -151,21 +151,21 @@ ompi_atomic_cmpset_acq_xx(volatile void* addr, int64_t oldval, 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) { switch( length ) { -#if OMPI_HAVE_ATOMIC_CMPSET_32 +#if OPAL_HAVE_ATOMIC_CMPSET_32 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 ); -#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: - 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 ); -#endif /* OMPI_HAVE_ATOMIC_CMPSET_64 */ +#endif /* OPAL_HAVE_ATOMIC_CMPSET_64 */ default: /* This should never happen, so deliberately cause a seg fault for corefile analysis */ @@ -176,15 +176,15 @@ ompi_atomic_cmpset_rel_xx(volatile void* addr, int64_t oldval, static inline int -ompi_atomic_cmpset_ptr(volatile void* addr, +opal_atomic_cmpset_ptr(volatile void* addr, void* oldval, void* newval) { -#if SIZEOF_VOID_P == 4 && OMPI_HAVE_ATOMIC_CMPSET_32 - return ompi_atomic_cmpset_32((int32_t*) addr, (unsigned long) oldval, +#if SIZEOF_VOID_P == 4 && OPAL_HAVE_ATOMIC_CMPSET_32 + return opal_atomic_cmpset_32((int32_t*) addr, (unsigned long) oldval, (unsigned long) newval); -#elif SIZEOF_VOID_P == 8 && OMPI_HAVE_ATOMIC_CMPSET_64 - return ompi_atomic_cmpset_64((int64_t*) addr, (unsigned long) oldval, +#elif SIZEOF_VOID_P == 8 && OPAL_HAVE_ATOMIC_CMPSET_64 + return opal_atomic_cmpset_64((int64_t*) addr, (unsigned long) oldval, (unsigned long) newval); #else abort(); @@ -194,15 +194,15 @@ ompi_atomic_cmpset_ptr(volatile void* addr, static inline int -ompi_atomic_cmpset_acq_ptr(volatile void* addr, +opal_atomic_cmpset_acq_ptr(volatile void* addr, void* oldval, void* newval) { -#if SIZEOF_VOID_P == 4 && OMPI_HAVE_ATOMIC_CMPSET_32 - return ompi_atomic_cmpset_acq_32((int32_t*) addr, (unsigned long) oldval, +#if SIZEOF_VOID_P == 4 && OPAL_HAVE_ATOMIC_CMPSET_32 + return opal_atomic_cmpset_acq_32((int32_t*) addr, (unsigned long) oldval, (unsigned long) newval); -#elif SIZEOF_VOID_P == 8 && OMPI_HAVE_ATOMIC_CMPSET_64 - return ompi_atomic_cmpset_acq_64((int64_t*) addr, (unsigned long) oldval, +#elif SIZEOF_VOID_P == 8 && OPAL_HAVE_ATOMIC_CMPSET_64 + return opal_atomic_cmpset_acq_64((int64_t*) addr, (unsigned long) oldval, (unsigned long) newval); #else 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* newval) { -#if SIZEOF_VOID_P == 4 && OMPI_HAVE_ATOMIC_CMPSET_32 - return ompi_atomic_cmpset_rel_32((int32_t*) addr, (unsigned long) oldval, +#if SIZEOF_VOID_P == 4 && OPAL_HAVE_ATOMIC_CMPSET_32 + return opal_atomic_cmpset_rel_32((int32_t*) addr, (unsigned long) oldval, (unsigned long) newval); -#elif SIZEOF_VOID_P == 8 && OMPI_HAVE_ATOMIC_CMPSET_64 - return ompi_atomic_cmpset_rel_64((int64_t*) addr, (unsigned long) oldval, +#elif SIZEOF_VOID_P == 8 && OPAL_HAVE_ATOMIC_CMPSET_64 + return opal_atomic_cmpset_rel_64((int64_t*) addr, (unsigned long) oldval, (unsigned long) newval); #else abort(); @@ -227,26 +227,26 @@ static inline int ompi_atomic_cmpset_rel_ptr(volatile void* addr, #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 -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 ) { -#if OMPI_HAVE_ATOMIC_CMPSET_32 +#if OPAL_HAVE_ATOMIC_CMPSET_32 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; -#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: - ompi_atomic_add_64( (volatile int64_t*)addr, (int64_t)value ); + opal_atomic_add_64( (volatile int64_t*)addr, (int64_t)value ); break; -#endif /* OMPI_HAVE_ATOMIC_CMPSET_64 */ +#endif /* OPAL_HAVE_ATOMIC_CMPSET_64 */ default: /* This should never happen, so deliberately cause a seg fault for corefile analysis */ @@ -256,20 +256,20 @@ ompi_atomic_add_xx(volatile void* addr, int32_t value, size_t length) 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 ) { -#if OMPI_HAVE_ATOMIC_CMPSET_32 +#if OPAL_HAVE_ATOMIC_CMPSET_32 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; -#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: - ompi_atomic_sub_64( (volatile int64_t*)addr, (int64_t)value ); + opal_atomic_sub_64( (volatile int64_t*)addr, (int64_t)value ); break; -#endif /* OMPI_HAVE_ATOMIC_CMPSET_64 */ +#endif /* OPAL_HAVE_ATOMIC_CMPSET_64 */ default: /* This should never happen, so deliberately cause a seg fault 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) { -#if SIZEOF_VOID_P == 4 && OMPI_HAVE_ATOMIC_CMPSET_32 - return ompi_atomic_add_32((int32_t*) addr, (unsigned long) delta); -#elif SIZEOF_VOID_P == 8 && OMPI_HAVE_ATOMIC_CMPSET_64 - return ompi_atomic_add_64((int64_t*) addr, (unsigned long) delta); +#if SIZEOF_VOID_P == 4 && OPAL_HAVE_ATOMIC_CMPSET_32 + return opal_atomic_add_32((int32_t*) addr, (unsigned long) delta); +#elif SIZEOF_VOID_P == 8 && OPAL_HAVE_ATOMIC_CMPSET_64 + return opal_atomic_add_64((int64_t*) addr, (unsigned long) delta); #else abort(); 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) { -#if SIZEOF_VOID_P == 4 && OMPI_HAVE_ATOMIC_CMPSET_32 - return ompi_atomic_sub_32((int32_t*) addr, (unsigned long) delta); -#elif SIZEOF_VOID_P == 8 && OMPI_HAVE_ATOMIC_CMPSET_64 - return ompi_atomic_sub_64((int64_t*) addr, (unsigned long) delta); +#if SIZEOF_VOID_P == 4 && OPAL_HAVE_ATOMIC_CMPSET_32 + return opal_atomic_sub_32((int32_t*) addr, (unsigned long) delta); +#elif SIZEOF_VOID_P == 8 && OPAL_HAVE_ATOMIC_CMPSET_64 + return opal_atomic_sub_64((int64_t*) addr, (unsigned long) delta); #else abort(); return 0; #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 * *********************************************************************/ -#ifdef OMPI_NEED_INLINE_ATOMIC_SPINLOCKS +#ifdef OPAL_NEED_INLINE_ATOMIC_SPINLOCKS /* * Lock initialization function. It set the lock to UNLOCKED. */ 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; } 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), - OMPI_ATOMIC_UNLOCKED, OMPI_ATOMIC_LOCKED); + return opal_atomic_cmpset_acq( &(lock->u.lock), + OPAL_ATOMIC_UNLOCKED, OPAL_ATOMIC_LOCKED); } 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), - OMPI_ATOMIC_UNLOCKED, OMPI_ATOMIC_LOCKED) ) { - while (lock->u.lock == OMPI_ATOMIC_LOCKED) { + while( !opal_atomic_cmpset_acq( &(lock->u.lock), + OPAL_ATOMIC_UNLOCKED, OPAL_ATOMIC_LOCKED) ) { + while (lock->u.lock == OPAL_ATOMIC_LOCKED) { /* spin */ ; } } @@ -344,13 +344,13 @@ ompi_atomic_lock(ompi_lock_t *lock) 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), - OMPI_ATOMIC_LOCKED, OMPI_ATOMIC_UNLOCKED); + opal_atomic_cmpset_rel( &(lock->u.lock), + 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 */ diff --git a/opal/include/sys/ia32/atomic.h b/opal/include/sys/ia32/atomic.h index f4ee1bd0a5..2b6eb80286 100644 --- a/opal/include/sys/ia32/atomic.h +++ b/opal/include/sys/ia32/atomic.h @@ -35,15 +35,15 @@ * 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 OMPI_HAVE_ATOMIC_ADD_32 1 -#define OMPI_HAVE_ATOMIC_SUB_32 1 +#define OPAL_HAVE_ATOMIC_MATH_32 1 +#define OPAL_HAVE_ATOMIC_ADD_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 -static inline void ompi_atomic_mb(void) +static inline void opal_atomic_mb(void) { MB(); } -static inline void ompi_atomic_rmb(void) +static inline void opal_atomic_rmb(void) { MB(); } -static inline void ompi_atomic_wmb(void) +static inline void opal_atomic_wmb(void) { MB(); } @@ -80,7 +80,7 @@ static inline void ompi_atomic_wmb(void) *********************************************************************/ #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) { @@ -97,8 +97,8 @@ static inline int ompi_atomic_cmpset_32(volatile int32_t *addr, #endif /* OMPI_GCC_INLINE_ASSEMBLY */ -#define ompi_atomic_cmpset_acq_32 ompi_atomic_cmpset_32 -#define ompi_atomic_cmpset_rel_32 ompi_atomic_cmpset_32 +#define opal_atomic_cmpset_acq_32 opal_atomic_cmpset_32 +#define opal_atomic_cmpset_rel_32 opal_atomic_cmpset_32 #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 * 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 newval) { @@ -145,8 +145,8 @@ static inline int ompi_atomic_cmpset_64(volatile int64_t *addr, #endif /* OMPI_GCC_INLINE_ASSEMBLY */ -#define ompi_atomic_cmpset_acq_64 ompi_atomic_cmpset_64 -#define ompi_atomic_cmpset_rel_64 ompi_atomic_cmpset_64 +#define opal_atomic_cmpset_acq_64 opal_atomic_cmpset_64 +#define opal_atomic_cmpset_rel_64 opal_atomic_cmpset_64 #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. */ -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__( 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. */ -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__( SMPLOCK "subl %1,%0" diff --git a/opal/include/sys/ia32/update.sh b/opal/include/sys/ia32/update.sh index 3e929f2237..a4a293d573 100644 --- a/opal/include/sys/ia32/update.sh +++ b/opal/include/sys/ia32/update.sh @@ -15,7 +15,7 @@ # $HEADER$ # -CFILE=/tmp/ompi_atomic_$$.c +CFILE=/tmp/opal_atomic_$$.c trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 diff --git a/opal/include/sys/ia64/atomic.h b/opal/include/sys/ia64/atomic.h index 83be7062a2..95b1b2d3bc 100644 --- a/opal/include/sys/ia64/atomic.h +++ b/opal/include/sys/ia64/atomic.h @@ -34,10 +34,10 @@ * 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 OMPI_HAVE_ATOMIC_CMPSET_64 1 +#define OPAL_HAVE_ATOMIC_CMPSET_32 1 +#define OPAL_HAVE_ATOMIC_CMPSET_64 1 /********************************************************************** * @@ -46,19 +46,19 @@ *********************************************************************/ #if OMPI_GCC_INLINE_ASSEMBLY -static inline void ompi_atomic_mb(void) +static inline void opal_atomic_mb(void) { MB(); } -static inline void ompi_atomic_rmb(void) +static inline void opal_atomic_rmb(void) { MB(); } -static inline void ompi_atomic_wmb(void) +static inline void opal_atomic_wmb(void) { MB(); } @@ -80,7 +80,7 @@ static inline void ompi_atomic_wmb(void) 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) { 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) { int64_t ret; @@ -108,11 +108,11 @@ static inline int ompi_atomic_cmpset_rel_32( volatile int32_t *addr, #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 -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 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 ret; @@ -139,6 +139,6 @@ static inline int ompi_atomic_cmpset_rel_64( volatile int64_t *addr, #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 */ diff --git a/opal/include/sys/ia64/update.sh b/opal/include/sys/ia64/update.sh index 3e929f2237..a4a293d573 100644 --- a/opal/include/sys/ia64/update.sh +++ b/opal/include/sys/ia64/update.sh @@ -15,7 +15,7 @@ # $HEADER$ # -CFILE=/tmp/ompi_atomic_$$.c +CFILE=/tmp/opal_atomic_$$.c trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 diff --git a/opal/include/sys/mips/atomic.h b/opal/include/sys/mips/atomic.h index 7983a494b7..3f539e8a3a 100644 --- a/opal/include/sys/mips/atomic.h +++ b/opal/include/sys/mips/atomic.h @@ -41,10 +41,10 @@ * 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 OMPI_HAVE_ATOMIC_CMPSET_64 1 +#define OPAL_HAVE_ATOMIC_CMPSET_32 1 +#define OPAL_HAVE_ATOMIC_CMPSET_64 1 /********************************************************************** @@ -55,21 +55,21 @@ #if OMPI_GCC_INLINE_ASSEMBLY static inline -void ompi_atomic_mb(void) +void opal_atomic_mb(void) { MB(); } static inline -void ompi_atomic_rmb(void) +void opal_atomic_rmb(void) { RMB(); } static inline -void ompi_atomic_wmb(void) +void opal_atomic_wmb(void) { WMB(); } @@ -83,7 +83,7 @@ void ompi_atomic_wmb(void) *********************************************************************/ #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 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 the assembly, meaning there is one function call overhead instead 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) { int rc; - rc = ompi_atomic_cmpset_32(addr, oldval, newval); - ompi_atomic_rmb(); + rc = opal_atomic_cmpset_32(addr, oldval, newval); + opal_atomic_rmb(); 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) { - ompi_atomic_wmb(); - return ompi_atomic_cmpset_32(addr, oldval, newval); + opal_atomic_wmb(); + 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 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 the assembly, meaning there is one function call overhead instead 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) { int rc; - rc = ompi_atomic_cmpset_64(addr, oldval, newval); - ompi_atomic_rmb(); + rc = opal_atomic_cmpset_64(addr, oldval, newval); + opal_atomic_rmb(); 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) { - ompi_atomic_wmb(); - return ompi_atomic_cmpset_64(addr, oldval, newval); + opal_atomic_wmb(); + return opal_atomic_cmpset_64(addr, oldval, newval); } #endif /* OMPI_GCC_INLINE_ASSEMBLY */ diff --git a/opal/include/sys/mips/update.sh b/opal/include/sys/mips/update.sh index 35121c2cf7..a58a41a82e 100644 --- a/opal/include/sys/mips/update.sh +++ b/opal/include/sys/mips/update.sh @@ -15,7 +15,7 @@ # $HEADER$ # -CFILE=/tmp/ompi_atomic_$$.c +CFILE=/tmp/opal_atomic_$$.c trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 diff --git a/opal/include/sys/numa.h b/opal/include/sys/numa.h index 2877bd36f1..474be4a139 100644 --- a/opal/include/sys/numa.h +++ b/opal/include/sys/numa.h @@ -21,12 +21,12 @@ typedef int affinity_t; #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; } -static inline int ompi_get_cpu_set(void) +static inline int opal_get_cpu_set(void) { return OMPI_SUCCESS; } @@ -35,8 +35,8 @@ static inline int ompi_get_cpu_set(void) /* 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 diff --git a/opal/include/sys/powerpc/atomic.h b/opal/include/sys/powerpc/atomic.h index 346dffddfe..571a65667f 100644 --- a/opal/include/sys/powerpc/atomic.h +++ b/opal/include/sys/powerpc/atomic.h @@ -45,17 +45,17 @@ * 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 OMPI_HAVE_ATOMIC_ADD_32 1 -#define OMPI_HAVE_ATOMIC_SUB_32 1 +#define OPAL_HAVE_ATOMIC_MATH_32 1 +#define OPAL_HAVE_ATOMIC_ADD_32 1 +#define OPAL_HAVE_ATOMIC_SUB_32 1 #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 @@ -67,21 +67,21 @@ #if OMPI_GCC_INLINE_ASSEMBLY static inline -void ompi_atomic_mb(void) +void opal_atomic_mb(void) { MB(); } static inline -void ompi_atomic_rmb(void) +void opal_atomic_rmb(void) { RMB(); } static inline -void ompi_atomic_wmb(void) +void opal_atomic_wmb(void) { WMB(); } @@ -94,23 +94,23 @@ void ompi_atomic_wmb(void) * containing the right hex for the instructions). */ -void ompi_atomic_mb(void); -#pragma mc_func ompi_atomic_mb { "7c0004ac" } /* sync */ -#pragma reg_killed_by ompi_atomic_mb /* none */ +void opal_atomic_mb(void); +#pragma mc_func opal_atomic_mb { "7c0004ac" } /* sync */ +#pragma reg_killed_by opal_atomic_mb /* none */ -void ompi_atomic_rmb(void); -#pragma mc_func ompi_atomic_rmb { "7c2004ac" } /* lwsync */ -#pragma reg_killed_by ompi_atomic_rmb /* none */ +void opal_atomic_rmb(void); +#pragma mc_func opal_atomic_rmb { "7c2004ac" } /* lwsync */ +#pragma reg_killed_by opal_atomic_rmb /* none */ -void ompi_atomic_wmb(void); -#pragma mc_func ompi_atomic_wmb { "7c0006ac" } /* eieio */ -#pragma reg_killed_by ompi_atomic_wmb /* none */ +void opal_atomic_wmb(void); +#pragma mc_func opal_atomic_wmb { "7c0006ac" } /* eieio */ +#pragma reg_killed_by opal_atomic_wmb /* none */ #else /* end OMPI_XLC_INLINE_ASSEMBLY */ -void ompi_atomic_mb(void); -void ompi_atomic_rmb(void); -void ompi_atomic_wmb(void); +void opal_atomic_mb(void); +void opal_atomic_rmb(void); +void opal_atomic_wmb(void); #endif @@ -121,7 +121,7 @@ void ompi_atomic_wmb(void); *********************************************************************/ #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 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 the assembly, meaning there is one function call overhead instead 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) { int rc; - rc = ompi_atomic_cmpset_32(addr, oldval, newval); - ompi_atomic_rmb(); + rc = opal_atomic_cmpset_32(addr, oldval, newval); + opal_atomic_rmb(); 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) { - ompi_atomic_wmb(); - return ompi_atomic_cmpset_32(addr, oldval, newval); + opal_atomic_wmb(); + return opal_atomic_cmpset_32(addr, oldval, newval); } #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); -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); -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); #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_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 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 the assembly, meaning there is one function call overhead instead 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) { int rc; - rc = ompi_atomic_cmpset_64(addr, oldval, newval); - ompi_atomic_rmb(); + rc = opal_atomic_cmpset_64(addr, oldval, newval); + opal_atomic_rmb(); 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) { - ompi_atomic_wmb(); - return ompi_atomic_cmpset_64(addr, oldval, newval); + opal_atomic_wmb(); + return opal_atomic_cmpset_64(addr, oldval, newval); } #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); -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); -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); #endif /* OMPI_GCC_INLINE_ASSEMBLY */ @@ -240,7 +240,7 @@ int ompi_atomic_cmpset_rel_64(volatile int64_t *addr, #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) { 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 the assembly, meaning there is one function call overhead instead 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) { int rc; - rc = ompi_atomic_cmpset_64(addr, oldval, newval); - ompi_atomic_rmb(); + rc = opal_atomic_cmpset_64(addr, oldval, newval); + opal_atomic_rmb(); 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) { - ompi_atomic_wmb(); - return ompi_atomic_cmpset_64(addr, oldval, newval); + opal_atomic_wmb(); + return opal_atomic_cmpset_64(addr, oldval, newval); } #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); -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); -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); #endif /* OMPI_GCC_INLINE_ASSEMBLY */ @@ -316,7 +316,7 @@ int ompi_atomic_cmpset_rel_64(volatile int64_t *addr, #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; @@ -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; diff --git a/opal/include/sys/powerpc/update.sh b/opal/include/sys/powerpc/update.sh index 044a29ac7e..dd7733554c 100644 --- a/opal/include/sys/powerpc/update.sh +++ b/opal/include/sys/powerpc/update.sh @@ -15,7 +15,7 @@ # $HEADER$ # -CFILE=/tmp/ompi_atomic_$$.c +CFILE=/tmp/opal_atomic_$$.c trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 diff --git a/opal/include/sys/sparc/atomic.h b/opal/include/sys/sparc/atomic.h index ad07d34368..ee71e43b31 100644 --- a/opal/include/sys/sparc/atomic.h +++ b/opal/include/sys/sparc/atomic.h @@ -25,14 +25,14 @@ #endif #ifdef OMPI_GENERATE_ASM_FILE -struct ompi_lock_t { +struct opal_atomic_lock_t { union { volatile int lock; /**< The lock address (an integer) */ volatile unsigned char sparc_lock; /**< The lock address on sparc */ char padding[sizeof(int)]; /**< Array for optional padding */ } u; }; -typedef struct ompi_lock_t ompi_lock_t; +typedef struct opal_atomic_lock_t opal_atomic_lock_t; #endif /********************************************************************** @@ -40,16 +40,16 @@ typedef struct ompi_lock_t ompi_lock_t; * 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 OMPI_HAVE_ATOMIC_CMPSET_64 0 +#define OPAL_HAVE_ATOMIC_CMPSET_32 0 +#define OPAL_HAVE_ATOMIC_CMPSET_64 0 -#define OMPI_HAVE_ATOMIC_MATH_32 1 -#define OMPI_HAVE_ATOMIC_SUB_32 1 -#define OMPI_HAVE_ATOMIC_ADD_32 1 +#define OPAL_HAVE_ATOMIC_MATH_32 1 +#define OPAL_HAVE_ATOMIC_SUB_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 -static inline void ompi_atomic_mb(void) +static inline void opal_atomic_mb(void) { MB(); } -static inline void ompi_atomic_rmb(void) +static inline void opal_atomic_rmb(void) { MB(); } -static inline void ompi_atomic_wmb(void) +static inline void opal_atomic_wmb(void) { MB(); } @@ -89,13 +89,13 @@ static inline void ompi_atomic_wmb(void) 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; } -static inline int ompi_atomic_trylock(ompi_lock_t *lock) +static inline int opal_atomic_trylock(opal_atomic_lock_t *lock) { 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 */ __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 */ __asm__ __volatile__ ("\t" diff --git a/opal/include/sys/sparc/update.sh b/opal/include/sys/sparc/update.sh index 972d082a05..d721893c0b 100644 --- a/opal/include/sys/sparc/update.sh +++ b/opal/include/sys/sparc/update.sh @@ -15,7 +15,7 @@ # $HEADER$ # -CFILE=/tmp/ompi_atomic_$$.c +CFILE=/tmp/opal_atomic_$$.c trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 diff --git a/opal/include/sys/sparcv9/atomic.h b/opal/include/sys/sparcv9/atomic.h index d6999560e5..39f3e7617b 100644 --- a/opal/include/sys/sparcv9/atomic.h +++ b/opal/include/sys/sparcv9/atomic.h @@ -35,11 +35,11 @@ * 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 -static inline void ompi_atomic_mb(void) +static inline void opal_atomic_mb(void) { MEMBAR("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad"); } -static inline void ompi_atomic_rmb(void) +static inline void opal_atomic_rmb(void) { MEMBAR("#LoadLoad"); } -static inline void ompi_atomic_wmb(void) +static inline void opal_atomic_wmb(void) { MEMBAR("#StoreStore"); } @@ -76,7 +76,7 @@ static inline void ompi_atomic_wmb(void) *********************************************************************/ #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) { /* 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) { int rc; - rc = ompi_atomic_cmpset_32(addr, oldval, newval); - ompi_atomic_rmb(); + rc = opal_atomic_cmpset_32(addr, oldval, newval); + opal_atomic_rmb(); 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) { - ompi_atomic_wmb(); - return ompi_atomic_cmpset_32(addr, oldval, newval); + opal_atomic_wmb(); + return opal_atomic_cmpset_32(addr, oldval, newval); } #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) { /* 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 */ -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) { /* 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 */ -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) { int rc; - rc = ompi_atomic_cmpset_64(addr, oldval, newval); - ompi_atomic_rmb(); + rc = opal_atomic_cmpset_64(addr, oldval, newval); + opal_atomic_rmb(); 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) { - ompi_atomic_wmb(); - return ompi_atomic_cmpset_64(addr, oldval, newval); + opal_atomic_wmb(); + return opal_atomic_cmpset_64(addr, oldval, newval); } #endif /* OMPI_GCC_INLINE_ASSEMBLY */ diff --git a/opal/include/sys/sparcv9/update.sh b/opal/include/sys/sparcv9/update.sh index cf30d2a2fe..9f1a4e2b7f 100644 --- a/opal/include/sys/sparcv9/update.sh +++ b/opal/include/sys/sparcv9/update.sh @@ -15,7 +15,7 @@ # $HEADER$ # -CFILE=/tmp/ompi_atomic_$$.c +CFILE=/tmp/opal_atomic_$$.c trap "/bin/rm -f $CFILE; exit 0" 0 1 2 15 diff --git a/opal/include/sys/win32/atomic.h b/opal/include/sys/win32/atomic.h index 053edef707..11a9103187 100644 --- a/opal/include/sys/win32/atomic.h +++ b/opal/include/sys/win32/atomic.h @@ -22,9 +22,9 @@ * 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 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 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 return KeMemoryBarrier(); @@ -54,8 +54,8 @@ static inline void ompi_atomic_wmb(void) * *********************************************************************/ -#define OMPI_HAVE_ATOMIC_CMPSET_32 1 -static inline int ompi_atomic_cmpset_acq_32( volatile int32_t *addr, +#define OPAL_HAVE_ATOMIC_CMPSET_32 1 +static inline int opal_atomic_cmpset_acq_32( volatile int32_t *addr, int32_t oldval, int32_t newval) { #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) { #if 0 @@ -80,7 +80,7 @@ static inline int ompi_atomic_cmpset_rel_32( volatile int32_t *addr, #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) { #if 0 @@ -93,8 +93,8 @@ static inline int ompi_atomic_cmpset_32( volatile int32_t *addr, #endif } -#define OMPI_HAVE_ATOMIC_CMPSET_64 1 -static inline int ompi_atomic_cmpset_acq_64( volatile int64_t *addr, +#define OPAL_HAVE_ATOMIC_CMPSET_64 1 +static inline int opal_atomic_cmpset_acq_64( volatile int64_t *addr, int64_t oldval, int64_t newval) { #if 0 @@ -106,7 +106,7 @@ static inline int ompi_atomic_cmpset_acq_64( volatile int64_t *addr, #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) { #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) { #if 0 @@ -131,20 +131,20 @@ static inline int ompi_atomic_cmpset_64( volatile int64_t *addr, #endif } -#define OMPI_HAVE_ATOMIC_MATH_32 1 +#define OPAL_HAVE_ATOMIC_MATH_32 1 -#define OMPI_HAVE_ATOMIC_ADD_32 1 -static inline int32_t ompi_atomic_add_32(volatile int32_t *addr, int32_t delta) +#define OPAL_HAVE_ATOMIC_ADD_32 1 +static inline int32_t opal_atomic_add_32(volatile int32_t *addr, int32_t delta) { return InterlockedExchangeAdd ((LONG volatile *) addr, (int32_t) delta); } -#define OMPI_HAVE_ATOMIC_MATH_64 1 +#define OPAL_HAVE_ATOMIC_MATH_64 1 -#define OMPI_HAVE_ATOMIC_ADD_64 1 -static inline int64_t ompi_atomic_add_64(volatile int64_t *addr, int64_t delta) +#define OPAL_HAVE_ATOMIC_ADD_64 1 +static inline int64_t opal_atomic_add_64(volatile int64_t *addr, int64_t delta) { #if 0 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 -static inline int32_t ompi_atomic_sub_32(volatile int32_t *addr, int32_t delta) +#define OPAL_HAVE_ATOMIC_SUB_32 1 +static inline int32_t opal_atomic_sub_32(volatile int32_t *addr, int32_t delta) { return InterlockedExchangeAdd( (LONG volatile *) addr, (int32_t) (-delta)); } -#define OMPI_HAVE_ATOMIC_SUB_64 1 -static inline int64_t ompi_atomic_sub_64(volatile int64_t *addr, int64_t delta) +#define OPAL_HAVE_ATOMIC_SUB_64 1 +static inline int64_t opal_atomic_sub_64(volatile int64_t *addr, int64_t delta) { #if 0 return InterlockedExchangeAdd64 ((int64_t volatile *) addr, diff --git a/opal/runtime/ompi_progress.c b/opal/runtime/ompi_progress.c index 9c78f3056f..195b1591b0 100644 --- a/opal/runtime/ompi_progress.c +++ b/opal/runtime/ompi_progress.c @@ -35,7 +35,7 @@ static const int ompi_progress_default_tick_rate = 100; * Local variables */ #if OMPI_HAVE_THREAD_SUPPORT -static ompi_lock_t progress_lock; +static opal_atomic_lock_t progress_lock; #endif /* OMPI_HAVE_THREAD_SUPPORT */ /* callbacks to progress */ @@ -61,7 +61,7 @@ ompi_progress_init(void) { /* reentrant issues */ #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 */ /* always call sched yield when in the rte only... */ @@ -144,7 +144,7 @@ ompi_progress_finalize(void) /* free memory associated with the callbacks */ #if OMPI_HAVE_THREAD_SUPPORT - ompi_atomic_lock(&progress_lock); + opal_atomic_lock(&progress_lock); #endif if (NULL != callbacks) { @@ -155,7 +155,7 @@ ompi_progress_finalize(void) callbacks_size = 0; #if OMPI_HAVE_THREAD_SUPPORT - ompi_atomic_unlock(&progress_lock); + opal_atomic_unlock(&progress_lock); #endif return OMPI_SUCCESS; @@ -196,7 +196,7 @@ ompi_progress(void) via ompi_progress (which is usually only called when there are no PROGRESS_THREADS running). This should be made more fine-grained at some point in the future. */ - if (! ompi_atomic_trylock(&progress_lock)) { + if (! opal_atomic_trylock(&progress_lock)) { /* someone is already progressing - return */ return; } @@ -228,7 +228,7 @@ ompi_progress(void) #if OMPI_HAVE_THREAD_SUPPORT /* release the lock before yielding, for obvious reasons */ - ompi_atomic_unlock(&progress_lock); + opal_atomic_unlock(&progress_lock); #endif /* OMPI_HAVE_THREAD_SUPPORT */ if (call_yield && events <= 0) { @@ -251,7 +251,7 @@ ompi_progress_register(ompi_progress_callback_t cb) int ret = OMPI_SUCCESS; #if OMPI_HAVE_THREAD_SUPPORT - ompi_atomic_lock(&progress_lock); + opal_atomic_lock(&progress_lock); #endif /* see if we need to allocate more space */ @@ -272,7 +272,7 @@ ompi_progress_register(ompi_progress_callback_t cb) cleanup: #if OMPI_HAVE_THREAD_SUPPORT - ompi_atomic_unlock(&progress_lock); + opal_atomic_unlock(&progress_lock); #endif return ret; @@ -285,7 +285,7 @@ ompi_progress_unregister(ompi_progress_callback_t cb) int ret = OMPI_ERR_NOT_FOUND; #if OMPI_HAVE_THREAD_SUPPORT - ompi_atomic_lock(&progress_lock); + opal_atomic_lock(&progress_lock); #endif for (i = 0 ; i < callbacks_len ; ++i) { @@ -313,7 +313,7 @@ ompi_progress_unregister(ompi_progress_callback_t cb) } #if OMPI_HAVE_THREAD_SUPPORT - ompi_atomic_unlock(&progress_lock); + opal_atomic_unlock(&progress_lock); #endif return ret; @@ -324,7 +324,7 @@ int ompi_progress_event_increment() { 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 */ event_progress_counter = 0; @@ -336,7 +336,7 @@ int ompi_progress_event_decrement() { 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) { event_progress_counter = event_progress_counter_reset; } diff --git a/opal/threads/mutex.c b/opal/threads/mutex.c index 9bdbf1dac3..0d7f9272f1 100644 --- a/opal/threads/mutex.c +++ b/opal/threads/mutex.c @@ -44,8 +44,8 @@ static void ompi_mutex_construct(ompi_mutex_t *m) #if OMPI_HAVE_POSIX_THREADS pthread_mutex_init(&m->m_lock_pthread, 0); #endif -#if OMPI_HAVE_ATOMIC_SPINLOCKS - ompi_atomic_init( &m->m_lock_atomic, OMPI_ATOMIC_UNLOCKED ); +#if OPAL_HAVE_ATOMIC_SPINLOCKS + opal_atomic_init( &m->m_lock_atomic, OPAL_ATOMIC_UNLOCKED ); #endif } diff --git a/opal/threads/mutex.h b/opal/threads/mutex.h index 4e99c419df..3df4cafd22 100644 --- a/opal/threads/mutex.h +++ b/opal/threads/mutex.h @@ -250,7 +250,7 @@ static inline bool ompi_set_using_threads(bool have) #if OMPI_HAVE_THREAD_SUPPORT #define OMPI_THREAD_ADD32(x,y) \ ((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \ - ompi_atomic_add_32(x,y) : (*x += y)) + opal_atomic_add_32(x,y) : (*x += y)) #else #define OMPI_THREAD_ADD32(x,y) (*x += y) #endif @@ -258,7 +258,7 @@ static inline bool ompi_set_using_threads(bool have) #if OMPI_HAVE_THREAD_SUPPORT #define OMPI_THREAD_ADD64(x,y) \ ((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \ - ompi_atomic_add_64(x,y) : (*x += y)) + opal_atomic_add_64(x,y) : (*x += y)) #else #define OMPI_THREAD_ADD64(x,y) (*x += y) #endif @@ -267,11 +267,11 @@ static inline bool ompi_set_using_threads(bool have) #if OMPI_SIZEOF_SIZE_T == 4 #define OMPI_THREAD_ADD_SIZE_T(x,y) \ ((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 #define OMPI_THREAD_ADD_SIZE_T(x,y) \ ((OMPI_HAVE_THREAD_SUPPORT && ompi_using_threads()) ? \ - ompi_atomic_add_64(x,y) : (*x += y)) + opal_atomic_add_64(x,y) : (*x += y)) #endif #else #define OMPI_THREAD_ADD_SIZE_T(x,y) (*x += y) diff --git a/opal/threads/mutex_unix.h b/opal/threads/mutex_unix.h index 2202a07bda..8f629ddad9 100644 --- a/opal/threads/mutex_unix.h +++ b/opal/threads/mutex_unix.h @@ -46,13 +46,13 @@ struct ompi_mutex_t { #if OMPI_HAVE_POSIX_THREADS pthread_mutex_t m_lock_pthread; #endif - ompi_lock_t m_lock_atomic; + opal_atomic_lock_t m_lock_atomic; }; 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 @@ -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) { - 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) { - 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) { - 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 @@ -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) { - 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) { - ompi_atomic_lock(&m->m_lock_atomic); + opal_atomic_lock(&m->m_lock_atomic); } static inline void ompi_mutex_unlock(ompi_mutex_t *m) { - ompi_atomic_unlock(&m->m_lock_atomic); + opal_atomic_unlock(&m->m_lock_atomic); } diff --git a/test/asm/atomic_barrier.c b/test/asm/atomic_barrier.c index 9c8f656f31..4767c33954 100644 --- a/test/asm/atomic_barrier.c +++ b/test/asm/atomic_barrier.c @@ -22,15 +22,15 @@ int 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 actually barrier, but at least make sure they don't kill the machine.*/ - ompi_atomic_mb(); - ompi_atomic_rmb(); - ompi_atomic_wmb(); + opal_atomic_mb(); + opal_atomic_rmb(); + opal_atomic_wmb(); return 0; #else diff --git a/test/asm/atomic_cmpset.c b/test/asm/atomic_cmpset.c index 6ee851cb65..b331d34494 100644 --- a/test/asm/atomic_cmpset.c +++ b/test/asm/atomic_cmpset.c @@ -42,7 +42,7 @@ int32_t val32; int32_t old32; int32_t new32; -#if OMPI_HAVE_ATOMIC_MATH_64 +#if OPAL_HAVE_ATOMIC_MATH_64 volatile int64_t vol64; int64_t val64; int64_t old64; @@ -68,11 +68,11 @@ static void *thread_main(void *arg) /* thread tests */ for (i = 0; i < nreps; i++) { - ompi_atomic_add_32(&val32, 5); -#if OMPI_HAVE_ATOMIC_MATH_64 - ompi_atomic_add_64(&val64, 5); + opal_atomic_add_32(&val32, 5); +#if OPAL_HAVE_ATOMIC_MATH_64 + opal_atomic_add_64(&val64, 5); #endif - ompi_atomic_add(&valint, 5); + opal_atomic_add(&valint, 5); } return (void *) (unsigned long) (rank + 1000); @@ -99,151 +99,151 @@ int main(int argc, char *argv[]) /* -- cmpset 32-bit tests -- */ vol32 = 42, old32 = 42, new32 = 50; - assert(ompi_atomic_cmpset_32(&vol32, old32, new32) == 1); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset_32(&vol32, old32, new32) == 1); + opal_atomic_rmb(); assert(vol32 == new32); vol32 = 42, old32 = 420, new32 = 50; - assert(ompi_atomic_cmpset_32(&vol32, old32, new32) == 0); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset_32(&vol32, old32, new32) == 0); + opal_atomic_rmb(); assert(vol32 == 42); 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); 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); vol32 = 42, old32 = 42, new32 = 50; - assert(ompi_atomic_cmpset_rel_32(&vol32, old32, new32) == 1); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset_rel_32(&vol32, old32, new32) == 1); + opal_atomic_rmb(); assert(vol32 == new32); vol32 = 42, old32 = 420, new32 = 50; - assert(ompi_atomic_cmpset_rel_32(&vol32, old32, new32) == 0); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset_rel_32(&vol32, old32, new32) == 0); + opal_atomic_rmb(); assert(vol32 == 42); /* -- cmpset 64-bit tests -- */ -#if OMPI_HAVE_ATOMIC_MATH_64 +#if OPAL_HAVE_ATOMIC_MATH_64 vol64 = 42, old64 = 42, new64 = 50; - assert(1 == ompi_atomic_cmpset_64(&vol64, old64, new64)); - ompi_atomic_rmb(); + assert(1 == opal_atomic_cmpset_64(&vol64, old64, new64)); + opal_atomic_rmb(); assert(new64 == vol64); vol64 = 42, old64 = 420, new64 = 50; - assert(ompi_atomic_cmpset_64(&vol64, old64, new64) == 0); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset_64(&vol64, old64, new64) == 0); + opal_atomic_rmb(); assert(vol64 == 42); 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); 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); vol64 = 42, old64 = 42, new64 = 50; - assert(ompi_atomic_cmpset_rel_64(&vol64, old64, new64) == 1); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset_rel_64(&vol64, old64, new64) == 1); + opal_atomic_rmb(); assert(vol64 == new64); vol64 = 42, old64 = 420, new64 = 50; - assert(ompi_atomic_cmpset_rel_64(&vol64, old64, new64) == 0); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset_rel_64(&vol64, old64, new64) == 0); + opal_atomic_rmb(); assert(vol64 == 42); #endif /* -- cmpset int tests -- */ volint = 42, oldint = 42, newint = 50; - assert(ompi_atomic_cmpset(&volint, oldint, newint) == 1); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset(&volint, oldint, newint) == 1); + opal_atomic_rmb(); assert(volint ==newint); volint = 42, oldint = 420, newint = 50; - assert(ompi_atomic_cmpset(&volint, oldint, newint) == 0); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset(&volint, oldint, newint) == 0); + opal_atomic_rmb(); assert(volint == 42); 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); 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); volint = 42, oldint = 42, newint = 50; - assert(ompi_atomic_cmpset_rel(&volint, oldint, newint) == 1); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset_rel(&volint, oldint, newint) == 1); + opal_atomic_rmb(); assert(volint == newint); volint = 42, oldint = 420, newint = 50; - assert(ompi_atomic_cmpset_rel(&volint, oldint, newint) == 0); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset_rel(&volint, oldint, newint) == 0); + opal_atomic_rmb(); assert(volint == 42); /* -- cmpset ptr tests -- */ volptr = (void *) 42, oldptr = (void *) 42, newptr = (void *) 50; - assert(ompi_atomic_cmpset_ptr(&volptr, oldptr, newptr) == 1); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset_ptr(&volptr, oldptr, newptr) == 1); + opal_atomic_rmb(); assert(volptr == newptr); volptr = (void *) 42, oldptr = (void *) 420, newptr = (void *) 50; - assert(ompi_atomic_cmpset_ptr(&volptr, oldptr, newptr) == 0); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset_ptr(&volptr, oldptr, newptr) == 0); + opal_atomic_rmb(); assert(volptr == (void *) 42); 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); 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); volptr = (void *) 42, oldptr = (void *) 42, newptr = (void *) 50; - assert(ompi_atomic_cmpset_rel_ptr(&volptr, oldptr, newptr) == 1); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset_rel_ptr(&volptr, oldptr, newptr) == 1); + opal_atomic_rmb(); assert(volptr == newptr); volptr = (void *) 42, oldptr = (void *) 420, newptr = (void *) 50; - assert(ompi_atomic_cmpset_rel_ptr(&volptr, oldptr, newptr) == 0); - ompi_atomic_rmb(); + assert(opal_atomic_cmpset_rel_ptr(&volptr, oldptr, newptr) == 0); + opal_atomic_rmb(); assert(volptr == (void *) 42); /* -- add_32 tests -- */ val32 = 42; - assert(ompi_atomic_add_32(&val32, 5) == (42 + 5)); - ompi_atomic_rmb(); + assert(opal_atomic_add_32(&val32, 5) == (42 + 5)); + opal_atomic_rmb(); assert((42 + 5) == val32); /* -- add_64 tests -- */ -#if OMPI_HAVE_ATOMIC_MATH_64 +#if OPAL_HAVE_ATOMIC_MATH_64 val64 = 42; - assert(ompi_atomic_add_64(&val64, 5) == (42 + 5)); - ompi_atomic_rmb(); + assert(opal_atomic_add_64(&val64, 5) == (42 + 5)); + opal_atomic_rmb(); assert((42 + 5) == val64); #endif /* -- add_int tests -- */ valint = 42; - ompi_atomic_add(&valint, 5); - ompi_atomic_rmb(); + opal_atomic_add(&valint, 5); + opal_atomic_rmb(); assert((42 + 5) == valint); /* threaded tests */ val32 = 0; -#if OMPI_HAVE_ATOMIC_MATH_64 +#if OPAL_HAVE_ATOMIC_MATH_64 val64 = 0ul; #endif valint = 0; @@ -274,13 +274,13 @@ int main(int argc, char *argv[]) } free(th); - ompi_atomic_rmb(); + opal_atomic_rmb(); assert((5 * nthreads * nreps) == val32); -#if OMPI_HAVE_ATOMIC_MATH_64 - ompi_atomic_rmb(); +#if OPAL_HAVE_ATOMIC_MATH_64 + opal_atomic_rmb(); assert((5 * nthreads * nreps) == val64); #endif - ompi_atomic_rmb(); + opal_atomic_rmb(); assert((5 * nthreads * nreps) == valint); #endif diff --git a/test/asm/atomic_math.c b/test/asm/atomic_math.c index 7cb1521702..f1a872c7fe 100644 --- a/test/asm/atomic_math.c +++ b/test/asm/atomic_math.c @@ -28,7 +28,7 @@ #define TEST_REPS 500 int32_t val32 = 0; -#if OMPI_HAVE_ATOMIC_MATH_64 +#if OPAL_HAVE_ATOMIC_MATH_64 int64_t val64 = 0; #endif int valint = 0; @@ -39,11 +39,11 @@ static void* atomic_math_test(void* arg) int i; for (i = 0 ; i < count ; ++i) { - ompi_atomic_add_32(&val32, 5); -#if OMPI_HAVE_ATOMIC_MATH_64 - ompi_atomic_add_64(&val64, 6); + opal_atomic_add_32(&val32, 5); +#if OPAL_HAVE_ATOMIC_MATH_64 + opal_atomic_add_64(&val64, 6); #endif - ompi_atomic_add(&valint, 4); + opal_atomic_add(&valint, 4); } return NULL; @@ -117,17 +117,17 @@ main(int argc, char *argv[]) ret = atomic_math_test_th(TEST_REPS, num_threads); if (ret == 77) return ret; - ompi_atomic_mb(); + opal_atomic_mb(); 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); ret = 1; } -#if OMPI_HAVE_ATOMIC_MATH_64 +#if OPAL_HAVE_ATOMIC_MATH_64 if (val64 != TEST_REPS * num_threads * 6) { /* Safe to case to (int) here because we know it's going to be 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); ret = 1; } @@ -135,7 +135,7 @@ main(int argc, char *argv[]) printf(" * skipping 64 bit tests\n"); #endif 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); ret = 1; } diff --git a/test/asm/atomic_spinlock.c b/test/asm/atomic_spinlock.c index 2754e09b8b..b82aff7a63 100644 --- a/test/asm/atomic_spinlock.c +++ b/test/asm/atomic_spinlock.c @@ -32,10 +32,10 @@ int atomic_verbose = 0; struct start_info { int tid; 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 static void* atomic_spinlock_start(void* arg) @@ -49,7 +49,7 @@ static void* atomic_spinlock_start(void* arg) 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 pthread_t *th; @@ -94,18 +94,18 @@ atomic_spinlock_test_th(ompi_lock_t *lock, int count, int id, int thr_count) 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; 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); } - 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); } - ompi_atomic_unlock(lock); + opal_atomic_unlock(lock); } return 0; @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) { int ret = 77; - ompi_lock_t lock; + opal_atomic_lock_t lock; int num_threads = 1; if (argc != 2) { @@ -125,7 +125,7 @@ main(int argc, char *argv[]) } 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); return ret; diff --git a/test/threads/ompi_thread.c b/test/threads/ompi_thread.c index 024aad248c..e245e93891 100644 --- a/test/threads/ompi_thread.c +++ b/test/threads/ompi_thread.c @@ -25,13 +25,13 @@ static volatile int count = 0; static void* thr1_run(opal_object_t* obj) { - ompi_atomic_add(&count, 1); + opal_atomic_add(&count, 1); return NULL; } static void* thr2_run(opal_object_t* obj) { - ompi_atomic_add(&count, 2); + opal_atomic_add(&count, 2); return NULL; }