void ucp_cleanup(ucp_context_h context) { ucp_tag_cleanup(context); ucp_free_resources(context); ucp_free_config(context); ucs_free(context); }
void ucp_cleanup(ucp_context_h context) { ucp_free_resources(context); ucp_free_config(context); UCP_THREAD_LOCK_FINALIZE(&context->mt_lock); ucs_free(context); }
ucs_status_t ucp_init_version(unsigned api_major_version, unsigned api_minor_version, const ucp_params_t *params, const ucp_config_t *config, ucp_context_h *context_p) { unsigned major_version, minor_version, release_number; ucp_context_t *context; ucs_status_t status; ucp_get_version(&major_version, &minor_version, &release_number); if ((api_major_version != major_version) || (api_minor_version != minor_version)) { ucs_error("UCP version is incompatible, required: %d.%d, actual: %d.%d (release %d)", api_major_version, api_minor_version, major_version, minor_version, release_number); status = UCS_ERR_NOT_IMPLEMENTED; goto err; } /* allocate a ucp context */ context = ucs_calloc(1, sizeof(*context), "ucp context"); if (context == NULL) { status = UCS_ERR_NO_MEMORY; goto err; } status = ucp_fill_config(context, params, config); if (status != UCS_OK) { goto err_free_ctx; } /* fill resources we should use */ status = ucp_fill_resources(context, config); if (status != UCS_OK) { goto err_free_config; } /* initialize tag matching */ ucs_queue_head_init(&context->tag.expected); ucs_queue_head_init(&context->tag.unexpected); ucs_debug("created ucp context %p [%d mds %d tls] features 0x%lx", context, context->num_mds, context->num_tls, context->config.features); *context_p = context; return UCS_OK; err_free_config: ucp_free_config(context); err_free_ctx: ucs_free(context); err: return status; }
ucs_status_t ucp_init(uint64_t features, size_t request_headroom, const ucp_config_t *config, ucp_context_h *context_p) { ucp_context_t *context; ucs_status_t status; /* allocate a ucp context */ context = ucs_calloc(1, sizeof(*context), "ucp context"); if (context == NULL) { status = UCS_ERR_NO_MEMORY; goto err; } status = ucp_fill_config(context, features, config); if (status != UCS_OK) { goto err_free_ctx; } /* fill resources we should use */ status = ucp_fill_resources(context, config); if (status != UCS_OK) { goto err_free_resources; } /* initialize tag matching */ status = ucp_tag_init(context); if (status != UCS_OK) { goto err_free_config; } *context_p = context; return UCS_OK; err_free_resources: ucp_free_resources(context); err_free_config: ucp_free_config(context); err_free_ctx: ucs_free(context); err: return status; }