static int component_finalize(void) { int i; for (i = 0; i < ompi_proc_world_size(); i++) { ucp_ep_h ep = OSC_UCX_GET_EP(&(ompi_mpi_comm_world.comm), i); if (ep != NULL) { ucp_ep_destroy(ep); } } if (mca_osc_ucx_component.ucp_worker != NULL) { ucp_worker_destroy(mca_osc_ucx_component.ucp_worker); } assert(mca_osc_ucx_component.num_incomplete_req_ops == 0); OBJ_DESTRUCT(&mca_osc_ucx_component.requests); opal_progress_unregister(progress_callback); ucp_cleanup(mca_osc_ucx_component.ucp_context); return OMPI_SUCCESS; }
static int mca_spml_ucx_component_open(void) { ucs_status_t err; ucp_config_t *ucp_config; ucp_params_t params; err = ucp_config_read("OSHMEM", NULL, &ucp_config); if (UCS_OK != err) { return OSHMEM_ERROR; } memset(¶ms, 0, sizeof(params)); params.field_mask = UCP_PARAM_FIELD_FEATURES|UCP_PARAM_FIELD_ESTIMATED_NUM_EPS; params.features = UCP_FEATURE_RMA|UCP_FEATURE_AMO32|UCP_FEATURE_AMO64; params.estimated_num_eps = ompi_proc_world_size(); err = ucp_init(¶ms, ucp_config, &mca_spml_ucx.ucp_context); ucp_config_release(ucp_config); if (UCS_OK != err) { return OSHMEM_ERROR; } return OSHMEM_SUCCESS; }
static int component_init(bool enable_progress_threads, bool enable_mpi_threads) { ucp_config_t *config = NULL; ucp_params_t context_params; bool progress_registered = false, requests_created = false; int ret = OMPI_SUCCESS; ucs_status_t status; mca_osc_ucx_component.ucp_context = NULL; mca_osc_ucx_component.ucp_worker = NULL; mca_osc_ucx_component.enable_mpi_threads = enable_mpi_threads; status = ucp_config_read("MPI", NULL, &config); if (UCS_OK != status) { opal_output_verbose(1, ompi_osc_base_framework.framework_output, "%s:%d: ucp_config_read failed: %d\n", __FILE__, __LINE__, status); return OMPI_ERROR; } OBJ_CONSTRUCT(&mca_osc_ucx_component.requests, opal_free_list_t); requests_created = true; ret = opal_free_list_init (&mca_osc_ucx_component.requests, sizeof(ompi_osc_ucx_request_t), opal_cache_line_size, OBJ_CLASS(ompi_osc_ucx_request_t), 0, 0, 8, 0, 8, NULL, 0, NULL, NULL, NULL); if (OMPI_SUCCESS != ret) { opal_output_verbose(1, ompi_osc_base_framework.framework_output, "%s:%d: opal_free_list_init failed: %d\n", __FILE__, __LINE__, ret); goto error; } mca_osc_ucx_component.num_incomplete_req_ops = 0; ret = opal_progress_register(progress_callback); progress_registered = true; if (OMPI_SUCCESS != ret) { opal_output_verbose(1, ompi_osc_base_framework.framework_output, "%s:%d: opal_progress_register failed: %d\n", __FILE__, __LINE__, ret); goto error; } /* initialize UCP context */ memset(&context_params, 0, sizeof(ucp_context_h)); context_params.field_mask = UCP_PARAM_FIELD_FEATURES | UCP_PARAM_FIELD_MT_WORKERS_SHARED | UCP_PARAM_FIELD_ESTIMATED_NUM_EPS | UCP_PARAM_FIELD_REQUEST_INIT | UCP_PARAM_FIELD_REQUEST_SIZE; context_params.features = UCP_FEATURE_RMA | UCP_FEATURE_AMO32 | UCP_FEATURE_AMO64; context_params.mt_workers_shared = 0; context_params.estimated_num_eps = ompi_proc_world_size(); context_params.request_init = internal_req_init; context_params.request_size = sizeof(ompi_osc_ucx_internal_request_t); status = ucp_init(&context_params, config, &mca_osc_ucx_component.ucp_context); ucp_config_release(config); if (UCS_OK != status) { opal_output_verbose(1, ompi_osc_base_framework.framework_output, "%s:%d: ucp_init failed: %d\n", __FILE__, __LINE__, status); ret = OMPI_ERROR; goto error; } return ret; error: if (progress_registered) opal_progress_unregister(progress_callback); if (requests_created) OBJ_DESTRUCT(&mca_osc_ucx_component.requests); if (mca_osc_ucx_component.ucp_context) ucp_cleanup(mca_osc_ucx_component.ucp_context); return ret; }