From 97ff7feda0a9dba67d3eababdbb9833f76239afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=A7=A6=E6=9C=97?= Date: Fri, 12 Sep 2025 08:09:41 +0000 Subject: [PATCH] osc/sm: Add MCA parameter to set priority MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李秦朗 --- ompi/mca/osc/rdma/osc_rdma_component.c | 2 +- ompi/mca/osc/sm/osc_sm.h | 3 +++ ompi/mca/osc/sm/osc_sm_component.c | 14 +++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index a919bd2a35b8..a0d7fe8e6f19 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -230,7 +230,7 @@ static int ompi_osc_rdma_component_register (void) MCA_BASE_VAR_SCOPE_GROUP, &mca_osc_rdma_component.max_attach); free(description_str); - mca_osc_rdma_component.priority = 101; + mca_osc_rdma_component.priority = 20; asprintf(&description_str, "Priority of the osc/rdma component (default: %d)", mca_osc_rdma_component.priority); (void) mca_base_component_var_register (&mca_osc_rdma_component.super.osc_version, "priority", description_str, diff --git a/ompi/mca/osc/sm/osc_sm.h b/ompi/mca/osc/sm/osc_sm.h index f0917b54cb07..49dbb00dc27f 100644 --- a/ompi/mca/osc/sm/osc_sm.h +++ b/ompi/mca/osc/sm/osc_sm.h @@ -62,6 +62,9 @@ typedef struct ompi_osc_sm_node_state_t ompi_osc_sm_node_state_t; struct ompi_osc_sm_component_t { ompi_osc_base_component_t super; + /** Priority of the osc/sm component */ + unsigned int priority; + char *backing_directory; }; typedef struct ompi_osc_sm_component_t ompi_osc_sm_component_t; diff --git a/ompi/mca/osc/sm/osc_sm_component.c b/ompi/mca/osc/sm/osc_sm_component.c index 03a1e949bd36..2797f15f392d 100644 --- a/ompi/mca/osc/sm/osc_sm_component.c +++ b/ompi/mca/osc/sm/osc_sm_component.c @@ -110,6 +110,8 @@ ompi_osc_sm_module_t ompi_osc_sm_module_template = { static int component_register (void) { + char *description_str; + if (0 == access ("/dev/shm", W_OK)) { mca_osc_sm_component.backing_directory = "/dev/shm"; } else { @@ -123,6 +125,16 @@ static int component_register (void) MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_READONLY, &mca_osc_sm_component.backing_directory); + mca_osc_sm_component.priority = 100; + opal_asprintf(&description_str, "Priority of the osc/sm component (default: %d)", + mca_osc_sm_component.priority); + (void)mca_base_component_var_register(&mca_osc_sm_component.super.osc_version, + "priority", description_str, + MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0, + OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_GROUP, + &mca_osc_sm_component.priority); + free(description_str); + return OPAL_SUCCESS; } @@ -178,7 +190,7 @@ component_query(struct ompi_win_t *win, void **base, size_t size, int disp_unit, return ret; } - return 100; + return mca_osc_sm_component.priority; } -- Gitee