Skip to content

Commit 1e069fc

Browse files
committed
mca/base: add priority output to mca_base_select
The mca_base_select function uses returned priorities to select the best component/module. This priority may be of use to the caller so pass that information back in an optional argument. If the priority is not needed pass NULL. Signed-off-by: Nathan Hjelm <[email protected]> (cherry picked from open-mpi/ompi@8b5810f)
1 parent df072d7 commit 1e069fc

File tree

21 files changed

+75
-31
lines changed

21 files changed

+75
-31
lines changed

ompi/mca/crcp/base/crcp_base_select.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ int ompi_crcp_base_select(void)
162162
if( OPAL_SUCCESS != mca_base_select("crcp", ompi_crcp_base_framework.framework_output,
163163
&ompi_crcp_base_framework.framework_components,
164164
(mca_base_module_t **) &best_module,
165-
(mca_base_component_t **) &best_component) ) {
165+
(mca_base_component_t **) &best_component, NULL) ) {
166166
/* This will only happen if no component was selected */
167167
return OMPI_ERROR;
168168
}

ompi/mca/mtl/base/base.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
23
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
34
* University Research and Technology
@@ -9,6 +10,8 @@
910
* University of Stuttgart. All rights reserved.
1011
* Copyright (c) 2004-2006 The Regents of the University of California.
1112
* All rights reserved.
13+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
14+
* reserved.
1215
* $COPYRIGHT$
1316
*
1417
* Additional copyrights may follow
@@ -34,7 +37,8 @@ BEGIN_C_DECLS
3437
OMPI_DECLSPEC extern mca_mtl_base_component_t* ompi_mtl_base_selected_component;
3538

3639
OMPI_DECLSPEC int ompi_mtl_base_select(bool enable_progress_threads,
37-
bool enable_mpi_threads);
40+
bool enable_mpi_threads,
41+
int *priority);
3842

3943
OMPI_DECLSPEC extern mca_base_framework_t ompi_mtl_base_framework;
4044

ompi/mca/mtl/base/mtl_base_frame.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
23
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
34
* University Research and Technology
@@ -54,14 +55,16 @@ ompi_mtl_base_select(bool enable_progress_threads,
5455
int ret = OMPI_ERR_NOT_FOUND;
5556
mca_mtl_base_component_t *best_component = NULL;
5657
mca_mtl_base_module_t *best_module = NULL;
58+
int best_priority;
5759

5860
/*
5961
* Select the best component
6062
*/
6163
if( OPAL_SUCCESS != mca_base_select("mtl", ompi_mtl_base_framework.framework_output,
6264
&ompi_mtl_base_framework.framework_components,
6365
(mca_base_module_t **) &best_module,
64-
(mca_base_component_t **) &best_component) ) {
66+
(mca_base_component_t **) &best_component,
67+
&best_priority) ) {
6568
/* notify caller that no available component found */
6669
return ret;
6770
}

opal/mca/base/base.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ OPAL_DECLSPEC int mca_base_close(void);
134134
OPAL_DECLSPEC int mca_base_select(const char *type_name, int output_id,
135135
opal_list_t *components_available,
136136
mca_base_module_t **best_module,
137-
mca_base_component_t **best_component);
137+
mca_base_component_t **best_component,
138+
int *priority_out);
138139

