From 748c3a3672d7b7f9cd352228422e7f108d6c5d99 Mon Sep 17 00:00:00 2001 From: Tomasz Gromadzki Date: Tue, 29 Nov 2022 09:21:01 +0100 Subject: [PATCH] core/fabric -collective ofload provider set via environemnt variable FI_OFFLOAD_COLL_PROVIDER Signed-off-by: Tomasz Gromadzki --- prov/coll/src/coll_cq.c | 4 +--- prov/rxm/src/rxm_fabric.c | 16 ++++++++-------- src/fabric.c | 7 +++++++ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/prov/coll/src/coll_cq.c b/prov/coll/src/coll_cq.c index cadf5783cf9..f8058992f62 100644 --- a/prov/coll/src/coll_cq.c +++ b/prov/coll/src/coll_cq.c @@ -86,7 +86,6 @@ int coll_cq_init(struct fid_domain *domain, coll_domain = container_of(domain, struct coll_domain, util_domain.domain_fid.fid); provider = coll_domain->util_domain.fabric->prov; - if (!attr || !(attr->flags & FI_PEER)) { FI_WARN(provider, FI_LOG_CORE, "FI_PEER flag required\n"); return -EINVAL; @@ -103,8 +102,7 @@ int coll_cq_init(struct fid_domain *domain, cq->peer_cq = peer_context->cq; - ret = ofi_cq_init(provider, domain, attr, &cq->util_cq, &ofi_cq_progress, - context); + ret = ofi_cq_init(provider, domain, attr, &cq->util_cq, progress, context); if (ret) goto err; diff --git a/prov/rxm/src/rxm_fabric.c b/prov/rxm/src/rxm_fabric.c index 8c78d3c2191..bb56df6df88 100644 --- a/prov/rxm/src/rxm_fabric.c +++ b/prov/rxm/src/rxm_fabric.c @@ -128,20 +128,20 @@ static int rxm_fabric_init_offload_coll(struct rxm_fabric *fabric) */ struct fi_info *hints, *offload_coll_info; struct fid_fabric *offload_coll_fabric; + char *offload_coll_name; int ret; + fi_param_get_str(NULL, "offload_coll_provider", &offload_coll_name); + + if (!strlen(offload_coll_name)) { + return 0; + } + hints = fi_allocinfo(); if (!hints) return -FI_ENOMEM; - hints->fabric_attr->prov_name = strdup(OFI_OFFLOAD_PREFIX "sharp"); // XXX to be fixed - // provider is discovered - // by feature - if (!hints->fabric_attr->prov_name) { - fi_freeinfo(hints); - return -FI_ENOMEM; - } - + hints->fabric_attr->prov_name = strdup(offload_coll_name); hints->mode = FI_PEER_TRANSFER; ret = fi_getinfo(OFI_VERSION_LATEST, NULL, NULL, OFI_OFFLOAD_PROV_ONLY, hints, &offload_coll_info); diff --git a/src/fabric.c b/src/fabric.c index 1d9be3f4311..046e4206d81 100644 --- a/src/fabric.c +++ b/src/fabric.c @@ -3,6 +3,7 @@ * Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013-2017 Intel Corp., Inc. All rights reserved. * (C) Copyright 2020 Hewlett Packard Enterprise Development LP + * Copyright (c) 2022 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -662,6 +663,8 @@ static void ofi_find_prov_libs(void) if (ofi_has_util_prefix(prov->prov_name)) { short_prov_name = prov->prov_name + strlen(OFI_UTIL_PREFIX); + } else if (ofi_has_offload_prefix(prov->prov_name)) { + short_prov_name = prov->prov_name + strlen(OFI_OFFLOAD_PREFIX); } else { short_prov_name = prov->prov_name; } @@ -834,6 +837,10 @@ void fi_ini(void) "(default: false)"); fi_param_get_bool(NULL, "av_remove_cleanup", &ofi_av_remove_cleanup); + fi_param_define(NULL, "offload_coll_provider", FI_PARAM_STRING, + "The name of colective offload provider (default: empty - no provider)"); + + ofi_load_dl_prov(); ofi_register_provider(PSM3_INIT, NULL);