static void orte_iof_base_write_event_construct(orte_iof_write_event_t* wev) { wev->pending = false; wev->fd = -1; OBJ_CONSTRUCT(&wev->outputs, opal_list_t); wev->ev = opal_event_alloc(); }
static void launch_local_const(orte_odls_launch_local_t *ptr) { ptr->ev = opal_event_alloc(); ptr->job = ORTE_JOBID_INVALID; ptr->fork_local = NULL; ptr->retries = 0; }
static void orte_iof_base_read_event_construct(orte_iof_read_event_t* rev) { rev->proc = NULL; rev->fd = -1; rev->active = false; rev->ev = opal_event_alloc(); rev->sink = NULL; }
static int mca_oob_tcp_send_self( mca_oob_tcp_peer_t* peer, mca_oob_tcp_msg_t* msg, struct iovec* iov, int count) { unsigned char *ptr; int size = 0; int rc; orte_self_send_xfer_t *xfer; for(rc = 0; rc < count; rc++) { size += iov[rc].iov_len; } msg->msg_rwbuf = malloc(size); if(NULL == msg->msg_rwbuf) { return ORTE_ERR_OUT_OF_RESOURCE; } ptr = (unsigned char *)msg->msg_rwbuf; for(rc = 0; rc < count; rc++) { memcpy(ptr, iov[rc].iov_base, iov[rc].iov_len); ptr += iov[rc].iov_len; } msg->msg_hdr.msg_size = size; /* * Copied original buffer - so local send completion. */ opal_mutex_lock(&msg->msg_lock); msg->msg_complete = true; if(NULL != msg->msg_cbfunc) { msg->msg_cbfunc( ORTE_SUCCESS, &peer->peer_name, msg->msg_uiov, msg->msg_ucnt, msg->msg_hdr.msg_tag, msg->msg_cbdata); } else { opal_condition_broadcast(&msg->msg_condition); } opal_mutex_unlock(&msg->msg_lock); xfer = (orte_self_send_xfer_t*)malloc(sizeof(orte_self_send_xfer_t)); xfer->ev = opal_event_alloc(); xfer->peer = peer; xfer->msg = msg; opal_event_set(orte_event_base, xfer->ev, -1, OPAL_EV_WRITE, mca_oob_tcp_send_snd_exe, xfer); opal_event_set_priority(xfer->ev, ORTE_MSG_PRI); opal_event_active(xfer->ev, OPAL_EV_WRITE, 1); return size; }
int orte_init(int* pargc, char*** pargv, orte_proc_type_t flags) { int ret; char *error = NULL; if (0 < orte_initialized) { /* track number of times we have been called */ orte_initialized++; return ORTE_SUCCESS; } orte_initialized++; /* initialize the opal layer */ if (ORTE_SUCCESS != (ret = opal_init(pargc, pargv))) { error = "opal_init"; goto error; } /* ensure we know the type of proc for when we finalize */ orte_process_info.proc_type = flags; /* setup the locks */ if (ORTE_SUCCESS != (ret = orte_locks_init())) { error = "orte_locks_init"; goto error; } /* Register all MCA Params */ if (ORTE_SUCCESS != (ret = orte_register_params())) { error = "orte_register_params"; goto error; } /* setup the orte_show_help system */ if (ORTE_SUCCESS != (ret = orte_show_help_init())) { error = "opal_output_init"; goto error; } /* register handler for errnum -> string conversion */ opal_error_register("ORTE", ORTE_ERR_BASE, ORTE_ERR_MAX, orte_err2str); /* Ensure the rest of the process info structure is initialized */ if (ORTE_SUCCESS != (ret = orte_proc_info())) { error = "orte_proc_info"; goto error; } /* open the ESS and select the correct module for this environment */ if (ORTE_SUCCESS != (ret = orte_ess_base_open())) { error = "orte_ess_base_open"; goto error; } if (ORTE_SUCCESS != (ret = orte_ess_base_select())) { error = "orte_ess_base_select"; goto error; } if (ORTE_PROC_IS_APP) { #if !ORTE_DISABLE_FULL_SUPPORT && ORTE_ENABLE_PROGRESS_THREADS #if OPAL_EVENT_HAVE_THREAD_SUPPORT /* get a separate orte event base */ orte_event_base = opal_event_base_create(); /* setup the finalize event - we'll need it * to break the thread out of the event lib * when we want to stop it */ opal_event_set(orte_event_base, &orte_finalize_event, -1, OPAL_EV_WRITE, ignore_callback, NULL); opal_event_set_priority(&orte_finalize_event, ORTE_ERROR_PRI); #if 0 { /* seems strange, but wake us up once a second just so we can check for new events */ opal_event_t *ev; struct timeval tv = {1,0}; ev = opal_event_alloc(); opal_event_evtimer_set(orte_event_base, ev, ignore_callback, ev); opal_event_set_priority(ev, ORTE_INFO_PRI); opal_event_evtimer_add(ev, &tv); } #endif /* construct the thread object */ OBJ_CONSTRUCT(&orte_progress_thread, opal_thread_t); /* fork off a thread to progress it */ orte_progress_thread.t_run = orte_progress_thread_engine; if (OPAL_SUCCESS != (ret = opal_thread_start(&orte_progress_thread))) { error = "orte progress thread start"; goto error; } #else error = "event thread support is not configured"; ret = ORTE_ERROR; goto error; #endif #else /* set the event base to the opal one */ orte_event_base = opal_event_base; #endif } else { /* set the event base to the opal one */ orte_event_base = opal_event_base; } /* initialize the RTE for this environment */ if (ORTE_SUCCESS != (ret = orte_ess.init())) { error = "orte_ess_init"; goto error; } /* All done */ return ORTE_SUCCESS; error: if (ORTE_ERR_SILENT != ret) { orte_show_help("help-orte-runtime", "orte_init:startup:internal-failure", true, error, ORTE_ERROR_NAME(ret), ret); } return ret; }