139140
/**
140141
* A function for component query functions to discover if they have

opal/mca/base/mca_base_components_select.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
23
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
34
* University Research and Technology
@@ -33,7 +34,8 @@
3334
int mca_base_select(const char *type_name, int output_id,
3435
opal_list_t *components_available,
3536
mca_base_module_t **best_module,
36-
mca_base_component_t **best_component)
37+
mca_base_component_t **best_component,
38+
int *priority_out)
3739
{
3840
mca_base_component_list_item_t *cli = NULL;
3941
mca_base_component_t *component = NULL;
@@ -108,6 +110,9 @@ int mca_base_select(const char *type_name, int output_id,
108110
}
109111
}
110112

113+
if (priority_out) {
114+
*priority_out = best_priority;
115+
}
111116

112117
/*
113118
* Finished querying all components.

opal/mca/compress/base/compress_base_select.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
23
* Copyright (c) 2004-2010 The Trustees of Indiana University.
34
* All rights reserved.
45
* Copyright (c) 2015 Research Organization for Information Science
56
* and Technology (RIST). All rights reserved.
67
*
8+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
9+
* reserved.
710
* $COPYRIGHT$
811
*
912
* Additional copyrights may follow
@@ -43,7 +46,7 @@ int opal_compress_base_select(void)
4346
if( OPAL_SUCCESS != mca_base_select("compress", opal_compress_base_framework.framework_output,
4447
&opal_compress_base_framework.framework_components,
4548
(mca_base_module_t **) &best_module,
46-
(mca_base_component_t **) &best_component) ) {
49+
(mca_base_component_t **) &best_component, NULL) ) {
4750
/* This will only happen if no component was selected */
4851
exit_status = OPAL_ERROR;
4952
goto cleanup;

opal/mca/crs/base/crs_base_select.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int opal_crs_base_select(void)
5858
if( OPAL_SUCCESS != mca_base_select("crs", opal_crs_base_framework.framework_output,
5959
&opal_crs_base_framework.framework_components,
6060
(mca_base_module_t **) &best_module,
61-
(mca_base_component_t **) &best_component) ) {
61+
(mca_base_component_t **) &best_component, NULL) ) {
6262
/* This will only happen if no component was selected */
6363
return OPAL_ERROR;
6464
}

opal/mca/dl/base/dl_base_select.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
23
* Copyright (c) 2004-2010 The Trustees of Indiana University.
34
* All rights reserved.
45
*
56
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
67
* $COPYRIGHT$
8+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
9+
* reserved.
710
*
811
* Additional copyrights may follow
912
*
@@ -37,7 +40,7 @@ int opal_dl_base_select(void)
3740
opal_dl_base_framework.framework_output,
3841
&opal_dl_base_framework.framework_components,
3942
(mca_base_module_t **) &best_module,
40-
(mca_base_component_t **) &best_component) ) {
43+
(mca_base_component_t **) &best_component, NULL) ) {
4144
/* This will only happen if no component was selected */
4245
exit_status = OPAL_ERROR;
4346
goto cleanup;

opal/mca/memchecker/base/memchecker_base_select.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
23
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
34
* University of Stuttgart. All rights reserved.
45
* Copyright (c) 2004-2008 The Trustees of Indiana University.
56
* All rights reserved.
7+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
8+
* reserved.
69
* $COPYRIGHT$
710
*
811
* Additional copyrights may follow
@@ -40,7 +43,7 @@ int opal_memchecker_base_select(void)
4043
if( OPAL_SUCCESS != mca_base_select("memchecker", opal_memchecker_base_framework.framework_output,
4144
&opal_memchecker_base_framework.framework_components,
4245
(mca_base_module_t **) &best_module,
43-
(mca_base_component_t **) &best_component) ) {
46+
(mca_base_component_t **) &best_component, NULL) ) {
4447
/* This will only happen if no component was selected */
4548
exit_status = OPAL_ERR_NOT_FOUND;
4649
goto cleanup;

opal/mca/pmix/base/pmix_base_select.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
23
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
4+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
5+
* reserved.
36
* $COPYRIGHT$
47
*
58
* Additional copyrights may follow
@@ -31,7 +34,7 @@ int opal_pmix_base_select(void)
3134
if( OPAL_SUCCESS != mca_base_select("pmix", opal_pmix_base_framework.framework_output,
3235
&opal_pmix_base_framework.framework_components,
3336
(mca_base_module_t **) &best_module,
34-
(mca_base_component_t **) &best_component) ) {
37+
(mca_base_component_t **) &best_component, NULL) ) {
3538
/* notify caller that no available component found */
3639
return OPAL_ERR_NOT_FOUND;
3740
}

0 commit comments

Comments
 (0)