int mca_pml_crcpw_recv( void *buf, size_t count, ompi_datatype_t *datatype, int src, int tag, struct ompi_communicator_t* comm, ompi_status_public_t* given_status) { int ret = OMPI_SUCCESS, actual_ret = OMPI_SUCCESS; ompi_status_public_t* status = NULL; ompi_crcp_base_pml_state_t * pml_state = NULL; PML_CRCP_STATE_ALLOC(pml_state, ret); pml_state->wrapped_pml_component = &(mca_pml_crcpw_module.wrapped_pml_component); pml_state->wrapped_pml_module = &(mca_pml_crcpw_module.wrapped_pml_module); if( given_status == NULL) { status = (ompi_status_public_t*)malloc(sizeof(ompi_status_public_t)); } else { status = given_status; } pml_state->state = OMPI_CRCP_PML_PRE; pml_state = ompi_crcp.pml_recv(buf, count, datatype, src, tag, comm, status, pml_state); if( OMPI_SUCCESS != pml_state->error_code) { ret = pml_state->error_code; PML_CRCP_STATE_RETURN(pml_state); return ret; } if( OMPI_CRCP_PML_DONE == pml_state->state) { goto CLEANUP; } if( OMPI_CRCP_PML_SKIP != pml_state->state) { if( OMPI_SUCCESS != (actual_ret = mca_pml_crcpw_module.wrapped_pml_module.pml_recv(buf, count, datatype, src, tag, comm, status) ) ) { PML_CRCP_STATE_RETURN(pml_state); return ret; } } pml_state->state = OMPI_CRCP_PML_POST; pml_state = ompi_crcp.pml_recv(buf, count, datatype, src, tag, comm, status, pml_state); if( OMPI_SUCCESS != pml_state->error_code) { ret = pml_state->error_code; PML_CRCP_STATE_RETURN(pml_state); return ret; } if( given_status == NULL) { free(status); } CLEANUP: PML_CRCP_STATE_RETURN(pml_state); opal_cr_stall_check = false; OPAL_CR_TEST_CHECKPOINT_READY(); return actual_ret; }
void opal_cr_thread_exit_library(void) { if( !opal_cr_thread_use_if_avail ) { OPAL_CR_TEST_CHECKPOINT_READY(); } else { /* Allow CR Thread to continue */ OPAL_CR_UNLOCK(); } }
void opal_cr_thread_enter_library(void) { if( !opal_cr_thread_use_if_avail ) { OPAL_CR_TEST_CHECKPOINT_READY(); } else { /* Lock out the CR Thread */ OPAL_CR_LOCK(); } }
void opal_cr_thread_init_library(void) { if( !opal_cr_thread_use_if_avail ) { OPAL_CR_TEST_CHECKPOINT_READY(); } else { /* Activate the CR Thread */ opal_cr_thread_in_library = false; opal_cr_thread_is_done = false; opal_cr_thread_is_active = true; } }
int mca_pml_crcpw_send( void *buf, size_t count, ompi_datatype_t *datatype, int dst, int tag, mca_pml_base_send_mode_t mode, struct ompi_communicator_t* comm ) { int ret; ompi_crcp_base_pml_state_t * pml_state = NULL; PML_CRCP_STATE_ALLOC(pml_state, ret); pml_state->wrapped_pml_component = &(mca_pml_crcpw_module.wrapped_pml_component); pml_state->wrapped_pml_module = &(mca_pml_crcpw_module.wrapped_pml_module); pml_state->state = OMPI_CRCP_PML_PRE; pml_state = ompi_crcp.pml_send(buf, count, datatype, dst, tag, mode, comm, pml_state); if( OMPI_SUCCESS != pml_state->error_code) { ret = pml_state->error_code; PML_CRCP_STATE_RETURN(pml_state); return ret; } if( OMPI_CRCP_PML_SKIP != pml_state->state) { if( OMPI_SUCCESS != (ret = mca_pml_crcpw_module.wrapped_pml_module.pml_send(buf, count, datatype, dst, tag, mode, comm) ) ) { PML_CRCP_STATE_RETURN(pml_state); return ret; } } pml_state->state = OMPI_CRCP_PML_POST; pml_state = ompi_crcp.pml_send(buf, count, datatype, dst, tag, mode, comm, pml_state); if( OMPI_SUCCESS != pml_state->error_code) { ret = pml_state->error_code; PML_CRCP_STATE_RETURN(pml_state); return ret; } PML_CRCP_STATE_RETURN(pml_state); opal_cr_stall_check = false; OPAL_CR_TEST_CHECKPOINT_READY(); return OMPI_SUCCESS; }
void opal_cr_thread_noop_progress(void) { if( !opal_cr_thread_use_if_avail ) { OPAL_CR_TEST_CHECKPOINT_READY(); } }
static void* opal_cr_thread_fn(opal_object_t *obj) { /* Sanity Check */ if( !opal_cr_thread_use_if_avail ) { return NULL; } if( opal_cr_debug_sigpipe ) { if( SIG_ERR == signal(SIGPIPE, opal_cr_sigpipe_debug_signal_handler) ) { ; } } /* * Register this thread with the OPAL CRS */ if( NULL != opal_crs.crs_reg_thread ) { if( OPAL_SUCCESS != opal_crs.crs_reg_thread() ) { opal_output(0, "Error: Thread registration failed\n"); return NULL; } } #if OPAL_ENABLE_CRDEBUG == 1 opal_cr_debug_free_threads[1] = opal_thread_get_self(); #endif /* * Wait to become active */ while( !opal_cr_thread_is_active && !opal_cr_thread_is_done) { sched_yield(); } if( opal_cr_thread_is_done ) { return NULL; } /* * While active */ while( opal_cr_thread_is_active && !opal_cr_thread_is_done) { /* * While no threads are in the MPI library then try to process * checkpoint requests. */ OPAL_CR_THREAD_LOCK(); while ( !opal_cr_thread_in_library ) { sched_yield(); usleep(opal_cr_thread_sleep_check); OPAL_CR_TEST_CHECKPOINT_READY(); /* Sanity check */ if( OPAL_UNLIKELY(opal_cr_currently_stalled) ) { OPAL_CR_TEST_CHECKPOINT_READY(); } } /* * While they are in the MPI library yield */ OPAL_CR_THREAD_UNLOCK(); while ( opal_cr_thread_in_library && opal_cr_thread_is_active ) { usleep(opal_cr_thread_sleep_wait); } } return NULL; }