Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OPAL_ASSERT() macro to wrap assert(). #8557

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ompi/attribute/attribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object,

default:
/* This should not happen */
assert(0);
OPAL_ASSERT(0);
break;
}
/* Did the callback return non-MPI_SUCCESS? */
Expand Down Expand Up @@ -1073,7 +1073,7 @@ static int ompi_attr_delete_impl(ompi_attribute_type_t type, void *object,

default:
/* This should not happen */
assert(0);
OPAL_ASSERT(0);
break;
}
if (MPI_SUCCESS != ret) {
Expand Down Expand Up @@ -1232,7 +1232,7 @@ static int set_value(ompi_attribute_type_t type, void *object,

default:
/* This should not happen */
assert(0);
OPAL_ASSERT(0);
break;
}
if (MPI_SUCCESS != ret) {
Expand All @@ -1247,7 +1247,7 @@ static int set_value(ompi_attribute_type_t type, void *object,
if ((OMPI_SUCCESS != ret ) || (NULL == keyval)) {
/* Keyval has disappeared underneath us -- this shouldn't
happen! */
assert(0);
OPAL_ASSERT(0);
return OMPI_ERR_BAD_PARAM;
}

Expand Down
6 changes: 3 additions & 3 deletions ompi/communicator/comm_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int ompi_comm_init(void)

/* Setup MPI_COMM_WORLD */
OBJ_CONSTRUCT(&ompi_mpi_comm_world, ompi_communicator_t);
assert(ompi_mpi_comm_world.comm.c_f_to_c_index == 0);
OPAL_ASSERT(ompi_mpi_comm_world.comm.c_f_to_c_index == 0);
group = OBJ_NEW(ompi_group_t);

size = ompi_process_info.num_procs;
Expand Down Expand Up @@ -175,7 +175,7 @@ int ompi_comm_init(void)
}
/* Setup MPI_COMM_SELF */
OBJ_CONSTRUCT(&ompi_mpi_comm_self, ompi_communicator_t);
assert(ompi_mpi_comm_self.comm.c_f_to_c_index == 1);
OPAL_ASSERT(ompi_mpi_comm_self.comm.c_f_to_c_index == 1);
group = OBJ_NEW(ompi_group_t);
group->grp_proc_pointers = ompi_proc_self(&size);
group->grp_my_rank = 0;
Expand Down Expand Up @@ -207,7 +207,7 @@ int ompi_comm_init(void)

/* Setup MPI_COMM_NULL */
OBJ_CONSTRUCT(&ompi_mpi_comm_null, ompi_communicator_t);
assert(ompi_mpi_comm_null.comm.c_f_to_c_index == 2);
OPAL_ASSERT(ompi_mpi_comm_null.comm.c_f_to_c_index == 2);
ompi_mpi_comm_null.comm.c_local_group = &ompi_mpi_group_null.group;
ompi_mpi_comm_null.comm.c_remote_group = &ompi_mpi_group_null.group;
OBJ_RETAIN(&ompi_mpi_group_null.group);
Expand Down
36 changes: 18 additions & 18 deletions ompi/communicator/ft/comm_ft_detector.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ int ompi_comm_failure_detector_finalize(void) {
while( MPI_PROC_NULL != (observing = detector->hb_observing) ) {
#if !FD_LOCAL_PROCS
ompi_proc_t* proc = ompi_comm_peer_lookup(detector->comm, observing);
assert( NULL != proc );
OPAL_ASSERT( NULL != proc );
if( OPAL_PROC_ON_LOCAL_NODE(proc->super.proc_flags) ) {
break;
}
Expand Down Expand Up @@ -313,7 +313,7 @@ int ompi_comm_start_detector(ompi_communicator_t* comm) {
}

static int fd_heartbeat_request(comm_detector_t* detector) {
assert( -1 != comm_heartbeat_request_cb_type /* initialized */);
OPAL_ASSERT( -1 != comm_heartbeat_request_cb_type /* initialized */);
ompi_communicator_t* comm = detector->comm;

if( -2 < detector->hb_rdma_flag /* initialization for values -2, -3 */
Expand All @@ -331,7 +331,7 @@ static int fd_heartbeat_request(comm_detector_t* detector) {
true;
rank = (np+rank-1) % np ) {
ompi_proc_t* proc = ompi_comm_peer_lookup(comm, rank);
assert( NULL != proc );
OPAL_ASSERT( NULL != proc );
if( !ompi_proc_is_active(proc) ) continue;

/* if everybody else is dead, I don't need to monitor myself. */
Expand Down Expand Up @@ -359,20 +359,20 @@ static int fd_heartbeat_request(comm_detector_t* detector) {

if( comm_detector_use_rdma_hb ) {
mca_bml_base_endpoint_t* endpoint = mca_bml_base_get_endpoint(proc);
assert( NULL != endpoint );
OPAL_ASSERT( NULL != endpoint );
mca_bml_base_btl_t *bml_btl = mca_bml_base_btl_array_get_index(&endpoint->btl_rdma, 0);
assert( NULL != bml_btl );
OPAL_ASSERT( NULL != bml_btl );

/* register mem for the flag and cache the reg key */
/* remove previous registration if any */
if( NULL != detector->hb_rdma_flag_lreg ) {
mca_bml_base_deregister_mem(detector->hb_rdma_bml_btl_observing, detector->hb_rdma_flag_lreg);
}
if( NULL != bml_btl->btl->btl_register_mem ) {
assert( !((size_t)&detector->hb_rdma_flag & ALIGNMENT_MASK(bml_btl->btl->btl_put_alignment)) );
OPAL_ASSERT( !((size_t)&detector->hb_rdma_flag & ALIGNMENT_MASK(bml_btl->btl->btl_put_alignment)) );
mca_bml_base_register_mem(bml_btl, (void*)&detector->hb_rdma_flag, sizeof(int),
MCA_BTL_REG_FLAG_LOCAL_WRITE | MCA_BTL_REG_FLAG_REMOTE_WRITE, &detector->hb_rdma_flag_lreg);
assert( NULL != detector->hb_rdma_flag_lreg );
OPAL_ASSERT( NULL != detector->hb_rdma_flag_lreg );
regsize = bml_btl->btl->btl_registration_handle_size;
}
detector->hb_rdma_bml_btl_observing = bml_btl;
Expand All @@ -398,7 +398,7 @@ static int fd_heartbeat_request(comm_detector_t* detector) {
}

static int fd_heartbeat_request_cb(ompi_communicator_t* comm, ompi_comm_heartbeat_req_t* msg) {
assert( &ompi_mpi_comm_world.comm == comm );
OPAL_ASSERT( &ompi_mpi_comm_world.comm == comm );
comm_detector_t* detector = &comm_world_detector;

int np, rr, ro;
Expand All @@ -420,11 +420,11 @@ static int fd_heartbeat_request_cb(ompi_communicator_t* comm, ompi_comm_heartbea
if( comm_detector_use_rdma_hb ) {
ompi_communicator_t* comm = detector->comm;
ompi_proc_t* proc = ompi_comm_peer_lookup(comm, msg->from);
assert( NULL != proc );
OPAL_ASSERT( NULL != proc );
mca_bml_base_endpoint_t* endpoint = mca_bml_base_get_endpoint(proc);
assert( NULL != endpoint );
OPAL_ASSERT( NULL != endpoint );
mca_bml_base_btl_t *bml_btl = mca_bml_base_btl_array_get_index(&endpoint->btl_rdma, 0);
assert( NULL != bml_btl );
OPAL_ASSERT( NULL != bml_btl );

OPAL_THREAD_LOCK(&detector->fd_mutex);
/* registration for the local rank */
Expand All @@ -433,14 +433,14 @@ static int fd_heartbeat_request_cb(ompi_communicator_t* comm, ompi_comm_heartbea
mca_bml_base_deregister_mem(detector->hb_rdma_bml_btl_observer, detector->hb_rdma_rank_lreg);
}
if( NULL != bml_btl->btl->btl_register_mem ) {
assert( !((size_t)&detector->hb_rdma_rank & ALIGNMENT_MASK(bml_btl->btl->btl_put_alignment)) );
OPAL_ASSERT( !((size_t)&detector->hb_rdma_rank & ALIGNMENT_MASK(bml_btl->btl->btl_put_alignment)) );
mca_bml_base_register_mem(bml_btl, &detector->hb_rdma_rank, sizeof(int), 0, &detector->hb_rdma_rank_lreg);
assert( NULL != detector->hb_rdma_rank_lreg );
OPAL_ASSERT( NULL != detector->hb_rdma_rank_lreg );
/* registration for the remote flag */
if( NULL != detector->hb_rdma_rreg ) free(detector->hb_rdma_rreg);
size_t regsize = bml_btl->btl->btl_registration_handle_size;
detector->hb_rdma_rreg = malloc(regsize);
assert( NULL != detector->hb_rdma_rreg );
OPAL_ASSERT( NULL != detector->hb_rdma_rreg );
memcpy(detector->hb_rdma_rreg, &msg->rdma_rreg[0], regsize);
}
/* cache the bml_btl used for put */
Expand Down Expand Up @@ -598,8 +598,8 @@ void* fd_progress(opal_object_t* obj) {
/* force rbcast recv to progress */
int completed = 0;
ret = ompi_request_test(&req, &completed, MPI_STATUS_IGNORE);
assert( OMPI_SUCCESS == ret );
assert( 0 == completed );
OPAL_ASSERT( OMPI_SUCCESS == ret );
OPAL_ASSERT( 0 == completed );
}
}
ret = ompi_request_cancel(req);
Expand Down Expand Up @@ -650,7 +650,7 @@ static int fd_heartbeat_rdma_put(comm_detector_t* detector) {
*/

static int fd_heartbeat_send(comm_detector_t* detector) {
assert( -1 != comm_heartbeat_recv_cb_type /* initialized */);
OPAL_ASSERT( -1 != comm_heartbeat_recv_cb_type /* initialized */);
ompi_communicator_t* comm = detector->comm;
if( comm != &ompi_mpi_comm_world.comm ) return OMPI_ERR_NOT_IMPLEMENTED;

Expand Down Expand Up @@ -685,7 +685,7 @@ static int fd_heartbeat_send(comm_detector_t* detector) {
}

static int fd_heartbeat_recv_cb(ompi_communicator_t* comm, ompi_comm_heartbeat_message_t* msg) {
assert( &ompi_mpi_comm_world.comm == comm );
OPAL_ASSERT( &ompi_mpi_comm_world.comm == comm );
comm_detector_t* detector = &comm_world_detector;


Expand Down
16 changes: 8 additions & 8 deletions ompi/communicator/ft/comm_ft_reliable_bcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ static void ompi_comm_rbcast_bml_recv_cb(
ompi_communicator_t* comm;

/* Parse the rbcast fragment */
assert( MCA_BTL_TAG_FT_RBCAST == tag );
assert( 1 == descriptor->des_segment_count );
assert( sizeof(ompi_comm_rbcast_message_t) <= descriptor->des_segments->seg_len );
OPAL_ASSERT( MCA_BTL_TAG_FT_RBCAST == tag );
OPAL_ASSERT( 1 == descriptor->des_segment_count );
OPAL_ASSERT( sizeof(ompi_comm_rbcast_message_t) <= descriptor->des_segments->seg_len );
msg = (ompi_comm_rbcast_message_t*) descriptor->des_segments->seg_addr.pval;

OPAL_OUTPUT_VERBOSE((10, ompi_ftmpi_output_handle,
Expand Down Expand Up @@ -196,7 +196,7 @@ static void ompi_comm_rbcast_bml_recv_cb(
}

/* invoke the local registered callback for the type */
assert( 0 <= msg->type && RBCAST_CB_TYPE_MAX >= msg->type );
OPAL_ASSERT( 0 <= msg->type && RBCAST_CB_TYPE_MAX >= msg->type );
if( NULL != ompi_comm_rbcast_cb[msg->type] ) {
if( ompi_comm_rbcast_cb[msg->type](comm, msg) ) {
/* forward the rbcast */
Expand All @@ -208,15 +208,15 @@ static void ompi_comm_rbcast_bml_recv_cb(
* that we keep receiving messages after we deregistered the type.
* Any other time, this is indicative of a problem.
*/
assert(ompi_mpi_state >= OMPI_MPI_STATE_FINALIZE_STARTED);
OPAL_ASSERT(ompi_mpi_state >= OMPI_MPI_STATE_FINALIZE_STARTED);
}
}

int ompi_comm_rbcast_send_msg(ompi_proc_t* proc, ompi_comm_rbcast_message_t* msg, size_t size) {
mca_bml_base_endpoint_t* endpoint = mca_bml_base_get_endpoint(proc);
assert( NULL != endpoint );
OPAL_ASSERT( NULL != endpoint );
mca_bml_base_btl_t *bml_btl = mca_bml_base_btl_array_get_index(&endpoint->btl_eager, 0);
assert( NULL != bml_btl );
OPAL_ASSERT( NULL != bml_btl );
mca_btl_base_descriptor_t *des;
int ret;

Expand All @@ -238,7 +238,7 @@ int ompi_comm_rbcast_send_msg(ompi_proc_t* proc, ompi_comm_rbcast_message_t* msg
OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), __func__);
return OMPI_ERR_OUT_OF_RESOURCE;
}
assert( des->des_segments->seg_len == size ) ;
OPAL_ASSERT( des->des_segments->seg_len == size ) ;
des->des_cbfunc = ompi_rbcast_bml_send_complete_cb;
memcpy(des->des_segments->seg_addr.pval, msg, size);
ret = mca_bml_base_send(bml_btl, des, MCA_BTL_TAG_FT_RBCAST);
Expand Down
14 changes: 7 additions & 7 deletions ompi/datatype/ompi_datatype_args.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int32_t ompi_datatype_set_args( ompi_datatype_t* pData,
int pos;
ompi_datatype_args_t* pArgs;

assert( NULL == pData->args );
OPAL_ASSERT( NULL == pData->args );
ALLOC_ARGS( pData, ci, ca, cd );

pArgs = (ompi_datatype_args_t*)pData->args;
Expand Down Expand Up @@ -397,7 +397,7 @@ int32_t ompi_datatype_release_args( ompi_datatype_t* pData )
int i;
ompi_datatype_args_t* pArgs = (ompi_datatype_args_t*)pData->args;

assert( 0 < pArgs->ref_count );
OPAL_ASSERT( 0 < pArgs->ref_count );
OPAL_THREAD_ADD_FETCH32(&pArgs->ref_count, -1);
if( 0 == pArgs->ref_count ) {
/* There are some duplicated datatypes around that have a pointer to this
Expand Down Expand Up @@ -507,7 +507,7 @@ int ompi_datatype_get_pack_description( ompi_datatype_t* datatype,
* If not reassess the size of the packed buffer necessary for holding the
* datatype description.
*/
assert(args->total_pack_size >= (uintptr_t)((char*)recursive_buffer - (char *) packed_description));
OPAL_ASSERT(args->total_pack_size >= (uintptr_t)((char*)recursive_buffer - (char *) packed_description));
args->total_pack_size = (uintptr_t)((char*)recursive_buffer - (char *) packed_description);
}

Expand Down Expand Up @@ -550,8 +550,8 @@ size_t ompi_datatype_pack_description_length( ompi_datatype_t* datatype )
return 0;
}
}
assert( NULL != (ompi_datatype_args_t*)datatype->args );
assert( NULL != (ompi_datatype_args_t*)datatype->packed_description );
OPAL_ASSERT( NULL != (ompi_datatype_args_t*)datatype->args );
OPAL_ASSERT( NULL != (ompi_datatype_args_t*)datatype->packed_description );
return ((ompi_datatype_args_t*)datatype->args)->total_pack_size;
}

Expand Down Expand Up @@ -593,7 +593,7 @@ static ompi_datatype_t* __ompi_datatype_create_from_packed_description( void** p
data_id = opal_swap_bytes4(data_id);
}
#endif
assert( data_id < OMPI_DATATYPE_MAX_PREDEFINED );
OPAL_ASSERT( data_id < OMPI_DATATYPE_MAX_PREDEFINED );
*packed_buffer = position + 2;
return (ompi_datatype_t*)ompi_datatype_basicDatatypes[data_id];
}
Expand Down Expand Up @@ -691,7 +691,7 @@ static ompi_datatype_t* __ompi_datatype_create_from_args( int32_t* i, MPI_Aint*
case MPI_COMBINER_DUP:
/* should we duplicate d[0]? */
/* ompi_datatype_set_args( datatype, 0, NULL, 0, NULL, 1, d[0], MPI_COMBINER_DUP ); */
assert(0); /* shouldn't happen */
OPAL_ASSERT(0); /* shouldn't happen */
break;
/******************************************************************/
case MPI_COMBINER_CONTIGUOUS:
Expand Down
2 changes: 1 addition & 1 deletion ompi/datatype/ompi_datatype_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ int32_t ompi_datatype_init( void )
ompi_mpi_##name.dt.d_f_to_c_index = index; \
rc = opal_pointer_array_set_item(&ompi_datatype_f_to_c_table, \
index, &ompi_mpi_##name); \
assert( rc == OPAL_SUCCESS ); \
OPAL_ASSERT( rc == OPAL_SUCCESS ); \
if( ompi_datatype_number_of_predefined_data < (ompi_mpi_##name).dt.d_f_to_c_index + 1 ) \
ompi_datatype_number_of_predefined_data = (ompi_mpi_##name).dt.d_f_to_c_index + 1; \
} while(0)
Expand Down
2 changes: 1 addition & 1 deletion ompi/dpm/dpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
/* we will set the rportlen to a negative value corresponding to the
* error code produced by pmix spawn */
char *value = strrchr(port_string, '=');
assert(NULL != value);
OPAL_ASSERT(NULL != value);
rportlen = atoi(++value);
if (rportlen > 0) rportlen *= -1;
goto bcast_rportlen;
Expand Down
2 changes: 1 addition & 1 deletion ompi/errhandler/errhandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ static void *ompi_errhandler_event_cb(int fd, int flags, void *context) {
if( NULL == proc ) {
continue; /* we are not 'MPI connected' with this proc. */
}
assert( !ompi_proc_is_sentinel(proc) );
OPAL_ASSERT( !ompi_proc_is_sentinel(proc) );
ompi_errhandler_proc_failed_internal(proc, status, false);
}
opal_event_del(&event->super);
Expand Down
2 changes: 1 addition & 1 deletion ompi/errhandler/errhandler_predefined.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ static void backend_abort_no_aggregate(int fatal, char *type,
char *arg;

int32_t state = ompi_mpi_state;
assert(state < OMPI_MPI_STATE_INIT_COMPLETED ||
OPAL_ASSERT(state < OMPI_MPI_STATE_INIT_COMPLETED ||
state >= OMPI_MPI_STATE_FINALIZE_PAST_COMM_SELF_DESTRUCT);

fflush(stdout);
Expand Down
4 changes: 2 additions & 2 deletions ompi/group/group.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int ompi_group_translate_ranks ( ompi_group_t *group1,
}

/* unknown sparse group type */
assert (0);
OPAL_ASSERT(0);
}

if( group2->grp_parent_group_ptr == group1 ) { /* from parent to child*/
Expand All @@ -96,7 +96,7 @@ int ompi_group_translate_ranks ( ompi_group_t *group1,
}

/* unknown sparse group type */
assert (0);
OPAL_ASSERT(0);
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions ompi/group/group.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ static inline struct ompi_proc_t *ompi_group_peer_lookup_existing (ompi_group_t
static inline int ompi_group_proc_lookup_rank (ompi_group_t* group, ompi_proc_t* proc)
{
int i, np, v;
assert( NULL != proc );
assert( !ompi_proc_is_sentinel(proc) );
OPAL_ASSERT( NULL != proc );
OPAL_ASSERT( !ompi_proc_is_sentinel(proc) );
np = ompi_group_size(group);
if( 0 == np ) return MPI_PROC_NULL;
/* heuristic: On comm_world, start the lookup from v=vpid, so that
Expand Down
6 changes: 3 additions & 3 deletions ompi/group/group_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ ompi_group_t *ompi_group_allocate_plist_w_procs (ompi_proc_t **procs, int group_
/* local variables */
ompi_group_t * new_group = NULL;

assert (group_size >= 0);
OPAL_ASSERT(group_size >= 0);

/* create new group group element */
new_group = OBJ_NEW(ompi_group_t);
Expand Down Expand Up @@ -127,7 +127,7 @@ ompi_group_t *ompi_group_allocate_sporadic(int group_size)
/* local variables */
ompi_group_t *new_group = NULL;

assert (group_size >= 0);
OPAL_ASSERT(group_size >= 0);

/* create new group group element */
new_group = OBJ_NEW(ompi_group_t);
Expand Down Expand Up @@ -196,7 +196,7 @@ ompi_group_t *ompi_group_allocate_bmap(int orig_group_size , int group_size)
{
ompi_group_t *new_group = NULL;

assert (group_size >= 0);
OPAL_ASSERT(group_size >= 0);

/* create new group group element */
new_group = OBJ_NEW(ompi_group_t);
Expand Down
Loading