From 9d4a26f47d83f946212b7c199f9b2272ed33f2d0 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Wed, 27 Mar 2013 21:17:31 +0000 Subject: [PATCH] Update OMPI frameworks to use the MCA framework system. Notes: - This commit also eliminates the need for an available components list in use in several frameworks. None of the code in question was making use of the priority field of the priority component list item so these extra lists were removed. - Cleaned up selection code in several frameworks to sort lists using opal_list_sort. - Cleans up the ompi/orte-info functions. Expose the functions that construct the list of params so they can be used elsewhere. patches for mtl/portals4 from brian missed a few output variables in openib This commit was SVN r28241. --- autogen.pl | 1 - ...tor_base_open.c => allocator_base_frame.c} | 23 +- ompi/mca/allocator/base/base.h | 10 +- ompi/mca/bcol/base/Makefile.am | 3 +- ompi/mca/bcol/base/base.h | 7 +- ompi/mca/bcol/base/bcol_base_close.c | 37 -- .../{bcol_base_open.c => bcol_base_frame.c} | 39 +- .../bcol/basesmuma/bcol_basesmuma_module.c | 2 +- ompi/mca/bml/base/Makefile.am | 3 +- ompi/mca/bml/base/base.h | 7 +- ompi/mca/bml/base/bml_base_close.c | 34 -- .../{bml_base_open.c => bml_base_frame.c} | 32 +- ompi/mca/bml/base/bml_base_init.c | 20 +- ompi/mca/bml/r2/bml_r2_ft.c | 8 +- ompi/mca/btl/base/Makefile.am | 3 +- ompi/mca/btl/base/base.h | 6 +- ompi/mca/btl/base/btl_base_close.c | 81 ---- .../{btl_base_open.c => btl_base_frame.c} | 66 ++-- ompi/mca/btl/base/btl_base_select.c | 28 +- .../openib/connect/btl_openib_connect_oob.c | 10 +- .../connect/btl_openib_connect_rdmacm.c | 22 +- .../openib/connect/btl_openib_connect_xoob.c | 8 +- ompi/mca/btl/tcp/btl_tcp_component.c | 4 +- ompi/mca/btl/tcp/btl_tcp_endpoint.c | 2 +- ompi/mca/coll/base/Makefile.am | 3 +- ompi/mca/coll/base/base.h | 83 +--- ompi/mca/coll/base/coll_base_close.c | 55 --- ompi/mca/coll/base/coll_base_comm_select.c | 64 ++-- ompi/mca/coll/base/coll_base_find_available.c | 79 +--- .../{coll_base_open.c => coll_base_frame.c} | 39 +- ompi/mca/coll/demo/coll_demo_allgather.c | 4 +- ompi/mca/coll/demo/coll_demo_allgatherv.c | 4 +- ompi/mca/coll/demo/coll_demo_allreduce.c | 4 +- ompi/mca/coll/demo/coll_demo_alltoall.c | 4 +- ompi/mca/coll/demo/coll_demo_alltoallv.c | 4 +- ompi/mca/coll/demo/coll_demo_alltoallw.c | 4 +- ompi/mca/coll/demo/coll_demo_barrier.c | 4 +- ompi/mca/coll/demo/coll_demo_bcast.c | 4 +- ompi/mca/coll/demo/coll_demo_exscan.c | 2 +- ompi/mca/coll/demo/coll_demo_gather.c | 4 +- ompi/mca/coll/demo/coll_demo_gatherv.c | 4 +- ompi/mca/coll/demo/coll_demo_reduce.c | 4 +- ompi/mca/coll/demo/coll_demo_reduce_scatter.c | 4 +- ompi/mca/coll/demo/coll_demo_scan.c | 2 +- ompi/mca/coll/demo/coll_demo_scatter.c | 4 +- ompi/mca/coll/demo/coll_demo_scatterv.c | 4 +- ompi/mca/coll/ml/coll_ml_component.c | 4 +- ompi/mca/coll/sm/coll_sm_module.c | 28 +- ompi/mca/crcp/base/Makefile.am | 3 +- ompi/mca/crcp/base/base.h | 26 +- .../{crcp_base_close.c => crcp_base_frame.c} | 28 +- ompi/mca/crcp/base/crcp_base_open.c | 67 ---- ompi/mca/crcp/base/crcp_base_select.c | 8 +- ompi/mca/crcp/bkmrk/crcp_bkmrk_component.c | 2 +- ompi/mca/dpm/base/Makefile.am | 3 +- ompi/mca/dpm/base/base.h | 24 +- ompi/mca/dpm/base/dpm_base_close.c | 42 -- .../{dpm_base_open.c => dpm_base_frame.c} | 30 +- ompi/mca/dpm/base/dpm_base_select.c | 4 +- ompi/mca/dpm/orte/dpm_orte.c | 48 +-- ompi/mca/fbtl/base/Makefile.am | 5 +- ompi/mca/fbtl/base/base.h | 16 +- ompi/mca/fbtl/base/fbtl_base_close.c | 57 --- ompi/mca/fbtl/base/fbtl_base_file_select.c | 121 +----- ompi/mca/fbtl/base/fbtl_base_find_available.c | 73 +--- .../{fbtl_base_open.c => fbtl_base_frame.c} | 37 +- ompi/mca/fcoll/base/Makefile.am | 5 +- ompi/mca/fcoll/base/base.h | 18 +- ompi/mca/fcoll/base/fcoll_base_close.c | 58 --- ompi/mca/fcoll/base/fcoll_base_file_select.c | 135 +------ .../fcoll/base/fcoll_base_find_available.c | 75 +--- .../{fcoll_base_open.c => fcoll_base_frame.c} | 39 +- ompi/mca/fs/base/Makefile.am | 5 +- ompi/mca/fs/base/base.h | 16 +- ompi/mca/fs/base/fs_base_close.c | 58 --- ompi/mca/fs/base/fs_base_file_select.c | 129 +------ ompi/mca/fs/base/fs_base_find_available.c | 89 ++--- .../base/fs_base_frame.c} | 32 +- ompi/mca/fs/base/fs_base_open.c | 80 ---- ompi/mca/io/base/Makefile.am | 3 +- ompi/mca/io/base/base.h | 71 +--- ompi/mca/io/base/io_base_close.c | 56 --- ompi/mca/io/base/io_base_delete.c | 117 ++---- ompi/mca/io/base/io_base_file_select.c | 124 ++---- ompi/mca/io/base/io_base_find_available.c | 67 +--- ompi/mca/io/base/io_base_frame.c | 45 +++ ompi/mca/io/base/io_base_open.c | 84 ---- ompi/mca/io/base/io_base_register_datarep.c | 9 +- ompi/mca/mpool/base/Makefile.am | 3 +- ompi/mca/mpool/base/base.h | 9 +- ompi/mca/mpool/base/mpool_base_close.c | 79 ---- .../{mpool_base_open.c => mpool_base_frame.c} | 76 ++-- ompi/mca/mpool/base/mpool_base_lookup.c | 11 +- ompi/mca/mpool/base/mpool_base_mem_cb.c | 2 + ompi/mca/mpool/base/mpool_base_mem_cb.h | 3 - ompi/mca/mpool/sm/mpool_sm_component.c | 4 +- ompi/mca/mtl/base/Makefile.am | 2 +- ompi/mca/mtl/base/base.h | 6 +- ...{mtl_base_component.c => mtl_base_frame.c} | 75 +--- ompi/mca/mtl/mx/mtl_mx.c | 16 +- ompi/mca/mtl/mx/mtl_mx_endpoint.c | 2 +- ompi/mca/mtl/mx/mtl_mx_probe.c | 2 +- ompi/mca/mtl/mx/mtl_mx_recv.c | 4 +- ompi/mca/mtl/mx/mtl_mx_send.c | 12 +- ompi/mca/mtl/portals4/mtl_portals4.c | 12 +- .../mca/mtl/portals4/mtl_portals4_component.c | 76 ++-- ompi/mca/mtl/portals4/mtl_portals4_flowctl.c | 50 +-- ompi/mca/mtl/portals4/mtl_portals4_probe.c | 8 +- ompi/mca/mtl/portals4/mtl_portals4_recv.c | 50 +-- .../mtl/portals4/mtl_portals4_recv_short.c | 2 +- ompi/mca/mtl/portals4/mtl_portals4_send.c | 42 +- ompi/mca/op/base/Makefile.include | 3 +- ompi/mca/op/base/base.h | 43 +-- ompi/mca/op/base/op_base_close.c | 56 --- ompi/mca/op/base/op_base_find_available.c | 72 +--- .../base/{op_base_open.c => op_base_frame.c} | 57 +-- ompi/mca/op/base/op_base_op_select.c | 57 ++- ompi/mca/op/example/op_example_component.c | 10 +- ompi/mca/op/x86/op_x86_component.c | 10 +- ompi/mca/osc/base/Makefile.am | 3 +- ompi/mca/osc/base/base.h | 8 +- ompi/mca/osc/base/osc_base_close.c | 64 ---- ompi/mca/osc/base/osc_base_frame.c | 76 ++++ ompi/mca/osc/base/osc_base_init.c | 6 +- ompi/mca/osc/base/osc_base_open.c | 103 ----- ompi/mca/osc/pt2pt/osc_pt2pt.c | 2 +- ompi/mca/osc/pt2pt/osc_pt2pt_component.c | 6 +- ompi/mca/osc/pt2pt/osc_pt2pt_data_move.c | 16 +- ompi/mca/osc/pt2pt/osc_pt2pt_sync.c | 32 +- ompi/mca/osc/rdma/osc_rdma.c | 2 +- ompi/mca/osc/rdma/osc_rdma_component.c | 14 +- ompi/mca/osc/rdma/osc_rdma_data_move.c | 24 +- ompi/mca/osc/rdma/osc_rdma_sync.c | 24 +- ompi/mca/pml/base/Makefile.am | 4 +- ompi/mca/pml/base/base.h | 19 +- ompi/mca/pml/base/pml_base_close.c | 86 ----- .../{pml_base_open.c => pml_base_frame.c} | 81 ++-- ompi/mca/pml/base/pml_base_select.c | 48 +-- ompi/mca/pml/bfo/pml_bfo_component.c | 4 +- ompi/mca/pml/cm/pml_cm_component.c | 6 +- ompi/mca/pml/dr/pml_dr_component.c | 9 +- ompi/mca/pml/ob1/pml_ob1_component.c | 4 +- ompi/mca/pml/v/pml_v_component.c | 16 +- ompi/mca/pubsub/base/Makefile.am | 5 +- ompi/mca/pubsub/base/base.h | 35 +- ompi/mca/pubsub/base/pubsub_base_close.c | 43 --- ...pubsub_base_open.c => pubsub_base_frame.c} | 37 +- ompi/mca/pubsub/base/pubsub_base_select.c | 7 +- ompi/mca/pubsub/orte/pubsub_orte.c | 10 +- ompi/mca/rcache/base/Makefile.am | 7 +- ompi/mca/rcache/base/base.h | 16 +- ompi/mca/rcache/base/rcache_base_close.c | 66 ---- ompi/mca/rcache/base/rcache_base_create.c | 4 +- ...rcache_base_open.c => rcache_base_frame.c} | 52 ++- ompi/mca/rte/base/Makefile.am | 5 +- ompi/mca/rte/base/base.h | 45 +-- ompi/mca/rte/base/rte_base_close.c | 42 -- ompi/mca/rte/base/rte_base_frame.c | 49 +++ ompi/mca/rte/base/rte_base_open.c | 88 ----- ompi/mca/rte/pmi/rte_pmi_db.c | 20 +- ompi/mca/sbgp/base/Makefile.am | 4 +- ompi/mca/sbgp/base/base.h | 15 +- ompi/mca/sbgp/base/sbgp_base_close.c | 6 +- .../{sbgp_base_open.c => sbgp_base_frame.c} | 52 +-- ompi/mca/sharedfp/base/Makefile.am | 4 +- ompi/mca/sharedfp/base/base.h | 23 +- ompi/mca/sharedfp/base/sharedfp_base_close.c | 58 --- .../sharedfp/base/sharedfp_base_file_select.c | 122 +----- .../base/sharedfp_base_find_available.c | 75 ++-- ...edfp_base_open.c => sharedfp_base_frame.c} | 48 +-- ompi/mca/topo/base/Makefile.am | 3 +- ompi/mca/topo/base/base.h | 22 +- ompi/mca/topo/base/topo_base_close.c | 54 --- ompi/mca/topo/base/topo_base_comm_select.c | 120 +----- ompi/mca/topo/base/topo_base_find_available.c | 73 ++-- .../{topo_base_open.c => topo_base_frame.c} | 40 +- ompi/mca/vprotocol/base/base.h | 15 +- ompi/mca/vprotocol/base/vprotocol_base.c | 43 ++- .../vprotocol/base/vprotocol_base_select.c | 14 +- ompi/mpi/c/cart_create.c | 21 +- ompi/mpi/c/file_delete.c | 15 +- ompi/mpi/c/file_open.c | 12 +- ompi/mpi/c/graph_create.c | 17 +- ompi/mpi/c/register_datarep.c | 12 +- ompi/runtime/ompi_mpi_finalize.c | 30 +- ompi/runtime/ompi_mpi_init.c | 24 +- ompi/tools/ompi_info/components.c | 358 ++---------------- ompi/tools/ompi_info/ompi_info.c | 39 +- ompi/tools/ompi_info/ompi_info.h | 5 +- ompi/tools/ompi_info/version.c | 1 - opal/runtime/opal_info_support.c | 200 ++-------- opal/runtime/opal_info_support.h | 5 +- orte/runtime/orte_info_support.c | 241 ++---------- orte/runtime/orte_info_support.h | 5 +- orte/tools/orte-info/components.c | 11 +- orte/tools/orte-info/orte-info.c | 46 +-- orte/tools/orte-info/version.c | 1 - 197 files changed, 1553 insertions(+), 5103 deletions(-) rename ompi/mca/allocator/base/{allocator_base_open.c => allocator_base_frame.c} (73%) delete mode 100644 ompi/mca/bcol/base/bcol_base_close.c rename ompi/mca/bcol/base/{bcol_base_open.c => bcol_base_frame.c} (89%) delete mode 100644 ompi/mca/bml/base/bml_base_close.c rename ompi/mca/bml/base/{bml_base_open.c => bml_base_frame.c} (81%) delete mode 100644 ompi/mca/btl/base/btl_base_close.c rename ompi/mca/btl/base/{btl_base_open.c => btl_base_frame.c} (76%) delete mode 100644 ompi/mca/coll/base/coll_base_close.c rename ompi/mca/coll/base/{coll_base_open.c => coll_base_frame.c} (73%) rename ompi/mca/crcp/base/{crcp_base_close.c => crcp_base_frame.c} (62%) delete mode 100644 ompi/mca/crcp/base/crcp_base_open.c delete mode 100644 ompi/mca/dpm/base/dpm_base_close.c rename ompi/mca/dpm/base/{dpm_base_open.c => dpm_base_frame.c} (64%) delete mode 100644 ompi/mca/fbtl/base/fbtl_base_close.c rename ompi/mca/fbtl/base/{fbtl_base_open.c => fbtl_base_frame.c} (57%) delete mode 100644 ompi/mca/fcoll/base/fcoll_base_close.c rename ompi/mca/fcoll/base/{fcoll_base_open.c => fcoll_base_frame.c} (53%) delete mode 100644 ompi/mca/fs/base/fs_base_close.c rename ompi/mca/{allocator/base/allocator_base_close.c => fs/base/fs_base_frame.c} (53%) delete mode 100644 ompi/mca/fs/base/fs_base_open.c delete mode 100644 ompi/mca/io/base/io_base_close.c create mode 100644 ompi/mca/io/base/io_base_frame.c delete mode 100644 ompi/mca/io/base/io_base_open.c delete mode 100644 ompi/mca/mpool/base/mpool_base_close.c rename ompi/mca/mpool/base/{mpool_base_open.c => mpool_base_frame.c} (58%) rename ompi/mca/mtl/base/{mtl_base_component.c => mtl_base_frame.c} (67%) delete mode 100644 ompi/mca/op/base/op_base_close.c rename ompi/mca/op/base/{op_base_open.c => op_base_frame.c} (57%) delete mode 100644 ompi/mca/osc/base/osc_base_close.c create mode 100644 ompi/mca/osc/base/osc_base_frame.c delete mode 100644 ompi/mca/osc/base/osc_base_open.c delete mode 100644 ompi/mca/pml/base/pml_base_close.c rename ompi/mca/pml/base/{pml_base_open.c => pml_base_frame.c} (77%) delete mode 100644 ompi/mca/pubsub/base/pubsub_base_close.c rename ompi/mca/pubsub/base/{pubsub_base_open.c => pubsub_base_frame.c} (60%) delete mode 100644 ompi/mca/rcache/base/rcache_base_close.c rename ompi/mca/rcache/base/{rcache_base_open.c => rcache_base_frame.c} (54%) delete mode 100644 ompi/mca/rte/base/rte_base_close.c create mode 100644 ompi/mca/rte/base/rte_base_frame.c delete mode 100644 ompi/mca/rte/base/rte_base_open.c rename ompi/mca/sbgp/base/{sbgp_base_open.c => sbgp_base_frame.c} (82%) delete mode 100644 ompi/mca/sharedfp/base/sharedfp_base_close.c rename ompi/mca/sharedfp/base/{sharedfp_base_open.c => sharedfp_base_frame.c} (56%) delete mode 100644 ompi/mca/topo/base/topo_base_close.c rename ompi/mca/topo/base/{topo_base_open.c => topo_base_frame.c} (61%) diff --git a/autogen.pl b/autogen.pl index 31567ae420..82f6f74bee 100755 --- a/autogen.pl +++ b/autogen.pl @@ -371,7 +371,6 @@ sub mca_generate_framework_header(\$\@) { # There is no common framework object if ($framework ne "common") { my $framework_name = "${project}_${framework}_base_framework"; - $framework_array_output .= " &$framework_name,\n"; $framework_decl_output .= "extern mca_base_framework_t $framework_name;\n"; } diff --git a/ompi/mca/allocator/base/allocator_base_open.c b/ompi/mca/allocator/base/allocator_base_frame.c similarity index 73% rename from ompi/mca/allocator/base/allocator_base_open.c rename to ompi/mca/allocator/base/allocator_base_frame.c index 71c082aa70..930c807c60 100644 --- a/ompi/mca/allocator/base/allocator_base_open.c +++ b/ompi/mca/allocator/base/allocator_base_frame.c @@ -39,20 +39,8 @@ /* * Global variables */ -opal_list_t mca_allocator_base_components; - -/** - * Function for finding and opening either all MCA components, or the one - * that was specifically requested via a MCA parameter. - */ -int mca_allocator_base_open(void) -{ - /* Open up all available components */ - - return mca_base_components_open("allocator", 0, - mca_allocator_base_static_components, - &mca_allocator_base_components, true); -} +MCA_BASE_FRAMEWORK_DECLARE(ompi, allocator, NULL, NULL, NULL, NULL, + mca_allocator_base_static_components, 0); /** * Traverses through the list of available components, calling their init @@ -66,11 +54,8 @@ int mca_allocator_base_open(void) mca_allocator_base_component_t* mca_allocator_component_lookup(const char* name) { /* Traverse the list of available components; call their init functions. */ - opal_list_item_t* item; - for (item = opal_list_get_first(&mca_allocator_base_components); - item != opal_list_get_end(&mca_allocator_base_components); - item = opal_list_get_next(item)) { - mca_base_component_list_item_t *cli = (mca_base_component_list_item_t *) item; + mca_base_component_list_item_t *cli; + OPAL_LIST_FOREACH(cli, &ompi_allocator_base_framework.framework_components, mca_base_component_list_item_t) { mca_allocator_base_component_t* component = (mca_allocator_base_component_t *) cli->cli_component; if(strcmp(component->allocator_version.mca_component_name, name) == 0) { diff --git a/ompi/mca/allocator/base/base.h b/ompi/mca/allocator/base/base.h index 9258726526..261ed5dda0 100644 --- a/ompi/mca/allocator/base/base.h +++ b/ompi/mca/allocator/base/base.h @@ -50,12 +50,6 @@ typedef struct mca_allocator_base_selected_module_t mca_allocator_base_selected_ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_allocator_base_selected_module_t); -/* - * Global functions for MCA: overall allocator open and close - */ - -OMPI_DECLSPEC int mca_allocator_base_open(void); -OMPI_DECLSPEC int mca_allocator_base_close(void); OMPI_DECLSPEC mca_allocator_base_component_t* mca_allocator_component_lookup(const char* name); @@ -63,9 +57,9 @@ OMPI_DECLSPEC mca_allocator_base_component_t* mca_allocator_component_lookup(con * Globals */ /** - * The list of all the selected components. + * The allocator framework */ -OMPI_DECLSPEC extern opal_list_t mca_allocator_base_components; +OMPI_DECLSPEC extern mca_base_framework_t ompi_allocator_base_framework; END_C_DECLS diff --git a/ompi/mca/bcol/base/Makefile.am b/ompi/mca/bcol/base/Makefile.am index c4dff7d6e9..929bef0f5b 100644 --- a/ompi/mca/bcol/base/Makefile.am +++ b/ompi/mca/bcol/base/Makefile.am @@ -12,6 +12,5 @@ headers += \ base/base.h libmca_bcol_la_SOURCES += \ - base/bcol_base_close.c \ - base/bcol_base_open.c \ + base/bcol_base_frame.c \ base/bcol_base_init.c diff --git a/ompi/mca/bcol/base/base.h b/ompi/mca/bcol/base/base.h index c6f8d491bb..3ad1d95990 100644 --- a/ompi/mca/bcol/base/base.h +++ b/ompi/mca/bcol/base/base.h @@ -24,15 +24,10 @@ BEGIN_C_DECLS -OMPI_DECLSPEC extern opal_list_t mca_bcol_base_components_opened; OMPI_DECLSPEC extern opal_list_t mca_bcol_base_components_in_use; -OMPI_DECLSPEC extern int mca_bcol_base_output; OMPI_DECLSPEC extern char *ompi_bcol_bcols_string; - -OMPI_DECLSPEC int mca_bcol_base_open(void); - -OMPI_DECLSPEC int mca_bcol_base_close(void); +OMPI_DECLSPEC extern mca_base_framework_t ompi_bcol_base_framework; OMPI_DECLSPEC int mca_bcol_base_init(bool enable_progress_threads, bool enable_mpi_threads); diff --git a/ompi/mca/bcol/base/bcol_base_close.c b/ompi/mca/bcol/base/bcol_base_close.c deleted file mode 100644 index 7f8944b6b2..0000000000 --- a/ompi/mca/bcol/base/bcol_base_close.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved. - * Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "ompi_config.h" - -#include - -#include "ompi/constants.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "ompi/mca/bcol/bcol.h" -#include "ompi/mca/bcol/base/base.h" -#include "ompi/include/ompi/constants.h" - - -int mca_bcol_base_close(void) -{ - /* Close all remaining available modules */ - mca_base_components_close(mca_bcol_base_output, - &mca_bcol_base_components_opened, NULL); - - /* Close the framework output */ - opal_output_close (mca_bcol_base_output); - mca_bcol_base_output = -1; - - /* All done */ - return OMPI_SUCCESS; -} - diff --git a/ompi/mca/bcol/base/bcol_base_open.c b/ompi/mca/bcol/base/bcol_base_frame.c similarity index 89% rename from ompi/mca/bcol/base/bcol_base_open.c rename to ompi/mca/bcol/base/bcol_base_frame.c index e0ebe612ca..72d0ea0f61 100644 --- a/ompi/mca/bcol/base/bcol_base_open.c +++ b/ompi/mca/bcol/base/bcol_base_frame.c @@ -34,13 +34,14 @@ #include "ompi/mca/bcol/base/static-components.h" +static int mca_bcol_base_open(mca_base_open_flag_t flags); +static int mca_bcol_base_register(mca_base_register_flag_t flags); + /* ** * Global variables ** */ -int mca_bcol_base_output = 0; -opal_list_t mca_bcol_base_components_opened; - -static int mca_bcol_base_verbose = 0; +MCA_BASE_FRAMEWORK_DECLARE(ompi, bcol, NULL, mca_bcol_base_register, mca_bcol_base_open, NULL, + mca_bcol_base_static_components, 0); OMPI_DECLSPEC opal_list_t mca_bcol_base_components_in_use; OMPI_DECLSPEC char *ompi_bcol_bcols_string; @@ -202,17 +203,8 @@ static int mca_bcol_base_set_components_to_use(opal_list_t *bcol_components_avai return OMPI_SUCCESS; } -static int mca_bcol_base_register(int flags) +static int mca_bcol_base_register(mca_base_register_flag_t flags) { - /* Debugging/Verbose output */ - (void) mca_base_var_register("ompi", "bcol", "base", "verbose", - "Verbosity level of BCOL framework", - MCA_BASE_VAR_TYPE_INT, NULL, 0, - MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_LOCAL, - &mca_bcol_base_verbose); - /* figure out which bcol and sbgp components will actually be used */ /* get list of sub-grouping functions to use */ ompi_bcol_bcols_string = "basesmuma,basesmuma,iboffload,ptpcoll,ugni"; @@ -230,28 +222,17 @@ static int mca_bcol_base_register(int flags) * Function for finding and opening either all MCA components, or the one * that was specifically requested via a MCA parameter. */ -int mca_bcol_base_open(void) +static int mca_bcol_base_open(mca_base_open_flag_t flags) { int ret; - /*_bcol_base_components_available - * Register some MCA parameters - */ - (void) mca_bcol_base_register(0); - - /* get framework id */ - mca_bcol_base_output = opal_output_open(NULL); - opal_output_set_verbosity(mca_bcol_base_output, mca_bcol_base_verbose); - /* Open up all available components */ if (OMPI_SUCCESS != - mca_base_components_open("bcol", mca_bcol_base_output, mca_bcol_base_static_components, - &mca_bcol_base_components_opened, - true)) { - return OMPI_ERROR; + (ret = mca_base_framework_components_open(&ompi_bcol_base_framework, flags))) { + return ret; } - ret = mca_bcol_base_set_components_to_use(&mca_bcol_base_components_opened, + ret = mca_bcol_base_set_components_to_use(&ompi_bcol_base_framework.framework_components, &mca_bcol_base_components_in_use); /* memory registration compatibilities */ diff --git a/ompi/mca/bcol/basesmuma/bcol_basesmuma_module.c b/ompi/mca/bcol/basesmuma/bcol_basesmuma_module.c index 5374998da3..c1b33e6569 100644 --- a/ompi/mca/bcol/basesmuma/bcol_basesmuma_module.c +++ b/ompi/mca/bcol/basesmuma/bcol_basesmuma_module.c @@ -565,7 +565,7 @@ basesmuma_module_enable(mca_bcol_base_module_t *module, memset(&output_buffer[0],0,sizeof(output_buffer)); snprintf(output_buffer,sizeof(output_buffer),"%s (cid %d)", comm->c_name, comm->c_contextid); - opal_output_verbose(10, mca_bcol_base_output, + opal_output_verbose(10, ompi_bcol_base_framework.framework_output, "bcol:basesmuma:enable: new communicator: %s", output_buffer); /* All done */ diff --git a/ompi/mca/bml/base/Makefile.am b/ompi/mca/bml/base/Makefile.am index 7feb24dc58..b8ba13a85b 100644 --- a/ompi/mca/bml/base/Makefile.am +++ b/ompi/mca/bml/base/Makefile.am @@ -26,6 +26,5 @@ libmca_bml_la_SOURCES += \ base/bml_base_btl.h \ base/bml_base_endpoint.c \ base/bml_base_init.c \ - base/bml_base_close.c \ - base/bml_base_open.c \ + base/bml_base_frame.c \ base/bml_base_ft.c diff --git a/ompi/mca/bml/base/base.h b/ompi/mca/bml/base/base.h index bd65edceee..955c9681dc 100644 --- a/ompi/mca/bml/base/base.h +++ b/ompi/mca/bml/base/base.h @@ -23,6 +23,7 @@ #include "ompi_config.h" #include "opal/mca/mca.h" +#include "opal/mca/base/mca_base_framework.h" #include "ompi/mca/bml/bml.h" @@ -46,10 +47,8 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_bml_base_selected_module_t); * Global functions for MCA: overall BTL open and close */ -OMPI_DECLSPEC int mca_bml_base_open(void); OMPI_DECLSPEC int mca_bml_base_init(bool enable_progress_threads, bool enable_mpi_threads); -OMPI_DECLSPEC int mca_bml_base_close(void); OMPI_DECLSPEC bool mca_bml_base_inited(void); OMPI_DECLSPEC int mca_bml_base_ft_event(int state); @@ -58,11 +57,9 @@ OMPI_DECLSPEC int mca_bml_base_ft_event(int state); /* * Globals */ -extern int mca_bml_base_already_opened; -OMPI_DECLSPEC extern int mca_bml_base_output; OMPI_DECLSPEC extern mca_bml_base_component_t mca_bml_component; -OMPI_DECLSPEC extern opal_list_t mca_bml_base_components_available; OMPI_DECLSPEC extern mca_bml_base_module_t mca_bml; +OMPI_DECLSPEC extern mca_base_framework_t ompi_bml_base_framework; END_C_DECLS #endif /* MCA_BML_BASE_H */ diff --git a/ompi/mca/bml/base/bml_base_close.c b/ompi/mca/bml/base/bml_base_close.c deleted file mode 100644 index e9ebfa0014..0000000000 --- a/ompi/mca/bml/base/bml_base_close.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2007 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2006 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" -#include "ompi/mca/btl/base/base.h" -#include "ompi/mca/bml/base/base.h" - -int mca_bml_base_close( void ) -{ - if (mca_bml_base_already_opened <= 0) { - return OMPI_ERROR; - } else if (--mca_bml_base_already_opened > 0) { - return OMPI_SUCCESS; - } - - return mca_btl_base_close(); -} - diff --git a/ompi/mca/bml/base/bml_base_open.c b/ompi/mca/bml/base/bml_base_frame.c similarity index 81% rename from ompi/mca/bml/base/bml_base_open.c rename to ompi/mca/bml/base/bml_base_frame.c index d8ad9aaf62..79282603df 100644 --- a/ompi/mca/bml/base/bml_base_open.c +++ b/ompi/mca/bml/base/bml_base_frame.c @@ -28,8 +28,13 @@ #include "ompi/mca/bml/base/static-components.h" #include "opal/mca/base/base.h" -int mca_bml_base_already_opened = 0; -opal_list_t mca_bml_base_components_available = {{0}}; +static int mca_bml_base_register(mca_base_register_flag_t flags); +static int mca_bml_base_open(mca_base_open_flag_t flags); +static int mca_bml_base_close(void); + +MCA_BASE_FRAMEWORK_DECLARE(ompi, bml, "BTL Multiplexing Layer", mca_bml_base_register, + mca_bml_base_open, mca_bml_base_close, mca_bml_base_static_components, + 0); #if OPAL_ENABLE_DEBUG_RELIABILITY int mca_bml_base_error_rate_floor; @@ -38,7 +43,7 @@ int mca_bml_base_error_count; static bool mca_bml_base_srand; #endif -int mca_bml_base_register(int flags) +static int mca_bml_base_register(mca_base_register_flag_t flags) { #if OPAL_ENABLE_DEBUG_RELIABILITY do { @@ -77,20 +82,13 @@ int mca_bml_base_register(int flags) return OMPI_SUCCESS; } -int mca_bml_base_open(void) +static int mca_bml_base_open(mca_base_open_flag_t flags) { - /* See if we've already been here */ - if (++mca_bml_base_already_opened > 1) { - return OMPI_SUCCESS; - } - - (void) mca_bml_base_register(0); + int ret; if(OMPI_SUCCESS != - mca_base_components_open("bml", 0, mca_bml_base_static_components, - &mca_bml_base_components_available, - true)) { - return OMPI_ERROR; + (ret = mca_base_framework_components_open(&ompi_bml_base_framework, flags))) { + return ret; } #if OPAL_ENABLE_DEBUG_RELIABILITY @@ -108,6 +106,10 @@ int mca_bml_base_open(void) } #endif - return mca_btl_base_open(); + return mca_base_framework_open(&ompi_btl_base_framework, 0); } +static int mca_bml_base_close( void ) +{ + return mca_base_framework_close(&ompi_btl_base_framework); +} diff --git a/ompi/mca/bml/base/bml_base_init.c b/ompi/mca/bml/base/bml_base_init.c index 2570c418cc..3463fc1741 100644 --- a/ompi/mca/bml/base/bml_base_init.c +++ b/ompi/mca/bml/base/bml_base_init.c @@ -23,8 +23,6 @@ #include "opal/mca/mca.h" #include "opal/runtime/opal.h" -int mca_bml_base_output = -1; - mca_bml_base_module_t mca_bml = { NULL, /* bml_component */ NULL, /* bml_add_procs */ @@ -57,13 +55,13 @@ int mca_bml_base_init( bool enable_progress_threads, init_called = true; - for (item = opal_list_get_first(&mca_bml_base_components_available); - opal_list_get_end(&mca_bml_base_components_available) != item; + for (item = opal_list_get_first(&ompi_bml_base_framework.framework_components); + opal_list_get_end(&ompi_bml_base_framework.framework_components) != item; item = opal_list_get_next(item)) { cli = (mca_base_component_list_item_t*) item; component = (mca_bml_base_component_t*) cli->cli_component; if(NULL == component->bml_init) { - opal_output_verbose( 10, mca_bml_base_output, + opal_output_verbose( 10, ompi_bml_base_framework.framework_output, "select: no init function; ignoring component %s", component->bml_version.mca_component_name ); continue; @@ -85,11 +83,9 @@ int mca_bml_base_init( bool enable_progress_threads, if(NULL == best_module) { return OMPI_SUCCESS; } - else { - mca_bml_component = *best_component; - mca_bml = *best_module; - return mca_base_components_close(mca_bml_base_output, - &mca_bml_base_components_available, - (mca_base_component_t*) best_component); - } + + mca_bml_component = *best_component; + mca_bml = *best_module; + return mca_base_framework_components_close(&ompi_bml_base_framework, + (mca_base_component_t*) best_component); } diff --git a/ompi/mca/bml/r2/bml_r2_ft.c b/ompi/mca/bml/r2/bml_r2_ft.c index 9cde7c36e6..9b9e95ac73 100644 --- a/ompi/mca/bml/r2/bml_r2_ft.c +++ b/ompi/mca/bml/r2/bml_r2_ft.c @@ -144,7 +144,7 @@ int mca_bml_r2_ft_event(int state) opal_output(0, "bml:r2: ft_event(Restart): Failed to finalize BML framework\n"); return ret; } - if( OMPI_SUCCESS != (ret = mca_btl_base_close()) ) { + if( OMPI_SUCCESS != (ret = mca_base_framework_close(&ompi_btl_base_framework)) ) { opal_output(0, "bml:r2: ft_event(Restart): Failed to close BTL framework\n"); return ret; } @@ -168,7 +168,7 @@ int mca_bml_r2_ft_event(int state) /* * Re-open the BTL framework to get the full list of components. */ - if( OMPI_SUCCESS != (ret = mca_btl_base_open()) ) { + if( OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_btl_base_framework, 0)) ) { opal_output(0, "bml:r2: ft_event(Restart): Failed to open BTL framework\n"); return ret; } @@ -222,7 +222,7 @@ int mca_bml_r2_ft_event(int state) opal_output(0, "bml:r2: ft_event(Restart): Failed to finalize BML framework\n"); return ret; } - if( OMPI_SUCCESS != (ret = mca_btl_base_close()) ) { + if( OMPI_SUCCESS != (ret = mca_base_framework_close(&ompi_btl_base_framework)) ) { opal_output(0, "bml:r2: ft_event(Restart): Failed to close BTL framework\n"); return ret; } @@ -253,7 +253,7 @@ int mca_bml_r2_ft_event(int state) opal_output_verbose(11, ompi_cr_output, "Restart (Previous BTL MCA): <%s>\n", btl_list ? btl_list[0] : ""); - if( OMPI_SUCCESS != (ret = mca_btl_base_open()) ) { + if( OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_btl_base_framework, 0)) ) { opal_output(0, "bml:r2: ft_event(Restart): Failed to open BTL framework\n"); return ret; } diff --git a/ompi/mca/btl/base/Makefile.am b/ompi/mca/btl/base/Makefile.am index 278fa72a78..336edb4615 100644 --- a/ompi/mca/btl/base/Makefile.am +++ b/ompi/mca/btl/base/Makefile.am @@ -23,8 +23,7 @@ headers += \ base/btl_base_error.h libmca_btl_la_SOURCES += \ - base/btl_base_close.c \ + base/btl_base_frame.c \ base/btl_base_error.c \ - base/btl_base_open.c \ base/btl_base_select.c \ base/btl_base_mca.c diff --git a/ompi/mca/btl/base/base.h b/ompi/mca/btl/base/base.h index c0c01271a1..fda1f494d5 100644 --- a/ompi/mca/btl/base/base.h +++ b/ompi/mca/btl/base/base.h @@ -54,9 +54,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_btl_base_selected_module_t); * Global functions for MCA: overall BTL open and close */ -OMPI_DECLSPEC int mca_btl_base_open(void); OMPI_DECLSPEC int mca_btl_base_select(bool enable_progress_threads, bool enable_mpi_threads); -OMPI_DECLSPEC int mca_btl_base_close(void); OMPI_DECLSPEC void mca_btl_base_dump( struct mca_btl_base_module_t*, struct mca_btl_base_endpoint_t*, @@ -68,15 +66,15 @@ OMPI_DECLSPEC int mca_btl_base_param_verify(mca_btl_base_module_t *module); /* * Globals */ -OMPI_DECLSPEC extern int mca_btl_base_output; extern char* mca_btl_base_include; extern char* mca_btl_base_exclude; extern int mca_btl_base_warn_component_unused; extern int mca_btl_base_already_opened; -OMPI_DECLSPEC extern opal_list_t mca_btl_base_components_opened; OMPI_DECLSPEC extern opal_list_t mca_btl_base_modules_initialized; OMPI_DECLSPEC extern bool mca_btl_base_thread_multiple_override; +OMPI_DECLSPEC extern mca_base_framework_t ompi_btl_base_framework; + END_C_DECLS #endif /* MCA_BTL_BASE_H */ diff --git a/ompi/mca/btl/base/btl_base_close.c b/ompi/mca/btl/base/btl_base_close.c deleted file mode 100644 index 022fb0568e..0000000000 --- a/ompi/mca/btl/base/btl_base_close.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2007 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include - -#include "ompi/constants.h" -#include "opal/mca/event/event.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "ompi/mca/btl/base/base.h" - -int mca_btl_base_close(void) -{ - opal_list_item_t *item; - mca_btl_base_selected_module_t *sm; - - if( mca_btl_base_already_opened <= 0 ) { - return OMPI_ERROR; - } else if (--mca_btl_base_already_opened > 0) { - return OMPI_SUCCESS; - } -#if 0 - /* disable event processing while cleaning up btls */ - opal_event_disable(); -#endif - /* Finalize all the btl components and free their list items */ - - for (item = opal_list_remove_first(&mca_btl_base_modules_initialized); - NULL != item; - item = opal_list_remove_first(&mca_btl_base_modules_initialized)) { - sm = (mca_btl_base_selected_module_t *) item; - - /* Blatebtly ignore the return code (what would we do to recover, - anyway? This component is going away, so errors don't matter - anymore) */ - - sm->btl_module->btl_finalize(sm->btl_module); - free(sm); - } - - /* Close all remaining opened components (may be one if this is a - OMPI RTE program, or [possibly] multiple if this is ompi_info) */ - - mca_base_components_close(mca_btl_base_output, - &mca_btl_base_components_opened, NULL); - - /* Close the framework output */ - opal_output_close (mca_btl_base_output); - mca_btl_base_output = -1; - - /* cleanup */ - if(NULL != mca_btl_base_include) - free(mca_btl_base_include); - if(NULL != mca_btl_base_exclude) - free(mca_btl_base_exclude); - -#if 0 - /* restore event processing */ - opal_event_enable(); -#endif - /* All done */ - return OMPI_SUCCESS; -} diff --git a/ompi/mca/btl/base/btl_base_open.c b/ompi/mca/btl/base/btl_base_frame.c similarity index 76% rename from ompi/mca/btl/base/btl_base_open.c rename to ompi/mca/btl/base/btl_base_frame.c index 8e13858621..61f8272e61 100644 --- a/ompi/mca/btl/base/btl_base_open.c +++ b/ompi/mca/btl/base/btl_base_frame.c @@ -70,26 +70,14 @@ OBJ_CLASS_INSTANCE( /* * Global variables */ -int mca_btl_base_output = -1; char* mca_btl_base_include = NULL; char* mca_btl_base_exclude = NULL; int mca_btl_base_warn_component_unused = 1; -opal_list_t mca_btl_base_components_opened; opal_list_t mca_btl_base_modules_initialized; -int mca_btl_base_already_opened = 0; bool mca_btl_base_thread_multiple_override = false; -static int mca_btl_base_register(int flags) +static int mca_btl_base_register(mca_base_register_flag_t flags) { - mca_btl_base_verbose = 0; - (void) mca_base_var_register("ompi", "btl", "base", "verbose", - "Verbosity level of the BTL framework", - MCA_BASE_VAR_TYPE_INT, NULL, 0, - MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_LOCAL, - &mca_btl_base_verbose); - /* Override the per-BTL "don't run if THREAD_MULTIPLE selected" embargo? */ mca_btl_base_thread_multiple_override = false; @@ -125,23 +113,15 @@ static int mca_btl_base_register(int flags) * Function for finding and opening either all MCA components, or the one * that was specifically requested via a MCA parameter. */ -int mca_btl_base_open(void) +static int mca_btl_base_open(mca_base_open_flag_t flags) { - int i; - if( ++mca_btl_base_already_opened > 1 ) return OMPI_SUCCESS; - - (void) mca_btl_base_register(0); - - /* Verbose output */ - mca_btl_base_output = opal_output_open(NULL); - opal_output_set_verbosity(mca_btl_base_output, mca_btl_base_verbose); + int ret; /* Open up all available components */ if (OMPI_SUCCESS != - mca_base_components_open("btl", mca_btl_base_output, mca_btl_base_static_components, - &mca_btl_base_components_opened, true)) { - return OMPI_ERROR; + (ret = mca_base_framework_components_open(&ompi_btl_base_framework, flags))) { + return ret; } /* Initialize the list so that in mca_btl_base_close(), we can @@ -153,3 +133,39 @@ int mca_btl_base_open(void) /* All done */ return OMPI_SUCCESS; } + +static int mca_btl_base_close(void) +{ + mca_btl_base_selected_module_t *sm; + +#if 0 + /* disable event processing while cleaning up btls */ + opal_event_disable(); +#endif + /* Finalize all the btl components and free their list items */ + + OPAL_LIST_FOREACH(sm, &mca_btl_base_modules_initialized, mca_btl_base_selected_module_t) { + /* Blatently ignore the return code (what would we do to recover, + anyway? This component is going away, so errors don't matter + anymore) */ + + sm->btl_module->btl_finalize(sm->btl_module); + free(sm); + } + + /* Close all remaining opened components (may be one if this is a + OMPI RTE program, or [possibly] multiple if this is ompi_info) */ + + (void) mca_base_framework_components_close(&ompi_btl_base_framework, NULL); + +#if 0 + /* restore event processing */ + opal_event_enable(); +#endif + /* All done */ + return OMPI_SUCCESS; +} + +MCA_BASE_FRAMEWORK_DECLARE(ompi, btl, "Byte Transport Layer", mca_btl_base_register, + mca_btl_base_open, mca_btl_base_close, mca_btl_base_static_components, + 0); diff --git a/ompi/mca/btl/base/btl_base_select.c b/ompi/mca/btl/base/btl_base_select.c index 76d85ce12d..0070e43a68 100644 --- a/ompi/mca/btl/base/btl_base_select.c +++ b/ompi/mca/btl/base/btl_base_select.c @@ -53,8 +53,7 @@ int mca_btl_base_select(bool enable_progress_threads, bool enable_mpi_threads) { int i, num_btls; - opal_list_item_t *item; - mca_base_component_list_item_t *cli; + mca_base_component_list_item_t *cli, *next; mca_btl_base_component_t *component; mca_btl_base_module_t **modules; mca_btl_base_selected_module_t *sm; @@ -65,11 +64,7 @@ int mca_btl_base_select(bool enable_progress_threads, /* Traverse the list of opened modules; call their init functions. */ - item = opal_list_get_first(&mca_btl_base_components_opened); - while(item != opal_list_get_end(&mca_btl_base_components_opened)) { - opal_list_item_t *next = opal_list_get_next(item); - cli = (mca_base_component_list_item_t *) item; - + OPAL_LIST_FOREACH_SAFE(cli, next, &ompi_btl_base_framework.framework_components, mca_base_component_list_item_t) { component = (mca_btl_base_component_t *) cli->cli_component; /* if there is an include list - item must be in the list to be included */ @@ -84,7 +79,6 @@ int mca_btl_base_select(bool enable_progress_threads, argv++; } if(found == false) { - item = next; continue; } @@ -100,17 +94,16 @@ int mca_btl_base_select(bool enable_progress_threads, argv++; } if(found == true) { - item = next; continue; } } - opal_output_verbose(10, mca_btl_base_output, + opal_output_verbose(10, ompi_btl_base_framework.framework_output, "select: initializing %s component %s", component->btl_version.mca_type_name, component->btl_version.mca_component_name); if (NULL == component->btl_init) { - opal_output_verbose(10, mca_btl_base_output, + opal_output_verbose(10, ompi_btl_base_framework.framework_output, "select: no init function; ignoring component %s", component->btl_version.mca_component_name); } else { @@ -121,21 +114,19 @@ int mca_btl_base_select(bool enable_progress_threads, list and remove it from the component repository */ if (NULL == modules) { - opal_output_verbose(10, mca_btl_base_output, + opal_output_verbose(10, ompi_btl_base_framework.framework_output, "select: init of component %s returned failure", component->btl_version.mca_component_name); - opal_output_verbose(10, mca_btl_base_output, - "select: module %s unloaded", - component->btl_version.mca_component_name); - mca_base_component_repository_release((mca_base_component_t *) component); - opal_list_remove_item(&mca_btl_base_components_opened, item); + opal_list_remove_item(&ompi_btl_base_framework.framework_components, &cli->super); + mca_base_component_close((mca_base_component_t *) component, + ompi_btl_base_framework.framework_output); } /* Otherwise, if it initialized properly, save it. */ else { - opal_output_verbose(10, mca_btl_base_output, + opal_output_verbose(10, ompi_btl_base_framework.framework_output, "select: init of component %s returned success", component->btl_version.mca_component_name); @@ -158,7 +149,6 @@ int mca_btl_base_select(bool enable_progress_threads, free(modules); } } - item = next; } /* Finished querying all components. Check for the bozo case. */ diff --git a/ompi/mca/btl/openib/connect/btl_openib_connect_oob.c b/ompi/mca/btl/openib/connect/btl_openib_connect_oob.c index 123fef25e7..5a1ad47fc0 100644 --- a/ompi/mca/btl/openib/connect/btl_openib_connect_oob.c +++ b/ompi/mca/btl/openib/connect/btl_openib_connect_oob.c @@ -129,7 +129,7 @@ static int oob_component_query(mca_btl_openib_module_t *btl, therefore we must be IB. */ #if defined(HAVE_STRUCT_IBV_DEVICE_TRANSPORT_TYPE) && defined(HAVE_IBV_LINK_LAYER_ETHERNET) if (BTL_OPENIB_CONNECT_BASE_CHECK_IF_NOT_IB(btl)) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: oob CPC only supported on InfiniBand; skipped on %s:%d", ibv_get_device_name(btl->device->ib_dev), btl->port_num); @@ -138,7 +138,7 @@ static int oob_component_query(mca_btl_openib_module_t *btl, #endif if (mca_btl_openib_component.num_xrc_qps > 0) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: oob CPC not supported with XRC receive queues, please try xoob CPC; skipped on %s:%d", ibv_get_device_name(btl->device->ib_dev), btl->port_num); @@ -154,7 +154,7 @@ static int oob_component_query(mca_btl_openib_module_t *btl, rml_recv_cb, NULL); if (OMPI_SUCCESS != rc) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: oob CPC system error %d (%s)", rc, opal_strerror(rc)); return rc; @@ -166,7 +166,7 @@ static int oob_component_query(mca_btl_openib_module_t *btl, if (NULL == *cpc) { ompi_rte_recv_cancel(OMPI_NAME_WILDCARD, OMPI_RML_TAG_OPENIB); rml_recv_posted = false; - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: oob CPC system error (malloc failed)"); return OMPI_ERR_OUT_OF_RESOURCE; } @@ -188,7 +188,7 @@ static int oob_component_query(mca_btl_openib_module_t *btl, (*cpc)->cbm_finalize = NULL; (*cpc)->cbm_uses_cts = false; - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: oob CPC available for use on %s:%d", ibv_get_device_name(btl->device->ib_dev), btl->port_num); diff --git a/ompi/mca/btl/openib/connect/btl_openib_connect_rdmacm.c b/ompi/mca/btl/openib/connect/btl_openib_connect_rdmacm.c index 8b60344000..b3c22ffcb4 100644 --- a/ompi/mca/btl/openib/connect/btl_openib_connect_rdmacm.c +++ b/ompi/mca/btl/openib/connect/btl_openib_connect_rdmacm.c @@ -1858,7 +1858,7 @@ static int rdmacm_component_query(mca_btl_openib_module_t *openib_btl, ompi_btl_ context = OBJ_NEW(id_context_t); OPAL_OUTPUT((-1, "MAIN Server context: %p", (void*) context)); if (NULL == context) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: rdmacm CPC system error (malloc failed)"); rc = OMPI_ERR_OUT_OF_RESOURCE; goto out3; @@ -1870,7 +1870,7 @@ static int rdmacm_component_query(mca_btl_openib_module_t *openib_btl, ompi_btl_ rc = rdma_create_id(event_channel, &(context->id), context, RDMA_PS_TCP); if (0 != rc) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: rdmacm CPC failed to create ID"); rc = OMPI_ERR_OUT_OF_RESOURCE; goto out4; @@ -1886,7 +1886,7 @@ static int rdmacm_component_query(mca_btl_openib_module_t *openib_btl, ompi_btl_ */ rc = rdma_bind_addr(context->id, (struct sockaddr *)&sin); if (0 != rc) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: rdmacm CPC unable to bind to address"); rc = OMPI_ERR_UNREACH; goto out5; @@ -1896,7 +1896,7 @@ static int rdmacm_component_query(mca_btl_openib_module_t *openib_btl, ompi_btl_ cannot use the cpc */ rc = ipaddrcheck(context, openib_btl); if (OMPI_SUCCESS != rc) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: rdmacm IP address not found on port"); rc = OMPI_ERR_NOT_SUPPORTED; goto out5; @@ -1908,7 +1908,7 @@ static int rdmacm_component_query(mca_btl_openib_module_t *openib_btl, ompi_btl_ mca_btl_openib_component.num_qps) */ rc = rdma_listen(context->id, 1024); if (0 != rc) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: rdmacm CPC unable to listen"); rc = OMPI_ERR_UNREACH; goto out5; @@ -1916,7 +1916,7 @@ static int rdmacm_component_query(mca_btl_openib_module_t *openib_btl, ompi_btl_ rc = create_message(server, openib_btl, &(*cpc)->data); if (0 != rc) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: rdmacm CPC unable to create message"); rc = OMPI_ERR_OUT_OF_RESOURCE; goto out5; @@ -1924,7 +1924,7 @@ static int rdmacm_component_query(mca_btl_openib_module_t *openib_btl, ompi_btl_ opal_list_append(&server_listener_list, &(server->super)); - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: rdmacm CPC available for use on %s:%d", ibv_get_device_name(openib_btl->device->ib_dev), openib_btl->port_num); @@ -1945,12 +1945,12 @@ out1: free(*cpc); out: if (OMPI_ERR_NOT_SUPPORTED == rc) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: rdmacm CPC unavailable for use on %s:%d; skipped", ibv_get_device_name(openib_btl->device->ib_dev), openib_btl->port_num); } else { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: rmacm CPC unavailable for use on %s:%d; fatal error %d (%s)", ibv_get_device_name(openib_btl->device->ib_dev), openib_btl->port_num, rc, @@ -2036,14 +2036,14 @@ static int rdmacm_component_init(void) rc = mca_btl_openib_build_rdma_addr_list(); if (OMPI_SUCCESS != rc) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: rdmacm CPC unable to find any valid IP address"); return OMPI_ERR_NOT_SUPPORTED; } event_channel = rdma_create_event_channel(); if (NULL == event_channel) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: rdmacm CPC failed to create channel"); return OMPI_ERR_UNREACH; } diff --git a/ompi/mca/btl/openib/connect/btl_openib_connect_xoob.c b/ompi/mca/btl/openib/connect/btl_openib_connect_xoob.c index 49116af5b0..70e9060186 100644 --- a/ompi/mca/btl/openib/connect/btl_openib_connect_xoob.c +++ b/ompi/mca/btl/openib/connect/btl_openib_connect_xoob.c @@ -1006,7 +1006,7 @@ static int xoob_component_query(mca_btl_openib_module_t *openib_btl, int rc; if (mca_btl_openib_component.num_xrc_qps <= 0) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: xoob CPC only supported with XRC receive queues; skipped on %s:%d", ibv_get_device_name(openib_btl->device->ib_dev), openib_btl->port_num); @@ -1015,7 +1015,7 @@ static int xoob_component_query(mca_btl_openib_module_t *openib_btl, *cpc = malloc(sizeof(ompi_btl_openib_connect_base_module_t)); if (NULL == *cpc) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: xoob CPC system error (malloc failed)"); return OMPI_ERR_OUT_OF_RESOURCE; } @@ -1030,7 +1030,7 @@ static int xoob_component_query(mca_btl_openib_module_t *openib_btl, xoob_rml_recv_cb, NULL); if (OMPI_SUCCESS != rc) { - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: xoob CPC system error %d (%s)", rc, opal_strerror(rc)); return rc; @@ -1055,7 +1055,7 @@ static int xoob_component_query(mca_btl_openib_module_t *openib_btl, (*cpc)->cbm_finalize = NULL; (*cpc)->cbm_uses_cts = false; - opal_output_verbose(5, mca_btl_base_output, + opal_output_verbose(5, ompi_btl_base_framework.framework_output, "openib BTL: xoob CPC available for use on %s:%d", ibv_get_device_name(openib_btl->device->ib_dev), openib_btl->port_num); diff --git a/ompi/mca/btl/tcp/btl_tcp_component.c b/ompi/mca/btl/tcp/btl_tcp_component.c index ebacd2d3bc..3b5467c110 100644 --- a/ompi/mca/btl/tcp/btl_tcp_component.c +++ b/ompi/mca/btl/tcp/btl_tcp_component.c @@ -544,7 +544,7 @@ static char **split_and_resolve(char **orig_str, char *name) free(tmp); continue; } - opal_output_verbose(20, mca_btl_base_output, + opal_output_verbose(20, ompi_btl_base_framework.framework_output, "btl: tcp: Searching for %s address+prefix: %s / %u", name, opal_net_get_hostname((struct sockaddr*) &argv_inaddr), @@ -575,7 +575,7 @@ static char **split_and_resolve(char **orig_str, char *name) /* We found a match; get the name and replace it in the argv */ opal_ifindextoname(if_index, if_name, sizeof(if_name)); - opal_output_verbose(20, mca_btl_base_output, + opal_output_verbose(20, ompi_btl_base_framework.framework_output, "btl: tcp: Found match: %s (%s)", opal_net_get_hostname((struct sockaddr*) &if_inaddr), if_name); diff --git a/ompi/mca/btl/tcp/btl_tcp_endpoint.c b/ompi/mca/btl/tcp/btl_tcp_endpoint.c index bcd10441f7..5b2f38a12e 100644 --- a/ompi/mca/btl/tcp/btl_tcp_endpoint.c +++ b/ompi/mca/btl/tcp/btl_tcp_endpoint.c @@ -605,7 +605,7 @@ static int mca_btl_tcp_endpoint_start_connect(mca_btl_base_endpoint_t* btl_endpo /* start the connect - will likely fail with EINPROGRESS */ mca_btl_tcp_proc_tosocks(btl_endpoint->endpoint_addr, &endpoint_addr); - opal_output_verbose(20, mca_btl_base_output, + opal_output_verbose(20, ompi_btl_base_framework.framework_output, "btl: tcp: attempting to connect() to %s address %s on port %d", OMPI_NAME_PRINT(&btl_endpoint->endpoint_proc->proc_ompi->proc_name), opal_net_get_hostname((struct sockaddr*) &endpoint_addr), diff --git a/ompi/mca/coll/base/Makefile.am b/ompi/mca/coll/base/Makefile.am index f9ec68c432..0f1b82f77b 100644 --- a/ompi/mca/coll/base/Makefile.am +++ b/ompi/mca/coll/base/Makefile.am @@ -23,8 +23,7 @@ headers += \ base/coll_tags.h libmca_coll_la_SOURCES += \ - base/coll_base_close.c \ base/coll_base_comm_select.c \ base/coll_base_comm_unselect.c \ base/coll_base_find_available.c \ - base/coll_base_open.c + base/coll_base_frame.c diff --git a/ompi/mca/coll/base/base.h b/ompi/mca/coll/base/base.h index 33e762c617..1c9a95c180 100644 --- a/ompi/mca/coll/base/base.h +++ b/ompi/mca/coll/base/base.h @@ -35,34 +35,13 @@ #include "mpi.h" #include "opal/class/opal_list.h" - +#include "opal/mca/base/base.h" /* * Global functions for MCA overall collective open and close */ BEGIN_C_DECLS -/** - * Initialize the coll MCA framework - * - * @retval OMPI_SUCCESS Upon success - * @retval OMPI_ERROR Upon failure - * - * This must be the first function invoked in the coll MCA - * framework. It initializes the coll MCA framework, finds and - * opens coll components, etc. - * - * This function is invoked during ompi_mpi_init() and during the - * initialization of the special case of the laminfo command. - * - * This function fills in the internal global variable - * mca_coll_base_components_opened, which is a list of all coll components - * that were successfully opened. This variable should \em only be - * used by other coll base functions -- it is not considered a - * public interface member -- and is only mentioned here for - * completeness. - */ -OMPI_DECLSPEC int mca_coll_base_open(void); /** * Create list of available coll components. @@ -79,15 +58,10 @@ OMPI_DECLSPEC int mca_coll_base_open(void); * successfully opened coll components and create a list of all * available coll components. * - * This function traverses the (internal global variable) - * mca_coll_base_components_opened list and queries each component to see - * if it ever might want to run during this MPI process. It creates - * another internal global variable list named - * mca_coll_base_components_available, consisting of a list of components - * that are available for selection when communicators are created. - * This variable should \em only be used by other coll base - * functions -- it is not considered a public interface member -- - * and is only mentioned here for completeness. + * This function traverses the (internal global variable) framework components + * list and queries each component to see if it ever might want to run during + * this MPI process. If a component does not want to run it is closed and + * removed from the framework components list. */ int mca_coll_base_find_available(bool enable_progress_threads, bool enable_mpi_threads); @@ -147,55 +121,10 @@ int mca_coll_base_comm_select(struct ompi_communicator_t *comm); */ int mca_coll_base_comm_unselect(struct ompi_communicator_t *comm); -/** - * Shut down the coll MCA framework. - * - * @retval OMPI_SUCCESS Always - * - * This function shuts down everything in the coll MCA framework, - * and is called during ompi_mpi_finalize() and the special case of - * the laminfo command. - * - * It must be the last function invoked on the coll MCA framework. - */ -OMPI_DECLSPEC int mca_coll_base_close(void); - - /* * Globals */ - -/** - * Coll framework debugging stream ID used with opal_output() and - * opal_output_verbose(). - */ -OMPI_DECLSPEC extern int mca_coll_base_output; - -/** - * Indicator as to whether the list of opened coll components is valid or - * not. - */ -extern bool mca_coll_base_components_opened_valid; - -/** - * List of all opened components; created when the coll framework is - * initialized and destroyed when we reduce the list to all available - * coll components. - */ -OMPI_DECLSPEC extern opal_list_t mca_coll_base_components_opened; - -/** - * Indicator as to whether the list of available coll components is valid - * or not. - */ -extern bool mca_coll_base_components_available_valid; - -/** - * List of all available components; created by reducing the list of open - * components to all those who indicate that they may run during this - * process. - */ -extern opal_list_t mca_coll_base_components_available; +OMPI_DECLSPEC extern mca_base_framework_t ompi_coll_base_framework; END_C_DECLS #endif /* MCA_BASE_COLL_H */ diff --git a/ompi/mca/coll/base/coll_base_close.c b/ompi/mca/coll/base/coll_base_close.c deleted file mode 100644 index 403d9c9600..0000000000 --- a/ompi/mca/coll/base/coll_base_close.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include - -#include "ompi/constants.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "ompi/mca/coll/base/base.h" -#include "opal/util/output.h" - -int mca_coll_base_close(void) -{ - /* Close all components that are still open. This may be the opened - * list (if we're in ompi_info), or it may be the available list (if - * we're anywhere else). */ - - if (mca_coll_base_components_opened_valid) { - mca_base_components_close(mca_coll_base_output, - &mca_coll_base_components_opened, NULL); - OBJ_DESTRUCT(&mca_coll_base_components_opened); - mca_coll_base_components_opened_valid = false; - } else if (mca_coll_base_components_available_valid) { - mca_base_components_close(mca_coll_base_output, - &mca_coll_base_components_available, - NULL); - OBJ_DESTRUCT(&mca_coll_base_components_available); - mca_coll_base_components_available_valid = false; - } - - /* Close the framework output */ - opal_output_close (mca_coll_base_output); - mca_coll_base_output = -1; - - /* All done */ - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/coll/base/coll_base_comm_select.c b/ompi/mca/coll/base/coll_base_comm_select.c index f99ba7f8f8..e277ecfec0 100644 --- a/ompi/mca/coll/base/coll_base_comm_select.c +++ b/ompi/mca/coll/base/coll_base_comm_select.c @@ -101,7 +101,7 @@ int mca_coll_base_comm_select(ompi_communicator_t * comm) int ret; /* Announce */ - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:base:comm_select: new communicator: %s (cid %d)", comm->c_name, comm->c_contextid); @@ -109,9 +109,9 @@ int mca_coll_base_comm_select(ompi_communicator_t * comm) * sentinel values */ memset(&comm->c_coll, 0, sizeof(mca_coll_base_comm_coll_t)); - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:base:comm_select: Checking all available modules"); - selectable = check_components(&mca_coll_base_components_available, comm); + selectable = check_components(&ompi_coll_base_framework.framework_components, comm); /* Upon return from the above, the modules list will contain the list of modules that returned (priority >= 0). If we have no @@ -225,6 +225,19 @@ int mca_coll_base_comm_select(ompi_communicator_t * comm) return OMPI_SUCCESS; } +static int avail_coll_compare (opal_list_item_t **a, + opal_list_item_t **b) { + avail_coll_t *acoll = (avail_coll_t *) *a; + avail_coll_t *bcoll = (avail_coll_t *) *b; + + if (acoll->ac_priority > bcoll->ac_priority) { + return 1; + } else if (acoll->ac_priority < bcoll->ac_priority) { + return -1; + } + + return 0; +} /* * For each module in the list, check and see if it wants to run, and @@ -237,53 +250,29 @@ static opal_list_t *check_components(opal_list_t * components, { int priority; const mca_base_component_t *component; - opal_list_item_t *item, *item2; + mca_base_component_list_item_t *cli; mca_coll_base_module_2_0_0_t *module; opal_list_t *selectable; - avail_coll_t *avail, *avail2; + avail_coll_t *avail; /* Make a list of the components that query successfully */ selectable = OBJ_NEW(opal_list_t); - /* Scan through the list of components. This nested loop is - O(N^2), but we should never have too many components, so this - *hopefully* shouldn't matter... */ - - for (item = opal_list_get_first(components); - item != opal_list_get_end(components); - item = opal_list_get_next(item)) { - component = ((mca_base_component_priority_list_item_t *) - item)->super.cli_component; + /* Scan through the list of components */ + OPAL_LIST_FOREACH(cli, &ompi_coll_base_framework.framework_components, mca_base_component_list_item_t) { + component = cli->cli_component; priority = check_one_component(comm, component, &module); if (priority >= 0) { - /* We have a component that indicated that it wants to run by giving us a module */ avail = OBJ_NEW(avail_coll_t); avail->ac_priority = priority; avail->ac_module = module; - /* Put this item on the list in priority order (lowest - priority first). Should it go first? */ - for (item2 = opal_list_get_first(selectable); - item2 != opal_list_get_end(selectable); - item2 = opal_list_get_next(item2)) { - avail2 = (avail_coll_t *) item2; - if (avail->ac_priority < avail2->ac_priority) { - opal_list_insert_pos(selectable, - item2, - (opal_list_item_t *) avail); - break; - } - } - - if (opal_list_get_end(selectable) == item2) { - opal_list_append(selectable, - (opal_list_item_t *) avail); - } + opal_list_append(selectable, &avail->super); } - } + } /* If we didn't find any available components, return an error */ if (0 == opal_list_get_size(selectable)) { @@ -291,6 +280,9 @@ static opal_list_t *check_components(opal_list_t * components, return NULL; } + /* Put this list in priority order */ + opal_list_sort(selectable, avail_coll_compare); + /* All done */ return selectable; } @@ -310,13 +302,13 @@ static int check_one_component(ompi_communicator_t * comm, if (OMPI_SUCCESS == err) { priority = (priority < 100) ? priority : 100; - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:base:comm_select: component available: %s, priority: %d", component->mca_component_name, priority); } else { priority = -1; - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:base:comm_select: component not available: %s", component->mca_component_name); } diff --git a/ompi/mca/coll/base/coll_base_find_available.c b/ompi/mca/coll/base/coll_base_find_available.c index c1574c3e9c..052bd38d56 100644 --- a/ompi/mca/coll/base/coll_base_find_available.c +++ b/ompi/mca/coll/base/coll_base_find_available.c @@ -38,24 +38,14 @@ #include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/base/base.h" - -/* - * Global variables - */ -bool mca_coll_base_components_available_valid = false; -opal_list_t mca_coll_base_components_available; - - /* * Private functions */ static int init_query(const mca_base_component_t * ls, - mca_base_component_priority_list_item_t * entry, bool enable_progress_threads, bool enable_mpi_threads); static int init_query_2_0_0(const mca_base_component_t * ls, - mca_base_component_priority_list_item_t * - entry, bool enable_progress_threads, + bool enable_progress_threads, bool enable_mpi_threads); /* @@ -74,65 +64,33 @@ static int init_query_2_0_0(const mca_base_component_t * ls, int mca_coll_base_find_available(bool enable_progress_threads, bool enable_mpi_threads) { - bool found = false; - mca_base_component_priority_list_item_t *entry; - opal_list_item_t *p; + mca_base_component_list_item_t *cli, *next; const mca_base_component_t *component; - /* Initialize the list */ - - OBJ_CONSTRUCT(&mca_coll_base_components_available, opal_list_t); - mca_coll_base_components_available_valid = true; - /* The list of components that we should check has already been established in mca_coll_base_open. */ - for (found = false, - p = opal_list_remove_first(&mca_coll_base_components_opened); - p != NULL; - p = opal_list_remove_first(&mca_coll_base_components_opened)) { - component = ((mca_base_component_list_item_t *) p)->cli_component; + OPAL_LIST_FOREACH_SAFE(cli, next, &ompi_coll_base_framework.framework_components, mca_base_component_list_item_t) { + component = cli->cli_component; /* Call a subroutine to do the work, because the component may represent different versions of the coll MCA. */ - entry = OBJ_NEW(mca_base_component_priority_list_item_t); - entry->super.cli_component = component; - entry->cpli_priority = 0; - if (OMPI_SUCCESS == init_query(component, entry, - enable_progress_threads, + if (OMPI_SUCCESS != init_query(component, enable_progress_threads, enable_mpi_threads)) { - opal_list_append(&mca_coll_base_components_available, - (opal_list_item_t *) entry); - found = true; - } else { - /* If the component doesn't want to run, then close it. - It's already had its close() method invoked; now close - it out of the DSO repository (if it's there). */ - - mca_base_component_repository_release(component); - OBJ_RELEASE(entry); + Now close it out and release it from the DSO repository (if it's there). */ + opal_list_remove_item(&ompi_coll_base_framework.framework_components, &cli->super); + mca_base_component_close(component, ompi_coll_base_framework.framework_output); + OBJ_RELEASE(cli); } - - /* Free the entry from the "opened" list */ - - OBJ_RELEASE(p); } - /* The opened list is now no longer useful and we can free it */ - - OBJ_DESTRUCT(&mca_coll_base_components_opened); - mca_coll_base_components_opened_valid = false; - /* If we have no collective components available, it's an error. Thanks for playing! */ - if (!found) { - /* Need to free all items in the list */ - OBJ_DESTRUCT(&mca_coll_base_components_available); - mca_coll_base_components_available_valid = false; - opal_output_verbose(10, mca_coll_base_output, + if (opal_list_get_size(&ompi_coll_base_framework.framework_components) == 0) { + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:find_available: no coll components available!"); opal_show_help("help-mca-base", "find-available:none-found", true, "coll"); @@ -150,12 +108,11 @@ int mca_coll_base_find_available(bool enable_progress_threads, * some information. If it doesn't, close it. */ static int init_query(const mca_base_component_t * component, - mca_base_component_priority_list_item_t * entry, bool enable_progress_threads, bool enable_mpi_threads) { int ret; - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:find_available: querying coll component %s", component->mca_component_name); @@ -165,12 +122,12 @@ static int init_query(const mca_base_component_t * component, if (2 == component->mca_type_major_version && 0 == component->mca_type_minor_version && 0 == component->mca_type_release_version) { - ret = init_query_2_0_0(component, entry, enable_progress_threads, + ret = init_query_2_0_0(component, enable_progress_threads, enable_mpi_threads); } else { /* Unrecognized coll API version */ - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:find_available: unrecognized coll API version (%d.%d.%d, ignored)", component->mca_type_major_version, component->mca_type_minor_version, @@ -181,14 +138,11 @@ static int init_query(const mca_base_component_t * component, /* Query done -- look at the return value to see what happened */ if (OMPI_SUCCESS != ret) { - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:find_available: coll component %s is not available", component->mca_component_name); - if (NULL != component->mca_close_component) { - component->mca_close_component(); - } } else { - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:find_available: coll component %s is available", component->mca_component_name); } @@ -203,7 +157,6 @@ static int init_query(const mca_base_component_t * component, * Query a specific component, coll v2.0.0 */ static int init_query_2_0_0(const mca_base_component_t * component, - mca_base_component_priority_list_item_t * entry, bool enable_progress_threads, bool enable_mpi_threads) { diff --git a/ompi/mca/coll/base/coll_base_open.c b/ompi/mca/coll/base/coll_base_frame.c similarity index 73% rename from ompi/mca/coll/base/coll_base_open.c rename to ompi/mca/coll/base/coll_base_frame.c index bd9fd41287..4fe21bf33e 100644 --- a/ompi/mca/coll/base/coll_base_open.c +++ b/ompi/mca/coll/base/coll_base_frame.c @@ -36,19 +36,6 @@ */ #include "ompi/mca/coll/base/static-components.h" - -/* - * Global variables; most of which are loaded by back-ends of MCA - * variables - */ -int mca_coll_base_output = -1; - -int mca_coll_base_crossover = 4; -int mca_coll_base_associative = 1; - -bool mca_coll_base_components_opened_valid = false; -opal_list_t mca_coll_base_components_opened; - /* * Ensure all function pointers are NULL'ed out to start with */ @@ -102,27 +89,5 @@ static void coll_base_module_construct(mca_coll_base_module_t *m) OBJ_CLASS_INSTANCE(mca_coll_base_module_t, opal_object_t, coll_base_module_construct, NULL); -/* - * Function for finding and opening either all MCA components, or the one - * that was specifically requested via a MCA parameter. - */ -int mca_coll_base_open(void) -{ - /* Open an output stream for this framework */ - - mca_coll_base_output = opal_output_open(NULL); - - /* Open up all available components */ - - if (OMPI_SUCCESS != - mca_base_components_open("coll", mca_coll_base_output, - mca_coll_base_static_components, - &mca_coll_base_components_opened, true)) { - return OMPI_ERROR; - } - mca_coll_base_components_opened_valid = true; - - /* All done */ - - return OMPI_SUCCESS; -} +MCA_BASE_FRAMEWORK_DECLARE(ompi, coll, "Collectives", NULL, NULL, NULL, + mca_coll_base_static_components, 0); diff --git a/ompi/mca/coll/demo/coll_demo_allgather.c b/ompi/mca/coll/demo/coll_demo_allgather.c index f6322f3ccd..dddd757fe4 100644 --- a/ompi/mca/coll/demo/coll_demo_allgather.c +++ b/ompi/mca/coll/demo/coll_demo_allgather.c @@ -40,7 +40,7 @@ int mca_coll_demo_allgather_intra(void *sbuf, int scount, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo allgather_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo allgather_intra"); return demo_module->underlying.coll_allgather(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm, demo_module->underlying.coll_allgather_module); @@ -62,7 +62,7 @@ int mca_coll_demo_allgather_inter(void *sbuf, int scount, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo allgather_inter"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo allgather_inter"); return demo_module->underlying.coll_allgather(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm, demo_module->underlying.coll_allgather_module); diff --git a/ompi/mca/coll/demo/coll_demo_allgatherv.c b/ompi/mca/coll/demo/coll_demo_allgatherv.c index 3acaf33534..d0449868f0 100644 --- a/ompi/mca/coll/demo/coll_demo_allgatherv.c +++ b/ompi/mca/coll/demo/coll_demo_allgatherv.c @@ -41,7 +41,7 @@ int mca_coll_demo_allgatherv_intra(void *sbuf, int scount, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo allgatherv_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo allgatherv_intra"); return demo_module->underlying.coll_allgatherv(sbuf, scount, sdtype, rbuf, rcounts, disps, rdtype, comm, @@ -64,7 +64,7 @@ int mca_coll_demo_allgatherv_inter(void *sbuf, int scount, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo allgatherv_inter"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo allgatherv_inter"); return demo_module->underlying.coll_allgatherv(sbuf, scount, sdtype, rbuf, rcounts, disps, rdtype, comm, diff --git a/ompi/mca/coll/demo/coll_demo_allreduce.c b/ompi/mca/coll/demo/coll_demo_allreduce.c index 8e85412d7f..1d57ce7ec5 100644 --- a/ompi/mca/coll/demo/coll_demo_allreduce.c +++ b/ompi/mca/coll/demo/coll_demo_allreduce.c @@ -40,7 +40,7 @@ int mca_coll_demo_allreduce_intra(void *sbuf, void *rbuf, int count, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo allreduce_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo allreduce_intra"); return demo_module->underlying.coll_allreduce(sbuf, rbuf, count, dtype, op, comm, demo_module->underlying.coll_allreduce_module); @@ -61,7 +61,7 @@ int mca_coll_demo_allreduce_inter(void *sbuf, void *rbuf, int count, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo allreduce_inter"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo allreduce_inter"); return demo_module->underlying.coll_allreduce(sbuf, rbuf, count, dtype, op, comm, demo_module->underlying.coll_allreduce_module); diff --git a/ompi/mca/coll/demo/coll_demo_alltoall.c b/ompi/mca/coll/demo/coll_demo_alltoall.c index 5901514da5..4de3d8c2d2 100644 --- a/ompi/mca/coll/demo/coll_demo_alltoall.c +++ b/ompi/mca/coll/demo/coll_demo_alltoall.c @@ -41,7 +41,7 @@ int mca_coll_demo_alltoall_intra(void *sbuf, int scount, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo alltoall_intra\n"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo alltoall_intra\n"); return demo_module->underlying.coll_alltoall(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm, @@ -64,7 +64,7 @@ int mca_coll_demo_alltoall_inter(void *sbuf, int scount, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo alltoall_inter\n"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo alltoall_inter\n"); return demo_module->underlying.coll_alltoall(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm, diff --git a/ompi/mca/coll/demo/coll_demo_alltoallv.c b/ompi/mca/coll/demo/coll_demo_alltoallv.c index 696c5b6a97..a1d4b06c17 100644 --- a/ompi/mca/coll/demo/coll_demo_alltoallv.c +++ b/ompi/mca/coll/demo/coll_demo_alltoallv.c @@ -42,7 +42,7 @@ mca_coll_demo_alltoallv_intra(void *sbuf, int *scounts, int *sdisps, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo alltoallv_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo alltoallv_intra"); return demo_module->underlying.coll_alltoallv(sbuf, scounts, sdisps, sdtype, rbuf, rcounts, rdisps, rdtype, comm, @@ -66,7 +66,7 @@ mca_coll_demo_alltoallv_inter(void *sbuf, int *scounts, int *sdisps, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo alltoallv_inter"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo alltoallv_inter"); return demo_module->underlying.coll_alltoallv(sbuf, scounts, sdisps, sdtype, rbuf, rcounts, rdisps, rdtype, comm, diff --git a/ompi/mca/coll/demo/coll_demo_alltoallw.c b/ompi/mca/coll/demo/coll_demo_alltoallw.c index 6359adbac6..80c279c8ee 100644 --- a/ompi/mca/coll/demo/coll_demo_alltoallw.c +++ b/ompi/mca/coll/demo/coll_demo_alltoallw.c @@ -41,7 +41,7 @@ int mca_coll_demo_alltoallw_intra(void *sbuf, int *scounts, int *sdisps, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo alltoallw_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo alltoallw_intra"); return demo_module->underlying.coll_alltoallw(sbuf, scounts, sdisps, sdtypes, rbuf, rcounts, rdisps, rdtypes, comm, @@ -64,7 +64,7 @@ int mca_coll_demo_alltoallw_inter(void *sbuf, int *scounts, int *sdisps, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo alltoallw_inter"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo alltoallw_inter"); return demo_module->underlying.coll_alltoallw(sbuf, scounts, sdisps, sdtypes, rbuf, rcounts, rdisps, rdtypes, comm, diff --git a/ompi/mca/coll/demo/coll_demo_barrier.c b/ompi/mca/coll/demo/coll_demo_barrier.c index 37c5ba742e..e0f2ba5a6f 100644 --- a/ompi/mca/coll/demo/coll_demo_barrier.c +++ b/ompi/mca/coll/demo/coll_demo_barrier.c @@ -37,7 +37,7 @@ int mca_coll_demo_barrier_intra(struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo barrier_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo barrier_intra"); return demo_module->underlying.coll_barrier(comm, demo_module->underlying.coll_barrier_module); } @@ -54,7 +54,7 @@ int mca_coll_demo_barrier_inter(struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo barrier_inter"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo barrier_inter"); return demo_module->underlying.coll_barrier(comm, demo_module->underlying.coll_barrier_module); } diff --git a/ompi/mca/coll/demo/coll_demo_bcast.c b/ompi/mca/coll/demo/coll_demo_bcast.c index dfae8b6405..4bdcee6673 100644 --- a/ompi/mca/coll/demo/coll_demo_bcast.c +++ b/ompi/mca/coll/demo/coll_demo_bcast.c @@ -39,7 +39,7 @@ int mca_coll_demo_bcast_intra(void *buff, int count, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo bcast_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo bcast_intra"); return demo_module->underlying.coll_bcast(buff, count, datatype, root, comm, demo_module->underlying.coll_bcast_module); @@ -59,7 +59,7 @@ int mca_coll_demo_bcast_inter(void *buff, int count, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo bcast_inter"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo bcast_inter"); return demo_module->underlying.coll_bcast(buff, count, datatype, root, comm, demo_module->underlying.coll_bcast_module); diff --git a/ompi/mca/coll/demo/coll_demo_exscan.c b/ompi/mca/coll/demo/coll_demo_exscan.c index 3f0633e3ff..616936ba26 100644 --- a/ompi/mca/coll/demo/coll_demo_exscan.c +++ b/ompi/mca/coll/demo/coll_demo_exscan.c @@ -40,7 +40,7 @@ int mca_coll_demo_exscan_intra(void *sbuf, void *rbuf, int count, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo exscan_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo exscan_intra"); return demo_module->underlying.coll_exscan(sbuf, rbuf, count, dtype, op, comm, demo_module->underlying.coll_exscan_module); diff --git a/ompi/mca/coll/demo/coll_demo_gather.c b/ompi/mca/coll/demo/coll_demo_gather.c index 7c79c72f77..9f5ab09cd0 100644 --- a/ompi/mca/coll/demo/coll_demo_gather.c +++ b/ompi/mca/coll/demo/coll_demo_gather.c @@ -40,7 +40,7 @@ int mca_coll_demo_gather_intra(void *sbuf, int scount, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo gather_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo gather_intra"); return demo_module->underlying.coll_gather(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm, @@ -63,7 +63,7 @@ int mca_coll_demo_gather_inter(void *sbuf, int scount, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo gather_inter"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo gather_inter"); return demo_module->underlying.coll_gather(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm, diff --git a/ompi/mca/coll/demo/coll_demo_gatherv.c b/ompi/mca/coll/demo/coll_demo_gatherv.c index 24de228bc7..70d704698b 100644 --- a/ompi/mca/coll/demo/coll_demo_gatherv.c +++ b/ompi/mca/coll/demo/coll_demo_gatherv.c @@ -41,7 +41,7 @@ int mca_coll_demo_gatherv_intra(void *sbuf, int scount, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo gatherv_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo gatherv_intra"); return demo_module->underlying.coll_gatherv(sbuf, scount, sdtype, rbuf, rcounts, disps, rdtype, root, comm, @@ -64,7 +64,7 @@ int mca_coll_demo_gatherv_inter(void *sbuf, int scount, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo gatherv_inter"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo gatherv_inter"); return demo_module->underlying.coll_gatherv(sbuf, scount, sdtype, rbuf, rcounts, disps, rdtype, root, comm, diff --git a/ompi/mca/coll/demo/coll_demo_reduce.c b/ompi/mca/coll/demo/coll_demo_reduce.c index e4fb83021e..38579e347e 100644 --- a/ompi/mca/coll/demo/coll_demo_reduce.c +++ b/ompi/mca/coll/demo/coll_demo_reduce.c @@ -40,7 +40,7 @@ int mca_coll_demo_reduce_intra(void *sbuf, void *rbuf, int count, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo reduce_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo reduce_intra"); return demo_module->underlying.coll_reduce(sbuf, rbuf, count, dtype, op, root, comm, demo_module->underlying.coll_reduce_module); @@ -61,7 +61,7 @@ int mca_coll_demo_reduce_inter(void *sbuf, void *rbuf, int count, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo reduce_inter"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo reduce_inter"); return demo_module->underlying.coll_reduce(sbuf, rbuf, count, dtype, op, root, comm, demo_module->underlying.coll_reduce_module); diff --git a/ompi/mca/coll/demo/coll_demo_reduce_scatter.c b/ompi/mca/coll/demo/coll_demo_reduce_scatter.c index 205ae51133..e4be2d1921 100644 --- a/ompi/mca/coll/demo/coll_demo_reduce_scatter.c +++ b/ompi/mca/coll/demo/coll_demo_reduce_scatter.c @@ -40,7 +40,7 @@ int mca_coll_demo_reduce_scatter_intra(void *sbuf, void *rbuf, int *rcounts, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo scatter_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo scatter_intra"); return demo_module->underlying.coll_reduce_scatter(sbuf, rbuf, rcounts, dtype, op, comm, demo_module->underlying.coll_reduce_scatter_module); @@ -61,7 +61,7 @@ int mca_coll_demo_reduce_scatter_inter(void *sbuf, void *rbuf, int *rcounts, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo scatter_inter"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo scatter_inter"); return demo_module->underlying.coll_reduce_scatter(sbuf, rbuf, rcounts, dtype, op, comm, demo_module->underlying.coll_reduce_scatter_module); diff --git a/ompi/mca/coll/demo/coll_demo_scan.c b/ompi/mca/coll/demo/coll_demo_scan.c index 5bbd61e44e..ece1093162 100644 --- a/ompi/mca/coll/demo/coll_demo_scan.c +++ b/ompi/mca/coll/demo/coll_demo_scan.c @@ -40,7 +40,7 @@ int mca_coll_demo_scan_intra(void *sbuf, void *rbuf, int count, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo scan_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo scan_intra"); return demo_module->underlying.coll_scan(sbuf, rbuf, count, dtype, op, comm, demo_module->underlying.coll_scan_module); diff --git a/ompi/mca/coll/demo/coll_demo_scatter.c b/ompi/mca/coll/demo/coll_demo_scatter.c index d74909fcf1..f6a6c48d39 100644 --- a/ompi/mca/coll/demo/coll_demo_scatter.c +++ b/ompi/mca/coll/demo/coll_demo_scatter.c @@ -42,7 +42,7 @@ int mca_coll_demo_scatter_intra(void *sbuf, int scount, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo scatter_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo scatter_intra"); return demo_module->underlying.coll_scatter(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm, @@ -66,7 +66,7 @@ int mca_coll_demo_scatter_inter(void *sbuf, int scount, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo scatter_inter"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo scatter_inter"); return demo_module->underlying.coll_scatter(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm, diff --git a/ompi/mca/coll/demo/coll_demo_scatterv.c b/ompi/mca/coll/demo/coll_demo_scatterv.c index ca3661bb55..267cd20992 100644 --- a/ompi/mca/coll/demo/coll_demo_scatterv.c +++ b/ompi/mca/coll/demo/coll_demo_scatterv.c @@ -41,7 +41,7 @@ int mca_coll_demo_scatterv_intra(void *sbuf, int *scounts, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo scatterv_intra"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo scatterv_intra"); return demo_module->underlying.coll_scatterv(sbuf, scounts, disps, sdtype, rbuf, rcount, rdtype, root, comm, @@ -64,7 +64,7 @@ int mca_coll_demo_scatterv_inter(void *sbuf, int *scounts, mca_coll_base_module_t *module) { mca_coll_demo_module_t *demo_module = (mca_coll_demo_module_t*) module; - opal_output_verbose(10, mca_coll_base_output, "In demo scatterv_inter"); + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "In demo scatterv_inter"); return demo_module->underlying.coll_scatterv(sbuf, scounts, disps, sdtype, rbuf, rcount, rdtype, root, comm, diff --git a/ompi/mca/coll/ml/coll_ml_component.c b/ompi/mca/coll/ml/coll_ml_component.c index 29a422d190..c38517d305 100644 --- a/ompi/mca/coll/ml/coll_ml_component.c +++ b/ompi/mca/coll/ml/coll_ml_component.c @@ -401,11 +401,11 @@ static int ml_open(void) /* Init memory structures (no real memory is allocated) */ OBJ_CONSTRUCT(&cs->memory_manager, mca_coll_ml_lmngr_t); - if (OMPI_SUCCESS != (rc = mca_sbgp_base_open())) { + if (OMPI_SUCCESS != (rc = mca_base_framework_open(&ompi_sbgp_base_framework, 0))) { fprintf(stderr," failure in open mca_sbgp_base_open \n"); return rc; } - if (OMPI_SUCCESS != (rc = mca_bcol_base_open())) { + if (OMPI_SUCCESS != (rc = mca_base_framework_open(&ompi_bcol_base_framework, 0))) { fprintf(stderr," failure in open mca_bcol_base_open \n"); return rc; } diff --git a/ompi/mca/coll/sm/coll_sm_module.c b/ompi/mca/coll/sm/coll_sm_module.c index 27b910a195..ed8ad93da2 100644 --- a/ompi/mca/coll/sm/coll_sm_module.c +++ b/ompi/mca/coll/sm/coll_sm_module.c @@ -132,7 +132,7 @@ int mca_coll_sm_init_query(bool enable_progress_threads, } /* Don't do much here because we don't really want to allocate any shared memory until this component is selected to be used. */ - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:init_query: pick me! pick me!"); return OMPI_SUCCESS; } @@ -153,7 +153,7 @@ mca_coll_sm_comm_query(struct ompi_communicator_t *comm, int *priority) are not on this node, then we don't want to run */ if (OMPI_COMM_IS_INTER(comm) || 1 == ompi_comm_size(comm) || !have_local_peers(comm->c_local_group, ompi_comm_size(comm))) { - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:comm_query (%d/%s): intercomm, comm is too small, or not all peers local; disqualifying myself", comm->c_contextid, comm->c_name); return NULL; } @@ -162,7 +162,7 @@ mca_coll_sm_comm_query(struct ompi_communicator_t *comm, int *priority) * than or equal to 0, then the module is unavailable. */ *priority = mca_coll_sm_component.sm_priority; if (mca_coll_sm_component.sm_priority <= 0) { - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:comm_query (%d/%s): priority too low; disqualifying myself", comm->c_contextid, comm->c_name); return NULL; } @@ -192,7 +192,7 @@ mca_coll_sm_comm_query(struct ompi_communicator_t *comm, int *priority) sm_module->super.coll_scatter = NULL; sm_module->super.coll_scatterv = NULL; - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:comm_query (%d/%s): pick me! pick me!", comm->c_contextid, comm->c_name); return &(sm_module->super); @@ -207,7 +207,7 @@ static int sm_module_enable(mca_coll_base_module_t *module, { if (NULL == comm->c_coll.coll_reduce || NULL == comm->c_coll.coll_reduce_module) { - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:enable (%d/%s): no underlying reduce; disqualifying myself", comm->c_contextid, comm->c_name); return OMPI_ERROR; @@ -247,7 +247,7 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module, malloc(sizeof(opal_hwloc_base_memory_segment_t) * c->sm_comm_num_segments * 3); if (NULL == maffinity) { - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:enable (%d/%s): malloc failed (1)", comm->c_contextid, comm->c_name); return OMPI_ERR_OUT_OF_RESOURCE; @@ -277,7 +277,7 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module, #if OPAL_HAVE_HWLOC free(maffinity); #endif - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:enable (%d/%s): malloc failed (2)", comm->c_contextid, comm->c_name); return OMPI_ERR_TEMP_OUT_OF_RESOURCE; @@ -461,7 +461,7 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module, opal_atomic_add(&(data->sm_bootstrap_meta->module_seg->seg_inited), 1); /* Wait for everyone in this communicator to attach and setup */ - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:enable (%d/%s): waiting for peers to attach", comm->c_contextid, comm->c_name); SPIN_CONDITION(size == data->sm_bootstrap_meta->module_seg->seg_inited, seg_init_exit); @@ -469,7 +469,7 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module, /* Once we're all here, remove the mmap file; it's not needed anymore */ if (0 == rank) { unlink(data->sm_bootstrap_meta->shmem_ds.seg_name); - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:enable (%d/%s): removed mmap file %s", comm->c_contextid, comm->c_name, data->sm_bootstrap_meta->shmem_ds.seg_name); @@ -477,7 +477,7 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module, /* All done */ - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:enable (%d/%s): success!", comm->c_contextid, comm->c_name); return OMPI_SUCCESS; @@ -533,7 +533,7 @@ static int bootstrap_comm(ompi_communicator_t *comm, asprintf(&shortpath, "coll-sm-cid-%d-name-%s.mmap", comm->c_contextid, OMPI_NAME_PRINT(lowest_name)); if (NULL == shortpath) { - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:enable:bootstrap comm (%d/%s): asprintf failed", comm->c_contextid, comm->c_name); return OMPI_ERR_OUT_OF_RESOURCE; @@ -542,7 +542,7 @@ static int bootstrap_comm(ompi_communicator_t *comm, shortpath, NULL); free(shortpath); if (NULL == fullpath) { - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:enable:bootstrap comm (%d/%s): opal_os_path failed", comm->c_contextid, comm->c_name); return OMPI_ERR_OUT_OF_RESOURCE; @@ -573,7 +573,7 @@ static int bootstrap_comm(ompi_communicator_t *comm, (num_in_use * control_size) + (num_segments * (comm_size * control_size * 2)) + (num_segments * (comm_size * frag_size)); - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:enable:bootstrap comm (%d/%s): attaching to %" PRIsize_t " byte mmap: %s", comm->c_contextid, comm->c_name, size, fullpath); data->sm_bootstrap_meta = @@ -581,7 +581,7 @@ static int bootstrap_comm(ompi_communicator_t *comm, sizeof(mca_common_sm_seg_header_t), sizeof(void*)); if (NULL == data->sm_bootstrap_meta) { - opal_output_verbose(10, mca_coll_base_output, + opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:enable:bootstrap comm (%d/%s): mca_common_sm_init_group failed", comm->c_contextid, comm->c_name); return OMPI_ERR_OUT_OF_RESOURCE; diff --git a/ompi/mca/crcp/base/Makefile.am b/ompi/mca/crcp/base/Makefile.am index 5dadf4552a..54dd200aa9 100644 --- a/ompi/mca/crcp/base/Makefile.am +++ b/ompi/mca/crcp/base/Makefile.am @@ -22,8 +22,7 @@ headers += \ base/base.h libmca_crcp_la_SOURCES += \ - base/crcp_base_open.c \ - base/crcp_base_close.c \ + base/crcp_base_frame.c \ base/crcp_base_select.c \ base/crcp_base_fns.c diff --git a/ompi/mca/crcp/base/base.h b/ompi/mca/crcp/base/base.h index 19cb659c9c..3372c00219 100644 --- a/ompi/mca/crcp/base/base.h +++ b/ompi/mca/crcp/base/base.h @@ -20,6 +20,7 @@ #include "ompi_config.h" +#include "opal/mca/base/base.h" #include "ompi/constants.h" #include "ompi/mca/crcp/crcp.h" @@ -30,16 +31,6 @@ BEGIN_C_DECLS - /** - * Initialize the CRCP MCA framework - * - * @retval OMPI_SUCCESS Upon success - * @retval OMPI_ERROR Upon failures - * - * This function is invoked during ompi_init(); - */ - OMPI_DECLSPEC int ompi_crcp_base_open(void); - /** * Select an available component. * @@ -50,16 +41,6 @@ BEGIN_C_DECLS */ OMPI_DECLSPEC int ompi_crcp_base_select(void); - /** - * Finalize the CRCP MCA framework - * - * @retval OMPI_SUCCESS Upon success - * @retval OMPI_ERROR Upon failures - * - * This function is invoked during ompi_finalize(); - */ - OMPI_DECLSPEC int ompi_crcp_base_close(void); - /** * Quiesce Interface (For MPI Ext.) */ @@ -208,10 +189,7 @@ BEGIN_C_DECLS ompi_crcp_base_none_btl_ft_event(int state, ompi_crcp_base_btl_state_t*); - /* Utility Functions */ - - OMPI_DECLSPEC extern int ompi_crcp_base_output; - OMPI_DECLSPEC extern opal_list_t ompi_crcp_base_components_available; + OMPI_DECLSPEC extern mca_base_framework_t ompi_crcp_base_framework; OMPI_DECLSPEC extern ompi_crcp_base_component_t ompi_crcp_base_selected_component; OMPI_DECLSPEC extern ompi_crcp_base_module_t ompi_crcp; diff --git a/ompi/mca/crcp/base/crcp_base_close.c b/ompi/mca/crcp/base/crcp_base_frame.c similarity index 62% rename from ompi/mca/crcp/base/crcp_base_close.c rename to ompi/mca/crcp/base/crcp_base_frame.c index c1f0961bc9..73671f29e7 100644 --- a/ompi/mca/crcp/base/crcp_base_close.c +++ b/ompi/mca/crcp/base/crcp_base_frame.c @@ -17,12 +17,25 @@ #include "ompi_config.h" #include "opal/mca/mca.h" +#include "opal/util/output.h" #include "opal/mca/base/base.h" #include "ompi/mca/crcp/crcp.h" #include "ompi/mca/crcp/base/base.h" -int ompi_crcp_base_close(void) +#include "ompi/mca/crcp/base/static-components.h" + +/* + * Globals + */ +OMPI_DECLSPEC ompi_crcp_base_module_t ompi_crcp = { + NULL, /* crcp_init */ + NULL /* crcp_finalize */ +}; + +ompi_crcp_base_component_t ompi_crcp_base_selected_component; + +static int ompi_crcp_base_close(void) { /* Close the selected component */ if( NULL != ompi_crcp.crcp_finalize ) { @@ -30,13 +43,8 @@ int ompi_crcp_base_close(void) } /* Close all available modules that are open */ - mca_base_components_close(ompi_crcp_base_output, - &ompi_crcp_base_components_available, - NULL); - - /* Close the framework output */ - opal_output_close (ompi_crcp_base_output); - ompi_crcp_base_output = -1; - - return OMPI_SUCCESS; + return mca_base_framework_components_close(&ompi_crcp_base_framework, NULL); } + +MCA_BASE_FRAMEWORK_DECLARE(ompi, crcp, NULL, NULL, NULL, ompi_crcp_base_close, + mca_crcp_base_static_components, 0); diff --git a/ompi/mca/crcp/base/crcp_base_open.c b/ompi/mca/crcp/base/crcp_base_open.c deleted file mode 100644 index 715b6fa178..0000000000 --- a/ompi/mca/crcp/base/crcp_base_open.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2004-2007 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2004-2005 The Trustees of the University of Tennessee. - * All rights reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include "opal/mca/mca.h" -#include "opal/util/output.h" -#include "opal/mca/base/base.h" - -#include "ompi/mca/crcp/crcp.h" -#include "ompi/mca/crcp/base/base.h" - -#include "ompi/mca/crcp/base/static-components.h" - -/* - * Globals - */ -OMPI_DECLSPEC int ompi_crcp_base_output = -1; -OMPI_DECLSPEC ompi_crcp_base_module_t ompi_crcp = { - NULL, /* crcp_init */ - NULL /* crcp_finalize */ -}; -opal_list_t ompi_crcp_base_components_available; -ompi_crcp_base_component_t ompi_crcp_base_selected_component; - -/** - * Function for finding and opening either all MCA components, - * or the one that was specifically requested via a MCA parameter. - */ -int ompi_crcp_base_open(void) -{ - ompi_crcp_base_output = opal_output_open(NULL); - - /* - * Which CRCP component to open - * - NULL or "" = auto-select - * - "none" = Empty component - * - ow. select that specific component - * Note: Set the default to NULL here so ompi_info will work correctly, - * The 'real' default is set in base_select.c - */ - - /* Open up all available components */ - if (OPAL_SUCCESS != - mca_base_components_open("crcp", - ompi_crcp_base_output, - mca_crcp_base_static_components, - &ompi_crcp_base_components_available, - true)) { - return OMPI_ERROR; - } - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/crcp/base/crcp_base_select.c b/ompi/mca/crcp/base/crcp_base_select.c index ceb3a0d051..3129962304 100644 --- a/ompi/mca/crcp/base/crcp_base_select.c +++ b/ompi/mca/crcp/base/crcp_base_select.c @@ -141,7 +141,7 @@ int ompi_crcp_base_select(void) } if(0 == strncmp(include_list, "none", strlen("none")) ){ - opal_output_verbose(10, ompi_crcp_base_output, + opal_output_verbose(10, ompi_crcp_base_framework.framework_output, "crcp:select: Using %s component", include_list); best_component = &none_component; @@ -149,7 +149,7 @@ int ompi_crcp_base_select(void) /* JJH: Todo: Check if none is in the list */ /* Close all components since none will be used */ mca_base_components_close(0, /* Pass 0 to keep this from closing the output handle */ - &ompi_crcp_base_components_available, + &ompi_crcp_base_framework.framework_components, NULL); goto skip_select; } @@ -157,8 +157,8 @@ int ompi_crcp_base_select(void) /* * Select the best component */ - if( OPAL_SUCCESS != mca_base_select("crcp", ompi_crcp_base_output, - &ompi_crcp_base_components_available, + if( OPAL_SUCCESS != mca_base_select("crcp", ompi_crcp_base_framework.framework_output, + &ompi_crcp_base_framework.framework_components, (mca_base_module_t **) &best_module, (mca_base_component_t **) &best_component) ) { /* This will only happen if no component was selected */ diff --git a/ompi/mca/crcp/bkmrk/crcp_bkmrk_component.c b/ompi/mca/crcp/bkmrk/crcp_bkmrk_component.c index 133101efda..2c75858ad9 100644 --- a/ompi/mca/crcp/bkmrk/crcp_bkmrk_component.c +++ b/ompi/mca/crcp/bkmrk/crcp_bkmrk_component.c @@ -120,7 +120,7 @@ static int crcp_bkmrk_open(void) opal_output_set_verbosity(mca_crcp_bkmrk_component.super.output_handle, mca_crcp_bkmrk_component.super.verbose); } else { - mca_crcp_bkmrk_component.super.output_handle = ompi_crcp_base_output; + mca_crcp_bkmrk_component.super.output_handle = ompi_crcp_base_framework.framework_output; } /* diff --git a/ompi/mca/dpm/base/Makefile.am b/ompi/mca/dpm/base/Makefile.am index 194b00bd03..76f53441b3 100644 --- a/ompi/mca/dpm/base/Makefile.am +++ b/ompi/mca/dpm/base/Makefile.am @@ -22,8 +22,7 @@ headers += \ base/base.h libmca_dpm_la_SOURCES += \ - base/dpm_base_open.c \ - base/dpm_base_close.c \ + base/dpm_base_frame.c \ base/dpm_base_select.c \ base/dpm_base_null_fns.c \ base/dpm_base_common_fns.c diff --git a/ompi/mca/dpm/base/base.h b/ompi/mca/dpm/base/base.h index c482eeb099..46de9da28f 100644 --- a/ompi/mca/dpm/base/base.h +++ b/ompi/mca/dpm/base/base.h @@ -37,16 +37,6 @@ struct ompi_dpm_base_disconnect_obj { }; typedef struct ompi_dpm_base_disconnect_obj ompi_dpm_base_disconnect_obj; -/** - * Initialize the DPM MCA framework - * - * @retval OMPI_SUCCESS Upon success - * @retval OMPI_ERROR Upon failures - * - * This function is invoked during ompi_init(); - */ -OMPI_DECLSPEC int ompi_dpm_base_open(void); - /** * Select an available component. * @@ -57,16 +47,6 @@ OMPI_DECLSPEC int ompi_dpm_base_open(void); */ OMPI_DECLSPEC int ompi_dpm_base_select(void); -/** - * Finalize the DPM MCA framework - * - * @retval OMPI_SUCCESS Upon success - * @retval OMPI_ERROR Upon failures - * - * This function is invoked during ompi_finalize(); - */ -OMPI_DECLSPEC int ompi_dpm_base_close(void); - /* Internal support functions */ OMPI_DECLSPEC char* ompi_dpm_base_dyn_init (void); OMPI_DECLSPEC int ompi_dpm_base_dyn_finalize (void); @@ -94,11 +74,11 @@ int ompi_dpm_base_null_route_to_port(char *rml_uri, ompi_process_name_t *rproc); int ompi_dpm_base_null_close_port(char *port_name); /* useful globals */ -OMPI_DECLSPEC extern int ompi_dpm_base_output; -OMPI_DECLSPEC extern opal_list_t ompi_dpm_base_components_available; OMPI_DECLSPEC extern ompi_dpm_base_component_t ompi_dpm_base_selected_component; OMPI_DECLSPEC extern ompi_dpm_base_module_t ompi_dpm; +OMPI_DECLSPEC extern mca_base_framework_t ompi_dpm_base_framework; + END_C_DECLS #endif /* OMPI_MCA_DPM_BASE_H */ diff --git a/ompi/mca/dpm/base/dpm_base_close.c b/ompi/mca/dpm/base/dpm_base_close.c deleted file mode 100644 index 88e117bf81..0000000000 --- a/ompi/mca/dpm/base/dpm_base_close.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2004-2007 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2004-2005 The Trustees of the University of Tennessee. - * All rights reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" - -#include "ompi/mca/dpm/dpm.h" -#include "ompi/mca/dpm/base/base.h" - -int ompi_dpm_base_close(void) -{ - /* Close the selected component */ - if( NULL != ompi_dpm.finalize ) { - ompi_dpm.finalize(); - } - - /* Close all available modules that are open */ - mca_base_components_close(ompi_dpm_base_output, - &ompi_dpm_base_components_available, - NULL); - - /* Close the framework output */ - opal_output_close (ompi_dpm_base_output); - ompi_dpm_base_output = -1; - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/dpm/base/dpm_base_open.c b/ompi/mca/dpm/base/dpm_base_frame.c similarity index 64% rename from ompi/mca/dpm/base/dpm_base_open.c rename to ompi/mca/dpm/base/dpm_base_frame.c index 9e0096678f..1ca15aa355 100644 --- a/ompi/mca/dpm/base/dpm_base_open.c +++ b/ompi/mca/dpm/base/dpm_base_frame.c @@ -28,7 +28,6 @@ /* * Globals */ -OMPI_DECLSPEC int ompi_dpm_base_output = -1; OMPI_DECLSPEC ompi_dpm_base_module_t ompi_dpm = { NULL, ompi_dpm_base_null_connect_accept, @@ -43,27 +42,18 @@ OMPI_DECLSPEC ompi_dpm_base_module_t ompi_dpm = { ompi_dpm_base_null_close_port, NULL }; -opal_list_t ompi_dpm_base_components_available; ompi_dpm_base_component_t ompi_dpm_base_selected_component; -/** - * Function for finding and opening either all MCA components, - * or the one that was specifically requested via a MCA parameter. - */ -int ompi_dpm_base_open(void) +static int ompi_dpm_base_close(void) { - /* Debugging/Verbose output */ - ompi_dpm_base_output = opal_output_open(NULL); - - /* Open up all available components */ - if (OPAL_SUCCESS != - mca_base_components_open("dpm", - ompi_dpm_base_output, - mca_dpm_base_static_components, - &ompi_dpm_base_components_available, - true)) { - return OMPI_ERROR; + /* Close the selected component */ + if( NULL != ompi_dpm.finalize ) { + ompi_dpm.finalize(); } - - return OMPI_SUCCESS; + + /* Close all available modules that are open */ + return mca_base_framework_components_close(&ompi_dpm_base_framework, NULL); } + +MCA_BASE_FRAMEWORK_DECLARE(ompi, dpm, NULL, NULL, NULL, ompi_dpm_base_close, + mca_dpm_base_static_components, 0); diff --git a/ompi/mca/dpm/base/dpm_base_select.c b/ompi/mca/dpm/base/dpm_base_select.c index b56022d608..285e452931 100644 --- a/ompi/mca/dpm/base/dpm_base_select.c +++ b/ompi/mca/dpm/base/dpm_base_select.c @@ -36,8 +36,8 @@ int ompi_dpm_base_select(void) /* * Select the best component */ - if( OPAL_SUCCESS != (ret = mca_base_select("dpm", ompi_dpm_base_output, - &ompi_dpm_base_components_available, + if( OPAL_SUCCESS != (ret = mca_base_select("dpm", ompi_dpm_base_framework.framework_output, + &ompi_dpm_base_framework.framework_components, (mca_base_module_t **) &best_module, (mca_base_component_t **) &best_component))) { /* it is okay not to find any executable components */ diff --git a/ompi/mca/dpm/orte/dpm_orte.c b/ompi/mca/dpm/orte/dpm_orte.c index c9b2919513..a54a98cb2c 100644 --- a/ompi/mca/dpm/orte/dpm_orte.c +++ b/ompi/mca/dpm/orte/dpm_orte.c @@ -148,7 +148,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, opal_list_item_t *item; orte_namelist_t *nm; - OPAL_OUTPUT_VERBOSE((1, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((1, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept with port %s %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), port_string, send_first ? "sending first" : "recv first")); @@ -275,7 +275,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, goto exit; } - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept adding %s to proc list", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(&proc_list[i]->proc_name))); @@ -308,13 +308,13 @@ static int connect_accept ( ompi_communicator_t *comm, int root, /* Exchange the number and the list of processes in the groups */ if ( send_first ) { - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept sending first to %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(&port))); rc = orte_rml.send_buffer(&port, nbuf, tag, 0); /* setup to recv */ - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept waiting for response", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); waiting_for_recv = true; @@ -322,13 +322,13 @@ static int connect_accept ( ompi_communicator_t *comm, int root, ORTE_RML_NON_PERSISTENT, recv_cb, NULL); /* wait for response */ ORTE_WAIT_FOR_COMPLETION(waiting_for_recv); - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept got data from %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(&carport))); } else { - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept recving first", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); /* setup to recv */ @@ -338,7 +338,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, /* wait for response */ ORTE_WAIT_FOR_COMPLETION(waiting_for_recv); /* now send our info */ - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept sending info to %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(&carport))); @@ -359,7 +359,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, rnamebuflen_int = (int)rnamebuflen; /* bcast the buffer-length to all processes in the local comm */ - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept bcast buffer length", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); rc = comm->c_coll.coll_bcast (&rnamebuflen_int, 1, MPI_INT, root, comm, @@ -383,7 +383,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, adds processes, which were not known yet to our process pool. */ - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept bcast proc list", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); rc = comm->c_coll.coll_bcast (rnamebuf, rnamebuflen_int, MPI_BYTE, root, comm, @@ -419,7 +419,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, goto exit; } - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept unpacked %d new procs", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), new_proc_len)); @@ -445,7 +445,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, name = OBJ_NEW(orte_namelist_t); name->name = rprocs[i]->proc_name; opal_list_append(&all_procs, &name->super); - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept send first adding %s to allgather list", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(&name->name))); @@ -454,7 +454,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, name = OBJ_NEW(orte_namelist_t); name->name = ompi_group_peer_lookup(group, i)->proc_name; opal_list_append(&all_procs, &name->super); - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept send first adding %s to allgather list", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(&name->name))); @@ -465,7 +465,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, name = OBJ_NEW(orte_namelist_t); name->name = ompi_group_peer_lookup(group, i)->proc_name; opal_list_append(&all_procs, &name->super); - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept recv first adding %s to allgather list", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(&name->name))); @@ -474,7 +474,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, name = OBJ_NEW(orte_namelist_t); name->name = rprocs[i]->proc_name; opal_list_append(&all_procs, &name->super); - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept recv first adding %s to allgather list", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(&name->name))); @@ -482,7 +482,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, } - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept executing modex", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); @@ -509,7 +509,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, } OBJ_DESTRUCT(&modex); - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept modex complete", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); @@ -520,7 +520,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, OBJ_DESTRUCT(&all_procs); */ - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept adding procs", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); @@ -529,7 +529,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, goto exit; } - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept new procs added", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); } @@ -539,7 +539,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, OBJ_RELEASE(nbuf); } - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept allocating group size %d", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), rsize)); @@ -557,7 +557,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, /* increment proc reference counters */ ompi_group_increment_proc_count(new_group_pointer); - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept setting up communicator", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); @@ -583,7 +583,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, OBJ_RELEASE(new_group_pointer); new_group_pointer = MPI_GROUP_NULL; - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept allocate comm_cid", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); @@ -599,7 +599,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, goto exit; } - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept activate comm", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); @@ -639,7 +639,7 @@ static int connect_accept ( ompi_communicator_t *comm, int root, } *newcomm = newcomp; - OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((3, ompi_dpm_base_framework.framework_output, "%s dpm:orte:connect_accept complete", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); @@ -1557,7 +1557,7 @@ static int dyn_init(void) return OMPI_SUCCESS; } - OPAL_OUTPUT_VERBOSE((1, ompi_dpm_base_output, + OPAL_OUTPUT_VERBOSE((1, ompi_dpm_base_framework.framework_output, "%s dpm:orte:dyn_init with port %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), port_name)); diff --git a/ompi/mca/fbtl/base/Makefile.am b/ompi/mca/fbtl/base/Makefile.am index 6481743bfd..0d539aec08 100644 --- a/ompi/mca/fbtl/base/Makefile.am +++ b/ompi/mca/fbtl/base/Makefile.am @@ -21,8 +21,7 @@ headers += \ base/base.h libmca_fbtl_la_SOURCES += \ - base/fbtl_base_close.c \ + base/fbtl_base_frame.c \ base/fbtl_base_file_select.c \ base/fbtl_base_file_unselect.c \ - base/fbtl_base_find_available.c \ - base/fbtl_base_open.c + base/fbtl_base_find_available.c diff --git a/ompi/mca/fbtl/base/base.h b/ompi/mca/fbtl/base/base.h index 1d3028d9a3..1fb4f3c3db 100644 --- a/ompi/mca/fbtl/base/base.h +++ b/ompi/mca/fbtl/base/base.h @@ -30,17 +30,12 @@ #include "ompi_config.h" #include "mpi.h" -#include "opal/class/opal_list.h" #include "ompi/mca/fbtl/fbtl.h" -#include "opal/mca/mca.h" +#include "opal/mca/base/base.h" BEGIN_C_DECLS -OMPI_DECLSPEC int mca_fbtl_base_open(void); - -OMPI_DECLSPEC int mca_fbtl_base_close(void); - OMPI_DECLSPEC int mca_fbtl_base_file_select(struct mca_io_ompio_file_t *file, mca_base_component_t *preferred); @@ -56,14 +51,7 @@ OMPI_DECLSPEC int mca_fbtl_base_get_param (struct mca_io_ompio_file_t *file, int * Globals */ -OMPI_DECLSPEC extern int mca_fbtl_base_param; -OMPI_DECLSPEC extern int mca_fbtl_base_output; - -OMPI_DECLSPEC extern bool mca_fbtl_base_components_opened_valid; -OMPI_DECLSPEC extern bool mca_fbtl_base_components_available_valid; - -OMPI_DECLSPEC extern opal_list_t mca_fbtl_base_components_opened; -OMPI_DECLSPEC extern opal_list_t mca_fbtl_base_components_available; +OMPI_DECLSPEC extern mca_base_framework_t ompi_fbtl_base_framework; END_C_DECLS diff --git a/ompi/mca/fbtl/base/fbtl_base_close.c b/ompi/mca/fbtl/base/fbtl_base_close.c deleted file mode 100644 index 5f6c328fd7..0000000000 --- a/ompi/mca/fbtl/base/fbtl_base_close.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. - * $COPYRIGHTOB$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include - -#include "ompi/constants.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "ompi/mca/fbtl/fbtl.h" -#include "ompi/mca/fbtl/base/base.h" - -int mca_fbtl_base_close(void) -{ - /* - Close all components that are still open. This may be the opened - list (if we're in ompi_info), or it may be the available list (if - we're anywhere else). - */ - - if (mca_fbtl_base_components_opened_valid) { - mca_base_components_close(mca_fbtl_base_output, - &mca_fbtl_base_components_opened, NULL); - OBJ_DESTRUCT(&mca_fbtl_base_components_opened); - mca_fbtl_base_components_opened_valid = false; - } else if (mca_fbtl_base_components_available_valid) { - mca_base_components_close(mca_fbtl_base_output, - &mca_fbtl_base_components_available, NULL); - OBJ_DESTRUCT(&mca_fbtl_base_components_available); - mca_fbtl_base_components_available_valid = false; - } - - /* Close the framework output */ - opal_output_close (mca_fbtl_base_output); - mca_fbtl_base_output = -1; - - /* All done */ - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/fbtl/base/fbtl_base_file_select.c b/ompi/mca/fbtl/base/fbtl_base_file_select.c index 90d8717bc6..5ee56e4880 100644 --- a/ompi/mca/fbtl/base/fbtl_base_file_select.c +++ b/ompi/mca/fbtl/base/fbtl_base_file_select.c @@ -68,22 +68,14 @@ int mca_fbtl_base_file_select (struct mca_io_ompio_file_t *file, int priority; int best_priority; opal_list_item_t *item; - opal_list_item_t *next_item; - mca_base_component_priority_list_item_t *selectable_item; - char **name_array; - int num_names; - mca_base_component_priority_list_item_t *cpli; + mca_base_component_list_item_t *cli; mca_fbtl_base_component_t *component; mca_fbtl_base_component_t *best_component; mca_fbtl_base_module_t *module; opal_list_t queried; queried_module_t *om; - opal_list_t *selectable; char *str; int err = MPI_SUCCESS; - int i; - bool was_selectable_constructed = false; - const char **names_value, *names; /* Check and see if a preferred component was provided. If it was provided then it should be used (if possible) */ @@ -95,7 +87,7 @@ int mca_fbtl_base_file_select (struct mca_io_ompio_file_t *file, str = &(preferred->mca_component_name[0]); - opal_output_verbose(10, mca_fbtl_base_output, + opal_output_verbose(10, ompi_fbtl_base_framework.framework_output, "fbtl:base:file_select: Checking preferred component: %s", str); @@ -136,83 +128,13 @@ int mca_fbtl_base_file_select (struct mca_io_ompio_file_t *file, * use that for this file */ - /* Check if anything was requested by means on the name parameters */ - names_value = NULL; - mca_base_var_get_value(mca_fbtl_base_param, &names_value, NULL, NULL); - names = names_value ? names_value[0] : NULL; - - if (NULL != names && 0 < strlen(names)) { - name_array = opal_argv_split (names, ','); - num_names = opal_argv_count (name_array); - - opal_output_verbose(10, mca_fbtl_base_output, - "fbtl:base:file_Select: Checking all available module"); - - /* since there are somethings which the mca requested through the - if the intersection is NULL, then we barf saying that the requested - modules are not being available */ - - selectable = OBJ_NEW(opal_list_t); - was_selectable_constructed = true; - - /* go through the compoents_available list and check against the names - * to see whether this can be added or not */ - - for (item = opal_list_get_first(&mca_fbtl_base_components_available); - item != opal_list_get_end(&mca_fbtl_base_components_available); - item = opal_list_get_next(item)) { - /* convert the opal_list_item_t returned into the proper type */ - cpli = (mca_base_component_priority_list_item_t *) item; - component = (mca_fbtl_base_component_t *) cpli->super.cli_component; - opal_output_verbose(10, mca_fbtl_base_output, - "select: initialising %s component %s", - component->fbtlm_version.mca_type_name, - component->fbtlm_version.mca_component_name); - - /* check if this name is present in the mca_base_var */ - for (i=0; i < num_names; i++) { - if (0 == strcmp(name_array[i], component->fbtlm_version.mca_component_name)) { - /* this is present, and should be added o the selectable list */ - - /* We need to create a seperate object to initialise this list with - * since we cannot have the same item in 2 lists */ - - selectable_item = OBJ_NEW (mca_base_component_priority_list_item_t); - *selectable_item = *cpli; - opal_list_append (selectable, (opal_list_item_t *)selectable_item); - break; - } - } - } - - /* check for a NULL intersection between the available list and the - * list which was asked for */ - - if (0 == opal_list_get_size(selectable)) { - was_selectable_constructed = true; - OBJ_RELEASE (selectable); - opal_output_verbose (10, mca_fbtl_base_output, - "fbtl:base:file_select: preferred modules were not available"); - return OMPI_ERROR; - } - } else { /* if there was no name_array, then we need to simply initialize - selectable to mca_fbtl_base_components_available */ - selectable = &mca_fbtl_base_components_available; - } - best_component = NULL; best_priority = -1; OBJ_CONSTRUCT(&queried, opal_list_t); - for (item = opal_list_get_first(selectable); - item != opal_list_get_end(selectable); - item = opal_list_get_next(item)) { - /* - * convert the opal_list_item_t returned into the proper type - */ - cpli = (mca_base_component_priority_list_item_t *) item; - component = (mca_fbtl_base_component_t *) cpli->super.cli_component; - opal_output_verbose(10, mca_fbtl_base_output, + OPAL_LIST_FOREACH(cli, &ompi_fbtl_base_framework.framework_components, mca_base_component_list_item_t) { + component = (mca_fbtl_base_component_t *) cli->cli_component; + opal_output_verbose(10, ompi_fbtl_base_framework.framework_output, "select: initialising %s component %s", component->fbtlm_version.mca_type_name, component->fbtlm_version.mca_component_name); @@ -221,7 +143,7 @@ int mca_fbtl_base_file_select (struct mca_io_ompio_file_t *file, * we can call the query function only if there is a function :-) */ if (NULL == component->fbtlm_file_query) { - opal_output_verbose(10, mca_fbtl_base_output, + opal_output_verbose(10, ompi_fbtl_base_framework.framework_output, "select: no query, ignoring the component"); } else { /* @@ -234,10 +156,10 @@ int mca_fbtl_base_file_select (struct mca_io_ompio_file_t *file, /* * query did not return any action which can be used */ - opal_output_verbose(10, mca_fbtl_base_output, + opal_output_verbose(10, ompi_fbtl_base_framework.framework_output, "select: query returned failure"); } else { - opal_output_verbose(10, mca_fbtl_base_output, + opal_output_verbose(10, ompi_fbtl_base_framework.framework_output, "select: query returned priority %d", priority); /* @@ -263,25 +185,6 @@ int mca_fbtl_base_file_select (struct mca_io_ompio_file_t *file, } /* end else of if (NULL == component->fbtlm_init) */ } /* end for ... end of traversal */ - /* We have to remove empty out the selectable list if the selectable - * list was constructed as a duplicate and not as a pointer to the - * mca_base_components_available list. So, check and destroy */ - - if (was_selectable_constructed) { - - /* remove all the items first */ - for (item = opal_list_get_first(&mca_fbtl_base_components_available); - item != opal_list_get_end(&mca_fbtl_base_components_available); - item = next_item) { - next_item = opal_list_get_next(item); - OBJ_RELEASE (item); - } - - /* release the list itself */ - OBJ_RELEASE (selectable); - was_selectable_constructed = false; - } - /* * Now we have alist of components which successfully returned * their module struct. One of these components has the best @@ -305,9 +208,7 @@ int mca_fbtl_base_file_select (struct mca_io_ompio_file_t *file, * unquery() those components which have not been selected and * init() the component which was selected */ - for (item = opal_list_remove_first(&queried); - NULL != item; - item = opal_list_remove_first(&queried)) { + while (NULL != (item = opal_list_remove_first(&queried))) { om = (queried_module_t *) item; if (om->om_component == best_component) { /* @@ -340,7 +241,7 @@ int mca_fbtl_base_file_select (struct mca_io_ompio_file_t *file, * unquery. Hence this check is necessary */ (void) om->om_component->fbtlm_file_unquery(file); - opal_output_verbose(10, mca_fbtl_base_output, + opal_output_verbose(10, ompi_fbtl_base_framework.framework_output, "select: component %s is not selected", om->om_component->fbtlm_version.mca_component_name); } /* end if */ @@ -348,7 +249,7 @@ int mca_fbtl_base_file_select (struct mca_io_ompio_file_t *file, OBJ_RELEASE(om); } /* traversing through the entire list */ - opal_output_verbose(10, mca_fbtl_base_output, + opal_output_verbose(10, ompi_fbtl_base_framework.framework_output, "select: component %s selected", best_component->fbtlm_version.mca_component_name); diff --git a/ompi/mca/fbtl/base/fbtl_base_find_available.c b/ompi/mca/fbtl/base/fbtl_base_find_available.c index 16926a70cd..e74712dd72 100644 --- a/ompi/mca/fbtl/base/fbtl_base_find_available.c +++ b/ompi/mca/fbtl/base/fbtl_base_find_available.c @@ -27,81 +27,41 @@ #include "opal/class/opal_list.h" #include "opal/mca/mca.h" #include "opal/mca/base/base.h" -#include "opal/mca/base/mca_base_component_repository.h" #include "ompi/mca/fbtl/fbtl.h" #include "ompi/mca/fbtl/base/base.h" -opal_list_t mca_fbtl_base_modules_available; -bool mca_fbtl_base_modules_available_valid = false; - static int init_query(const mca_base_component_t *m, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads); static int init_query_2_0_0(const mca_base_component_t *component, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads); int mca_fbtl_base_find_available(bool enable_progress_threads, bool enable_mpi_threads) { - bool found = false; - mca_base_component_priority_list_item_t *entry; - opal_list_item_t *p; - - /* Initialize the list */ - - OBJ_CONSTRUCT(&mca_fbtl_base_components_available, opal_list_t); - mca_fbtl_base_components_available_valid = true; + mca_base_component_list_item_t *cli, *next; /* The list of components which we should check is already present in mca_fbtl_base_components_opened, which was established in mca_fbtl_base_open */ - for (found = false, - p = opal_list_remove_first (&mca_fbtl_base_components_opened); - NULL != p; - p = opal_list_remove_first (&mca_fbtl_base_components_opened)) { - entry = OBJ_NEW(mca_base_component_priority_list_item_t); - entry->super.cli_component = - ((mca_base_component_list_item_t *)p)->cli_component; - + OPAL_LIST_FOREACH_SAFE(cli, next, &ompi_fbtl_base_framework.framework_components, mca_base_component_list_item_t) { /* Now for this entry, we have to determine the thread level. Call a subroutine to do the job for us */ - if (OMPI_SUCCESS == init_query(entry->super.cli_component, entry, + if (OMPI_SUCCESS != init_query(cli->cli_component, enable_progress_threads, enable_mpi_threads)) { - /* Save the results in the list. The priority is not relvant at - this point in time. But we save the thread arguments so that - the initial selection algorithm can negotiate overall thread - level for this process */ - entry->cpli_priority = 0; - opal_list_append (&mca_fbtl_base_components_available, - (opal_list_item_t *) entry); - found = true; - } else { - /* The component does not want to run, so close it. Its close() - has already been invoked. Close it out of the DSO repository - (if it is there in the repository) */ - mca_base_component_repository_release(entry->super.cli_component); - OBJ_RELEASE(entry); + mca_base_component_close(cli->cli_component, ompi_fbtl_base_framework.framework_output); + opal_list_remove_item(&ompi_fbtl_base_framework.framework_components, &cli->super); + OBJ_RELEASE(cli); } - /* Free entry from the "opened" list */ - OBJ_RELEASE(p); } - /* The opened list is no longer necessary, so we can free it */ - OBJ_DESTRUCT (&mca_fbtl_base_components_opened); - mca_fbtl_base_components_opened_valid = false; - - /* There should atleast be one fbtl component which was available */ - if (false == found) { - /* Need to free all items in the list */ - OBJ_DESTRUCT(&mca_fbtl_base_components_available); - mca_fbtl_base_components_available_valid = false; - opal_output_verbose (10, mca_fbtl_base_output, + /* There should atleast be one fbtl component which was available */ + if (0 == opal_list_get_size(&ompi_fbtl_base_framework.framework_components)) { + opal_output_verbose (10, ompi_fbtl_base_framework.framework_output, "fbtl:find_available: no fbtl components available!"); return OMPI_ERROR; } @@ -112,13 +72,12 @@ int mca_fbtl_base_find_available(bool enable_progress_threads, static int init_query(const mca_base_component_t *m, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads) { int ret; - opal_output_verbose(10, mca_fbtl_base_output, + opal_output_verbose(10, ompi_fbtl_base_framework.framework_output, "fbtl:find_available: querying fbtl component %s", m->mca_component_name); @@ -126,11 +85,11 @@ static int init_query(const mca_base_component_t *m, if (2 == m->mca_type_major_version && 0 == m->mca_type_minor_version && 0 == m->mca_type_release_version) { - ret = init_query_2_0_0(m, entry, enable_progress_threads, + ret = init_query_2_0_0(m, enable_progress_threads, enable_mpi_threads); } else { /* unrecognised API version */ - opal_output_verbose(10, mca_fbtl_base_output, + opal_output_verbose(10, ompi_fbtl_base_framework.framework_output, "fbtl:find_available:unrecognised fbtl API version (%d.%d.%d)", m->mca_type_major_version, m->mca_type_minor_version, @@ -140,14 +99,11 @@ static int init_query(const mca_base_component_t *m, /* Query done -- look at return value to see what happened */ if (OMPI_SUCCESS != ret) { - opal_output_verbose(10, mca_fbtl_base_output, + opal_output_verbose(10, ompi_fbtl_base_framework.framework_output, "fbtl:find_available fbtl component %s is not available", m->mca_component_name); - if (NULL != m->mca_close_component) { - m->mca_close_component(); - } } else { - opal_output_verbose(10, mca_fbtl_base_output, + opal_output_verbose(10, ompi_fbtl_base_framework.framework_output, "fbtl:find_avalable: fbtl component %s is available", m->mca_component_name); @@ -158,7 +114,6 @@ static int init_query(const mca_base_component_t *m, static int init_query_2_0_0(const mca_base_component_t *component, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads) { diff --git a/ompi/mca/fbtl/base/fbtl_base_open.c b/ompi/mca/fbtl/base/fbtl_base_frame.c similarity index 57% rename from ompi/mca/fbtl/base/fbtl_base_open.c rename to ompi/mca/fbtl/base/fbtl_base_frame.c index 69c7c4291c..e7772c94fb 100644 --- a/ompi/mca/fbtl/base/fbtl_base_open.c +++ b/ompi/mca/fbtl/base/fbtl_base_frame.c @@ -39,41 +39,8 @@ * Global variables; most of which are loaded by back-ends of MCA * variables */ -int mca_fbtl_base_param = -1; -int mca_fbtl_base_output = -1; - -opal_list_t mca_fbtl_base_components_opened; -opal_list_t mca_fbtl_base_components_available; - -bool mca_fbtl_base_components_available_valid = false; -bool mca_fbtl_base_components_opened_valid = false; - mca_fbtl_base_component_t mca_fbtl_base_selected_component; mca_fbtl_base_module_t mca_fbtl; -/* - * Function for finding and opening either all MCA components, or the one - * that was specifically requested via a MCA parameter. - */ -int mca_fbtl_base_open(void) -{ - /* Open an output stream for this framework */ - - mca_fbtl_base_output = opal_output_open(NULL); - - /* Open up all available components */ - - if (OMPI_SUCCESS != - mca_base_components_open("fbtl", mca_fbtl_base_output, - mca_fbtl_base_static_components, - &mca_fbtl_base_components_opened, true)) { - return OMPI_ERROR; - } - mca_fbtl_base_components_opened_valid = true; - - /* Find the index of the MCA "fbtl" param for selection */ - - mca_fbtl_base_param = mca_base_var_find("ompi", "fbtl", NULL, NULL); - - return OMPI_SUCCESS; -} +MCA_BASE_FRAMEWORK_DECLARE(ompi, fbtl, NULL, NULL, NULL, NULL, + mca_fbtl_base_static_components, 0); diff --git a/ompi/mca/fcoll/base/Makefile.am b/ompi/mca/fcoll/base/Makefile.am index eec2a277b3..b45878f6ee 100644 --- a/ompi/mca/fcoll/base/Makefile.am +++ b/ompi/mca/fcoll/base/Makefile.am @@ -21,8 +21,7 @@ headers += \ base/base.h libmca_fcoll_la_SOURCES += \ - base/fcoll_base_close.c \ + base/fcoll_base_frame.c \ base/fcoll_base_file_select.c \ base/fcoll_base_file_unselect.c \ - base/fcoll_base_find_available.c \ - base/fcoll_base_open.c + base/fcoll_base_find_available.c diff --git a/ompi/mca/fcoll/base/base.h b/ompi/mca/fcoll/base/base.h index cd0f94e7be..cbfc9e9a92 100644 --- a/ompi/mca/fcoll/base/base.h +++ b/ompi/mca/fcoll/base/base.h @@ -30,17 +30,11 @@ #include "ompi_config.h" #include "mpi.h" -#include "opal/class/opal_list.h" +#include "opal/mca/base/base.h" #include "ompi/mca/fcoll/fcoll.h" -#include "opal/mca/mca.h" - BEGIN_C_DECLS -OMPI_DECLSPEC int mca_fcoll_base_open(void); - -OMPI_DECLSPEC int mca_fcoll_base_close(void); - OMPI_DECLSPEC int mca_fcoll_base_file_select(struct mca_io_ompio_file_t *file, mca_base_component_t *preferred); OMPI_DECLSPEC int mca_fcoll_base_query_table (struct mca_io_ompio_file_t *file, @@ -56,15 +50,7 @@ OMPI_DECLSPEC int mca_fcoll_base_get_param (struct mca_io_ompio_file_t *file, in /* * Globals */ - -OMPI_DECLSPEC extern int mca_fcoll_base_param; -OMPI_DECLSPEC extern int mca_fcoll_base_output; - -OMPI_DECLSPEC extern bool mca_fcoll_base_components_opened_valid; -OMPI_DECLSPEC extern bool mca_fcoll_base_components_available_valid; - -OMPI_DECLSPEC extern opal_list_t mca_fcoll_base_components_opened; -OMPI_DECLSPEC extern opal_list_t mca_fcoll_base_components_available; +OMPI_DECLSPEC extern mca_base_framework_t ompi_fcoll_base_framework; END_C_DECLS diff --git a/ompi/mca/fcoll/base/fcoll_base_close.c b/ompi/mca/fcoll/base/fcoll_base_close.c deleted file mode 100644 index bf3d058940..0000000000 --- a/ompi/mca/fcoll/base/fcoll_base_close.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. - * $COPYRIGHTOB$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include - -#include "ompi/constants.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "ompi/mca/fcoll/fcoll.h" -#include "ompi/mca/fcoll/base/base.h" -#include "opal/util/output.h" - -int mca_fcoll_base_close(void) -{ - /* - Close all components that are still open. This may be the opened - list (if we're in ompi_info), or it may be the available list (if - we're anywhere else). - */ - - if (mca_fcoll_base_components_opened_valid) { - mca_base_components_close(mca_fcoll_base_output, - &mca_fcoll_base_components_opened, NULL); - OBJ_DESTRUCT(&mca_fcoll_base_components_opened); - mca_fcoll_base_components_opened_valid = false; - } else if (mca_fcoll_base_components_available_valid) { - mca_base_components_close(mca_fcoll_base_output, - &mca_fcoll_base_components_available, NULL); - OBJ_DESTRUCT(&mca_fcoll_base_components_available); - mca_fcoll_base_components_available_valid = false; - } - - /* Close the framework output */ - opal_output_close (mca_fcoll_base_output); - mca_fcoll_base_output = -1; - - /* All done */ - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/fcoll/base/fcoll_base_file_select.c b/ompi/mca/fcoll/base/fcoll_base_file_select.c index 33f7d86ff8..9d69ead48d 100644 --- a/ompi/mca/fcoll/base/fcoll_base_file_select.c +++ b/ompi/mca/fcoll/base/fcoll_base_file_select.c @@ -68,21 +68,13 @@ int mca_fcoll_base_file_select (struct mca_io_ompio_file_t *file, int priority; int best_priority; opal_list_item_t *item; - opal_list_item_t *next_item; - char **name_array; - int num_names; - mca_base_component_priority_list_item_t *cpli; + mca_base_component_list_item_t *cli; mca_fcoll_base_component_t *component; mca_fcoll_base_component_t *best_component; mca_fcoll_base_module_t *module; opal_list_t queried; queried_module_t *om; - opal_list_t *selectable; - char *str; int err = MPI_SUCCESS; - int i; - bool was_selectable_constructed = false; - const char **names_value, *names; /* Check and see if a preferred component was provided. If it was provided then it should be used (if possible) */ @@ -90,12 +82,9 @@ int mca_fcoll_base_file_select (struct mca_io_ompio_file_t *file, /* We have a preferred component. Check if it is available and if so, whether it wants to run */ - - str = &(preferred->mca_component_name[0]); - - opal_output_verbose(10, mca_fcoll_base_output, + opal_output_verbose(10, ompi_fcoll_base_framework.framework_output, "fcoll:base:file_select: Checking preferred component: %s", - str); + preferred->mca_component_name); /* query the component for its priority and get its module structure. This is necessary to proceed */ @@ -134,92 +123,13 @@ int mca_fcoll_base_file_select (struct mca_io_ompio_file_t *file, * use that for this file */ - /* Check if anything was requested by means on the name parameters */ - names_value = NULL; - mca_base_var_get_value (mca_fcoll_base_param, &names_value, NULL, NULL); - names = names_value ? names_value[0] : NULL; - - if (NULL != names && 0 < strlen(names)) { - name_array = opal_argv_split (names, ','); - num_names = opal_argv_count (name_array); - - opal_output_verbose(10, mca_fcoll_base_output, - "fcoll:base:file_Select: Checking all available module"); - - /* since there are somethings which the mca requested through the - if the intersection is NULL, then we barf saying that the requested - modules are not being available */ - - selectable = OBJ_NEW(opal_list_t); - was_selectable_constructed = true; - - /* go through the compoents_available list and check against the names - * to see whether this can be added or not */ - - for (item = opal_list_get_first(&mca_fcoll_base_components_available); - item != opal_list_get_end(&mca_fcoll_base_components_available); - item = opal_list_get_next(item)) { - /* convert the opal_list_item_t returned into the proper type */ - cpli = (mca_base_component_priority_list_item_t *) item; - component = (mca_fcoll_base_component_t *) cpli->super.cli_component; - opal_output_verbose(10, mca_fcoll_base_output, - "select: initialising %s component %s", - component->fcollm_version.mca_type_name, - component->fcollm_version.mca_component_name); - - /* check if this name is present in the mca_base_var */ - for (i=0; i < num_names; i++) { - if (0 == strcmp(name_array[i], component->fcollm_version.mca_component_name)) { - /* this is present, and should be added o the selectable list */ - - /* We need to create a seperate object to initialise this list with - * since we cannot have the same item in 2 lists */ - module = component->fcollm_file_query (file, &priority); - if (NULL != module && - NULL != module->fcoll_module_init) { - - file->f_fcoll = module; - file->f_fcoll_component = (mca_base_component_t *)component; - return module->fcoll_module_init(file); - } - - /* - selectable_item = OBJ_NEW (mca_base_component_priority_list_item_t); - *selectable_item = *cpli; - opal_list_append (selectable, (opal_list_item_t *)selectable_item); - break;*/ - } - } - } - - /* check for a NULL intersection between the available list and the - * list which was asked for */ - - if (0 == opal_list_get_size(selectable)) { - was_selectable_constructed = true; - OBJ_RELEASE (selectable); - opal_output_verbose (10, mca_fcoll_base_output, - "fcoll:base:file_select: preferred modules were not available"); - return OMPI_ERROR; - } - } else { /* if there was no name_array, then we need to simply initialize - selectable to mca_fcoll_base_components_available */ - selectable = &mca_fcoll_base_components_available; - } - best_component = NULL; best_priority = -1; OBJ_CONSTRUCT(&queried, opal_list_t); - for (item = opal_list_get_first(selectable); - item != opal_list_get_end(selectable); - item = opal_list_get_next(item)) { - /* - * convert the opal_list_item_t returned into the proper type - */ - cpli = (mca_base_component_priority_list_item_t *) item; - component = (mca_fcoll_base_component_t *) cpli->super.cli_component; - opal_output_verbose(10, mca_fcoll_base_output, + OPAL_LIST_FOREACH(cli, &ompi_fcoll_base_framework.framework_components, mca_base_component_list_item_t) { + component = (mca_fcoll_base_component_t *) cli->cli_component; + opal_output_verbose(10, ompi_fcoll_base_framework.framework_output, "select: initialising %s component %s", component->fcollm_version.mca_type_name, component->fcollm_version.mca_component_name); @@ -228,7 +138,7 @@ int mca_fcoll_base_file_select (struct mca_io_ompio_file_t *file, * we can call the query function only if there is a function :-) */ if (NULL == component->fcollm_file_query) { - opal_output_verbose(10, mca_fcoll_base_output, + opal_output_verbose(10, ompi_fcoll_base_framework.framework_output, "select: no query, ignoring the component"); } else { /* @@ -241,10 +151,10 @@ int mca_fcoll_base_file_select (struct mca_io_ompio_file_t *file, /* * query did not return any action which can be used */ - opal_output_verbose(10, mca_fcoll_base_output, + opal_output_verbose(10, ompi_fcoll_base_framework.framework_output, "select: query returned failure"); } else { - opal_output_verbose(10, mca_fcoll_base_output, + opal_output_verbose(10, ompi_fcoll_base_framework.framework_output, "select: query returned priority %d", priority); /* @@ -270,25 +180,6 @@ int mca_fcoll_base_file_select (struct mca_io_ompio_file_t *file, } /* end else of if (NULL == component->fcollm_init) */ } /* end for ... end of traversal */ - /* We have to remove empty out the selectable list if the selectable - * list was constructed as a duplicate and not as a pointer to the - * mca_base_components_available list. So, check and destroy */ - - if (was_selectable_constructed) { - - /* remove all the items first */ - for (item = opal_list_get_first(&mca_fcoll_base_components_available); - item != opal_list_get_end(&mca_fcoll_base_components_available); - item = next_item) { - next_item = opal_list_get_next(item); - OBJ_RELEASE (item); - } - - /* release the list itself */ - OBJ_RELEASE (selectable); - was_selectable_constructed = false; - } - /* * Now we have alist of components which successfully returned * their module struct. One of these components has the best @@ -311,9 +202,7 @@ int mca_fcoll_base_file_select (struct mca_io_ompio_file_t *file, * unquery() those components which have not been selected and * init() the component which was selected */ - for (item = opal_list_remove_first(&queried); - NULL != item; - item = opal_list_remove_first(&queried)) { + while (NULL != (item = opal_list_remove_first(&queried))) { om = (queried_module_t *) item; if (om->om_component == best_component) { /* @@ -349,7 +238,7 @@ int mca_fcoll_base_file_select (struct mca_io_ompio_file_t *file, * unquery. Hence this check is necessary */ (void) om->om_component->fcollm_file_unquery(file); - opal_output_verbose(10, mca_fcoll_base_output, + opal_output_verbose(10, ompi_fcoll_base_framework.framework_output, "select: component %s is not selected", om->om_component->fcollm_version.mca_component_name); } /* end if */ @@ -357,7 +246,7 @@ int mca_fcoll_base_file_select (struct mca_io_ompio_file_t *file, OBJ_RELEASE(om); } /* traversing through the entire list */ - opal_output_verbose(10, mca_fcoll_base_output, + opal_output_verbose(10, ompi_fcoll_base_framework.framework_output, "select: component %s selected", best_component->fcollm_version.mca_component_name); diff --git a/ompi/mca/fcoll/base/fcoll_base_find_available.c b/ompi/mca/fcoll/base/fcoll_base_find_available.c index eba0c1bdc6..20736a354e 100644 --- a/ompi/mca/fcoll/base/fcoll_base_find_available.c +++ b/ompi/mca/fcoll/base/fcoll_base_find_available.c @@ -24,85 +24,45 @@ #include "mpi.h" #include "ompi/constants.h" -#include "opal/class/opal_list.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "opal/mca/base/mca_base_component_repository.h" #include "ompi/mca/fcoll/fcoll.h" #include "ompi/mca/fcoll/base/base.h" #include "opal/util/output.h" -opal_list_t mca_fcoll_base_modules_available; -bool mca_fcoll_base_modules_available_valid = false; - static int init_query(const mca_base_component_t *m, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads); static int init_query_2_0_0(const mca_base_component_t *component, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads); int mca_fcoll_base_find_available(bool enable_progress_threads, bool enable_mpi_threads) { - bool found = false; - mca_base_component_priority_list_item_t *entry; - opal_list_item_t *p; - - /* Initialize the list */ - - OBJ_CONSTRUCT(&mca_fcoll_base_components_available, opal_list_t); - mca_fcoll_base_components_available_valid = true; + mca_base_component_list_item_t *cli, *next; /* The list of components which we should check is already present in mca_fcoll_base_components_opened, which was established in mca_fcoll_base_open */ - for (found = false, - p = opal_list_remove_first (&mca_fcoll_base_components_opened); - NULL != p; - p = opal_list_remove_first (&mca_fcoll_base_components_opened)) { - entry = OBJ_NEW(mca_base_component_priority_list_item_t); - entry->super.cli_component = - ((mca_base_component_list_item_t *)p)->cli_component; - + OPAL_LIST_FOREACH_SAFE(cli, next, &ompi_fcoll_base_framework.framework_components, mca_base_component_list_item_t) { /* Now for this entry, we have to determine the thread level. Call a subroutine to do the job for us */ - if (OMPI_SUCCESS == init_query(entry->super.cli_component, entry, + if (OMPI_SUCCESS != init_query(cli->cli_component, enable_progress_threads, enable_mpi_threads)) { - /* Save the results in the list. The priority is not relvant at - this point in time. But we save the thread arguments so that - the initial selection algorithm can negotiate overall thread - level for this process */ - entry->cpli_priority = 0; - opal_list_append (&mca_fcoll_base_components_available, - (opal_list_item_t *) entry); - found = true; - } else { /* The component does not want to run, so close it. Its close() has already been invoked. Close it out of the DSO repository (if it is there in the repository) */ - mca_base_component_repository_release(entry->super.cli_component); - OBJ_RELEASE(entry); + opal_list_remove_item(&ompi_fcoll_base_framework.framework_components, &cli->super); + mca_base_component_close(cli->cli_component, ompi_fcoll_base_framework.framework_output);; + OBJ_RELEASE(cli); } - /* Free entry from the "opened" list */ - OBJ_RELEASE(p); - } + } - /* The opened list is no longer necessary, so we can free it */ - OBJ_DESTRUCT (&mca_fcoll_base_components_opened); - mca_fcoll_base_components_opened_valid = false; - - /* There should atleast be one fcoll component which was available */ - if (false == found) { - /* Need to free all items in the list */ - OBJ_DESTRUCT(&mca_fcoll_base_components_available); - mca_fcoll_base_components_available_valid = false; - opal_output_verbose (10, mca_fcoll_base_output, + /* There should atleast be one fcoll component which was available */ + if (0 == opal_list_get_size(&ompi_fcoll_base_framework.framework_components)) { + opal_output_verbose (10, ompi_fcoll_base_framework.framework_output, "fcoll:find_available: no fcoll components available!"); return OMPI_ERROR; } @@ -113,13 +73,12 @@ int mca_fcoll_base_find_available(bool enable_progress_threads, static int init_query(const mca_base_component_t *m, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads) { int ret; - opal_output_verbose(10, mca_fcoll_base_output, + opal_output_verbose(10, ompi_fcoll_base_framework.framework_output, "fcoll:find_available: querying fcoll component %s", m->mca_component_name); @@ -127,11 +86,11 @@ static int init_query(const mca_base_component_t *m, if (2 == m->mca_type_major_version && 0 == m->mca_type_minor_version && 0 == m->mca_type_release_version) { - ret = init_query_2_0_0(m, entry, enable_progress_threads, + ret = init_query_2_0_0(m, enable_progress_threads, enable_mpi_threads); } else { /* unrecognised API version */ - opal_output_verbose(10, mca_fcoll_base_output, + opal_output_verbose(10, ompi_fcoll_base_framework.framework_output, "fcoll:find_available:unrecognised fcoll API version (%d.%d.%d)", m->mca_type_major_version, m->mca_type_minor_version, @@ -141,14 +100,11 @@ static int init_query(const mca_base_component_t *m, /* Query done -- look at return value to see what happened */ if (OMPI_SUCCESS != ret) { - opal_output_verbose(10, mca_fcoll_base_output, + opal_output_verbose(10, ompi_fcoll_base_framework.framework_output, "fcoll:find_available fcoll component %s is not available", m->mca_component_name); - if (NULL != m->mca_close_component) { - m->mca_close_component(); - } } else { - opal_output_verbose(10, mca_fcoll_base_output, + opal_output_verbose(10, ompi_fcoll_base_framework.framework_output, "fcoll:find_avalable: fcoll component %s is available", m->mca_component_name); @@ -159,7 +115,6 @@ static int init_query(const mca_base_component_t *m, static int init_query_2_0_0(const mca_base_component_t *component, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads) { diff --git a/ompi/mca/fcoll/base/fcoll_base_open.c b/ompi/mca/fcoll/base/fcoll_base_frame.c similarity index 53% rename from ompi/mca/fcoll/base/fcoll_base_open.c rename to ompi/mca/fcoll/base/fcoll_base_frame.c index d2f03ad77a..96cb12124f 100644 --- a/ompi/mca/fcoll/base/fcoll_base_open.c +++ b/ompi/mca/fcoll/base/fcoll_base_frame.c @@ -39,41 +39,6 @@ * Global variables; most of which are loaded by back-ends of MCA * variables */ -int mca_fcoll_base_param = -1; -int mca_fcoll_base_output = -1; -opal_list_t mca_fcoll_base_components_opened; -opal_list_t mca_fcoll_base_components_available; - -bool mca_fcoll_base_components_available_valid = false; -bool mca_fcoll_base_components_opened_valid = false; - -mca_fcoll_base_component_t mca_fcoll_base_selected_component; -mca_fcoll_base_module_t mca_fcoll; - -/* - * Function for finding and opening either all MCA components, or the one - * that was specifically requested via a MCA parameter. - */ -int mca_fcoll_base_open(void) -{ - /* Open an output stream for this framework */ - - mca_fcoll_base_output = opal_output_open(NULL); - - /* Open up all available components */ - - if (OMPI_SUCCESS != - mca_base_components_open("fcoll", mca_fcoll_base_output, - mca_fcoll_base_static_components, - &mca_fcoll_base_components_opened, true)) { - return OMPI_ERROR; - } - mca_fcoll_base_components_opened_valid = true; - - /* Find the index of the MCA "fcoll" param for selection */ - - mca_fcoll_base_param = mca_base_var_find("ompi", "fcoll", NULL, NULL); - - return OMPI_SUCCESS; -} +MCA_BASE_FRAMEWORK_DECLARE(ompi, fcoll, NULL, NULL, NULL, NULL, + mca_fcoll_base_static_components, 0); diff --git a/ompi/mca/fs/base/Makefile.am b/ompi/mca/fs/base/Makefile.am index f85cf22b44..bcb8422ea0 100644 --- a/ompi/mca/fs/base/Makefile.am +++ b/ompi/mca/fs/base/Makefile.am @@ -21,9 +21,8 @@ headers += \ base/base.h libmca_fs_la_SOURCES += \ - base/fs_base_close.c \ + base/fs_base_frame.c \ base/fs_base_file_select.c \ base/fs_base_file_unselect.c \ base/fs_base_find_available.c \ - base/fs_base_get_parent_dir.c \ - base/fs_base_open.c + base/fs_base_get_parent_dir.c diff --git a/ompi/mca/fs/base/base.h b/ompi/mca/fs/base/base.h index f30de19e3b..7c3f7b1991 100644 --- a/ompi/mca/fs/base/base.h +++ b/ompi/mca/fs/base/base.h @@ -30,17 +30,12 @@ #include "ompi_config.h" #include "mpi.h" -#include "opal/class/opal_list.h" #include "ompi/mca/fs/fs.h" -#include "opal/mca/mca.h" +#include "opal/mca/base/base.h" BEGIN_C_DECLS -OMPI_DECLSPEC int mca_fs_base_open(void); - -OMPI_DECLSPEC int mca_fs_base_close(void); - OMPI_DECLSPEC int mca_fs_base_file_select(struct mca_io_ompio_file_t *file, mca_base_component_t *preferred); @@ -57,14 +52,7 @@ OMPI_DECLSPEC void mca_fs_base_get_parent_dir (char *filename, char **dirnamep); * Globals */ -OMPI_DECLSPEC extern int mca_fs_base_param; -OMPI_DECLSPEC extern int mca_fs_base_output; - -OMPI_DECLSPEC extern bool mca_fs_base_components_opened_valid; -OMPI_DECLSPEC extern bool mca_fs_base_components_available_valid; - -OMPI_DECLSPEC extern opal_list_t mca_fs_base_components_opened; -OMPI_DECLSPEC extern opal_list_t mca_fs_base_components_available; +OMPI_DECLSPEC extern mca_base_framework_t ompi_fs_base_framework; END_C_DECLS diff --git a/ompi/mca/fs/base/fs_base_close.c b/ompi/mca/fs/base/fs_base_close.c deleted file mode 100644 index 740e90908c..0000000000 --- a/ompi/mca/fs/base/fs_base_close.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. - * $COPYRIGHTOB$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include - -#include "ompi/constants.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "ompi/mca/fs/fs.h" -#include "ompi/mca/fs/base/base.h" -#include "opal/util/output.h" - -int mca_fs_base_close(void) -{ - /* - Close all components that are still open. This may be the opened - list (if we're in ompi_info), or it may be the available list (if - we're anywhere else). - */ - - if (mca_fs_base_components_opened_valid) { - mca_base_components_close(mca_fs_base_output, - &mca_fs_base_components_opened, NULL); - OBJ_DESTRUCT(&mca_fs_base_components_opened); - mca_fs_base_components_opened_valid = false; - } else if (mca_fs_base_components_available_valid) { - mca_base_components_close(mca_fs_base_output, - &mca_fs_base_components_available, NULL); - OBJ_DESTRUCT(&mca_fs_base_components_available); - mca_fs_base_components_available_valid = false; - } - - /* Close the framework output */ - opal_output_close (mca_fs_base_output); - mca_fs_base_output = -1; - - /* All done */ - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/fs/base/fs_base_file_select.c b/ompi/mca/fs/base/fs_base_file_select.c index 624972e3ae..647dbadc67 100644 --- a/ompi/mca/fs/base/fs_base_file_select.c +++ b/ompi/mca/fs/base/fs_base_file_select.c @@ -67,23 +67,14 @@ int mca_fs_base_file_select (struct mca_io_ompio_file_t *file, { int priority; int best_priority; - opal_list_item_t *item; - opal_list_item_t *next_item; - mca_base_component_priority_list_item_t *selectable_item; - char **name_array; - int num_names; - mca_base_component_priority_list_item_t *cpli; + opal_list_item_t *item; + mca_base_component_list_item_t *cli; mca_fs_base_component_t *component; mca_fs_base_component_t *best_component; mca_fs_base_module_t *module; opal_list_t queried; queried_module_t *om; - opal_list_t *selectable; - char *str; int err = MPI_SUCCESS; - int i; - bool was_selectable_constructed = false; - const char **names_value, *names; /* Check and see if a preferred component was provided. If it was provided then it should be used (if possible) */ @@ -92,12 +83,9 @@ int mca_fs_base_file_select (struct mca_io_ompio_file_t *file, /* We have a preferred component. Check if it is available and if so, whether it wants to run */ - - str = &(preferred->mca_component_name[0]); - - opal_output_verbose(10, mca_fs_base_output, + opal_output_verbose(10, ompi_fs_base_framework.framework_output, "fs:base:file_select: Checking preferred component: %s", - str); + preferred->mca_component_name); /* query the component for its priority and get its module structure. This is necessary to proceed */ @@ -136,83 +124,13 @@ int mca_fs_base_file_select (struct mca_io_ompio_file_t *file, * use that for this file */ - /* Check if anything was requested by means on the name parameters */ - names_value = NULL; - mca_base_var_get_value(mca_fs_base_param, &names_value, NULL, NULL); - names = names_value ? names_value[0] : NULL; - - if (NULL != names && 0 < strlen(names)) { - name_array = opal_argv_split (names, ','); - num_names = opal_argv_count (name_array); - - opal_output_verbose(10, mca_fs_base_output, - "fs:base:file_Select: Checking all available module"); - - /* since there are somethings which the mca requested through the - if the intersection is NULL, then we barf saying that the requested - modules are not being available */ - - selectable = OBJ_NEW(opal_list_t); - was_selectable_constructed = true; - - /* go through the compoents_available list and check against the names - * to see whether this can be added or not */ - - for (item = opal_list_get_first(&mca_fs_base_components_available); - item != opal_list_get_end(&mca_fs_base_components_available); - item = opal_list_get_next(item)) { - /* convert the opal_list_item_t returned into the proper type */ - cpli = (mca_base_component_priority_list_item_t *) item; - component = (mca_fs_base_component_t *) cpli->super.cli_component; - opal_output_verbose(10, mca_fs_base_output, - "select: initialising %s component %s", - component->fsm_version.mca_type_name, - component->fsm_version.mca_component_name); - - /* check if this name is present in the mca_base_var */ - for (i=0; i < num_names; i++) { - if (0 == strcmp(name_array[i], component->fsm_version.mca_component_name)) { - /* this is present, and should be added o the selectable list */ - - /* We need to create a seperate object to initialise this list with - * since we cannot have the same item in 2 lists */ - - selectable_item = OBJ_NEW (mca_base_component_priority_list_item_t); - *selectable_item = *cpli; - opal_list_append (selectable, (opal_list_item_t *)selectable_item); - break; - } - } - } - - /* check for a NULL intersection between the available list and the - * list which was asked for */ - - if (0 == opal_list_get_size(selectable)) { - was_selectable_constructed = true; - OBJ_RELEASE (selectable); - opal_output_verbose (10, mca_fs_base_output, - "fs:base:file_select: preferred modules were not available"); - return OMPI_ERROR; - } - } else { /* if there was no name_array, then we need to simply initialize - selectable to mca_fs_base_components_available */ - selectable = &mca_fs_base_components_available; - } - best_component = NULL; best_priority = -1; OBJ_CONSTRUCT(&queried, opal_list_t); - for (item = opal_list_get_first(selectable); - item != opal_list_get_end(selectable); - item = opal_list_get_next(item)) { - /* - * convert the opal_list_item_t returned into the proper type - */ - cpli = (mca_base_component_priority_list_item_t *) item; - component = (mca_fs_base_component_t *) cpli->super.cli_component; - opal_output_verbose(10, mca_fs_base_output, + OPAL_LIST_FOREACH(cli, &ompi_fs_base_framework.framework_components, mca_base_component_list_item_t) { + component = (mca_fs_base_component_t *) cli->cli_component; + opal_output_verbose(10, ompi_fs_base_framework.framework_output, "select: initialising %s component %s", component->fsm_version.mca_type_name, component->fsm_version.mca_component_name); @@ -221,7 +139,7 @@ int mca_fs_base_file_select (struct mca_io_ompio_file_t *file, * we can call the query function only if there is a function :-) */ if (NULL == component->fsm_file_query) { - opal_output_verbose(10, mca_fs_base_output, + opal_output_verbose(10, ompi_fs_base_framework.framework_output, "select: no query, ignoring the component"); } else { /* @@ -234,10 +152,10 @@ int mca_fs_base_file_select (struct mca_io_ompio_file_t *file, /* * query did not return any action which can be used */ - opal_output_verbose(10, mca_fs_base_output, + opal_output_verbose(10, ompi_fs_base_framework.framework_output, "select: query returned failure"); } else { - opal_output_verbose(10, mca_fs_base_output, + opal_output_verbose(10, ompi_fs_base_framework.framework_output, "select: query returned priority %d", priority); /* @@ -263,25 +181,6 @@ int mca_fs_base_file_select (struct mca_io_ompio_file_t *file, } /* end else of if (NULL == component->fsm_init) */ } /* end for ... end of traversal */ - /* We have to remove empty out the selectable list if the selectable - * list was constructed as a duplicate and not as a pointer to the - * mca_base_components_available list. So, check and destroy */ - - if (was_selectable_constructed) { - - /* remove all the items first */ - for (item = opal_list_get_first(&mca_fs_base_components_available); - item != opal_list_get_end(&mca_fs_base_components_available); - item = next_item) { - next_item = opal_list_get_next(item); - OBJ_RELEASE (item); - } - - /* release the list itself */ - OBJ_RELEASE (selectable); - was_selectable_constructed = false; - } - /* * Now we have alist of components which successfully returned * their module struct. One of these components has the best @@ -304,9 +203,7 @@ int mca_fs_base_file_select (struct mca_io_ompio_file_t *file, * unquery() those components which have not been selected and * init() the component which was selected */ - for (item = opal_list_remove_first(&queried); - NULL != item; - item = opal_list_remove_first(&queried)) { + while (NULL != (item = opal_list_remove_first(&queried))) { om = (queried_module_t *) item; if (om->om_component == best_component) { /* @@ -339,7 +236,7 @@ int mca_fs_base_file_select (struct mca_io_ompio_file_t *file, * unquery. Hence this check is necessary */ (void) om->om_component->fsm_file_unquery(file); - opal_output_verbose(10, mca_fs_base_output, + opal_output_verbose(10, ompi_fs_base_framework.framework_output, "select: component %s is not selected", om->om_component->fsm_version.mca_component_name); } /* end if */ @@ -347,7 +244,7 @@ int mca_fs_base_file_select (struct mca_io_ompio_file_t *file, OBJ_RELEASE(om); } /* traversing through the entire list */ - opal_output_verbose(10, mca_fs_base_output, + opal_output_verbose(10, ompi_fs_base_framework.framework_output, "select: component %s selected", best_component->fsm_version.mca_component_name); diff --git a/ompi/mca/fs/base/fs_base_find_available.c b/ompi/mca/fs/base/fs_base_find_available.c index 63a3818753..cdf9beecfc 100644 --- a/ompi/mca/fs/base/fs_base_find_available.c +++ b/ompi/mca/fs/base/fs_base_find_available.c @@ -24,85 +24,47 @@ #include "mpi.h" #include "ompi/constants.h" -#include "opal/class/opal_list.h" #include "opal/mca/mca.h" #include "opal/mca/base/base.h" -#include "opal/mca/base/mca_base_component_repository.h" #include "ompi/mca/fs/fs.h" #include "ompi/mca/fs/base/base.h" #include "opal/util/output.h" -opal_list_t mca_fs_base_modules_available; -bool mca_fs_base_modules_available_valid = false; - static int init_query(const mca_base_component_t *m, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads); static int init_query_2_0_0(const mca_base_component_t *component, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads); int mca_fs_base_find_available(bool enable_progress_threads, bool enable_mpi_threads) { - bool found = false; - mca_base_component_priority_list_item_t *entry; - opal_list_item_t *p; - - /* Initialize the list */ - - OBJ_CONSTRUCT(&mca_fs_base_components_available, opal_list_t); - mca_fs_base_components_available_valid = true; + mca_base_component_list_item_t *cli, *next; /* The list of components which we should check is already present in mca_fs_base_components_opened, which was established in mca_fs_base_open */ - for (found = false, - p = opal_list_remove_first (&mca_fs_base_components_opened); - NULL != p; - p = opal_list_remove_first (&mca_fs_base_components_opened)) { - entry = OBJ_NEW(mca_base_component_priority_list_item_t); - entry->super.cli_component = - ((mca_base_component_list_item_t *)p)->cli_component; + OPAL_LIST_FOREACH_SAFE(cli, next, &ompi_fs_base_framework.framework_components, mca_base_component_list_item_t) { + /* Now for this entry, we have to determine the thread level. Call + a subroutine to do the job for us */ - /* Now for this entry, we have to determine the thread level. Call - a subroutine to do the job for us */ + if (OMPI_SUCCESS != init_query(cli->cli_component, + enable_progress_threads, + enable_mpi_threads)) { + /* The component does not want to run, so close it. Its close() + has already been invoked. Close it out of the DSO repository + (if it is there in the repository) */ + opal_list_remove_item (&ompi_fs_base_framework.framework_components, &cli->super); + mca_base_component_close(cli->cli_component, ompi_fs_base_framework.framework_output); + OBJ_RELEASE(cli); + } + } - if (OMPI_SUCCESS == init_query(entry->super.cli_component, entry, - enable_progress_threads, - enable_mpi_threads)) { - /* Save the results in the list. The priority is not relvant at - this point in time. But we save the thread arguments so that - the initial selection algorithm can negotiate overall thread - level for this process */ - entry->cpli_priority = 0; - opal_list_append (&mca_fs_base_components_available, - (opal_list_item_t *) entry); - found = true; - } else { - /* The component does not want to run, so close it. Its close() - has already been invoked. Close it out of the DSO repository - (if it is there in the repository) */ - mca_base_component_repository_release(entry->super.cli_component); - OBJ_RELEASE(entry); - } - /* Free entry from the "opened" list */ - OBJ_RELEASE(p); - } - - /* The opened list is no longer necessary, so we can free it */ - OBJ_DESTRUCT (&mca_fs_base_components_opened); - mca_fs_base_components_opened_valid = false; - - /* There should atleast be one fs component which was available */ - if (false == found) { - /* Need to free all items in the list */ - OBJ_DESTRUCT(&mca_fs_base_components_available); - mca_fs_base_components_available_valid = false; - opal_output_verbose (10, mca_fs_base_output, + /* There should atleast be one fs component which was available */ + if (0 == opal_list_get_size(&ompi_fs_base_framework.framework_components)) { + opal_output_verbose (10, ompi_fs_base_framework.framework_output, "fs:find_available: no fs components available!"); return OMPI_ERROR; } @@ -113,13 +75,12 @@ int mca_fs_base_find_available(bool enable_progress_threads, static int init_query(const mca_base_component_t *m, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads) { int ret; - opal_output_verbose(10, mca_fs_base_output, + opal_output_verbose(10, ompi_fs_base_framework.framework_output, "fs:find_available: querying fs component %s", m->mca_component_name); @@ -127,11 +88,11 @@ static int init_query(const mca_base_component_t *m, if (2 == m->mca_type_major_version && 0 == m->mca_type_minor_version && 0 == m->mca_type_release_version) { - ret = init_query_2_0_0(m, entry, enable_progress_threads, + ret = init_query_2_0_0(m, enable_progress_threads, enable_mpi_threads); } else { /* unrecognised API version */ - opal_output_verbose(10, mca_fs_base_output, + opal_output_verbose(10, ompi_fs_base_framework.framework_output, "fs:find_available:unrecognised fs API version (%d.%d.%d)", m->mca_type_major_version, m->mca_type_minor_version, @@ -141,14 +102,11 @@ static int init_query(const mca_base_component_t *m, /* Query done -- look at return value to see what happened */ if (OMPI_SUCCESS != ret) { - opal_output_verbose(10, mca_fs_base_output, + opal_output_verbose(10, ompi_fs_base_framework.framework_output, "fs:find_available fs component %s is not available", m->mca_component_name); - if (NULL != m->mca_close_component) { - m->mca_close_component(); - } } else { - opal_output_verbose(10, mca_fs_base_output, + opal_output_verbose(10, ompi_fs_base_framework.framework_output, "fs:find_avalable: fs component %s is available", m->mca_component_name); @@ -159,7 +117,6 @@ static int init_query(const mca_base_component_t *m, static int init_query_2_0_0(const mca_base_component_t *component, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads) { diff --git a/ompi/mca/allocator/base/allocator_base_close.c b/ompi/mca/fs/base/fs_base_frame.c similarity index 53% rename from ompi/mca/allocator/base/allocator_base_close.c rename to ompi/mca/fs/base/fs_base_frame.c index 7ab6d39795..7f0fae12b2 100644 --- a/ompi/mca/allocator/base/allocator_base_close.c +++ b/ompi/mca/fs/base/fs_base_frame.c @@ -2,13 +2,14 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2011 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2008-2011 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -16,29 +17,18 @@ * $HEADER$ */ + #include "ompi_config.h" -#include +#include "ompi/mca/fs/base/base.h" -#include "ompi/constants.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "ompi/mca/allocator/allocator.h" -#include "ompi/mca/allocator/base/base.h" -/** - * Closes all the remaining modules. - * - * @retval OMPI_SUCCESS +/* + * The following file was created by configure. It contains extern + * statements and the definition of an array of pointers to each + * component's public mca_base_component_t struct. */ -int mca_allocator_base_close(void) -{ - /* Close all remaining available modules (may be one if this is a - OMPI RTE program, or [possibly] multiple if this is ompi_info) */ - - mca_base_components_close(0, &mca_allocator_base_components, NULL); - - /* All done */ - return OMPI_SUCCESS; -} +#include "ompi/mca/fs/base/static-components.h" +MCA_BASE_FRAMEWORK_DECLARE(ompi, fs, NULL, NULL, NULL, NULL, + mca_fs_base_static_components, 0); diff --git a/ompi/mca/fs/base/fs_base_open.c b/ompi/mca/fs/base/fs_base_open.c deleted file mode 100644 index 99c47df66f..0000000000 --- a/ompi/mca/fs/base/fs_base_open.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2011 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "ompi_config.h" -#include - -#include "ompi/class/ompi_free_list.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" - -#include "ompi/mca/fs/fs.h" -#include "ompi/mca/fs/base/base.h" - - -/* - * The following file was created by configure. It contains extern - * statements and the definition of an array of pointers to each - * component's public mca_base_component_t struct. - */ -#include "ompi/mca/fs/base/static-components.h" - -/* - * Global variables; most of which are loaded by back-ends of MCA - * variables - */ -int mca_fs_base_param = -1; -int mca_fs_base_output = -1; - -opal_list_t mca_fs_base_components_opened; -opal_list_t mca_fs_base_components_available; - -bool mca_fs_base_components_available_valid = false; -bool mca_fs_base_components_opened_valid = false; - -mca_fs_base_component_t mca_fs_base_selected_component; -mca_fs_base_module_t mca_fs; - -/* - * Function for finding and opening either all MCA components, or the one - * that was specifically requested via a MCA parameter. - */ -int mca_fs_base_open(void) -{ - /* Open an output stream for this framework */ - - mca_fs_base_output = opal_output_open(NULL); - - /* Open up all available components */ - - if (OMPI_SUCCESS != - mca_base_components_open("fs", mca_fs_base_output, - mca_fs_base_static_components, - &mca_fs_base_components_opened, true)) { - return OMPI_ERROR; - } - mca_fs_base_components_opened_valid = true; - - /* Find the index of the MCA "fs" param for selection */ - - mca_fs_base_param = mca_base_var_find("ompi", "fs", NULL, NULL); - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/io/base/Makefile.am b/ompi/mca/io/base/Makefile.am index 0e8f0ab051..260ce4f0ac 100644 --- a/ompi/mca/io/base/Makefile.am +++ b/ompi/mca/io/base/Makefile.am @@ -21,10 +21,9 @@ headers += \ base/io_base_request.h libmca_io_la_SOURCES += \ - base/io_base_close.c \ + base/io_base_frame.c \ base/io_base_delete.c \ base/io_base_file_select.c \ base/io_base_find_available.c \ - base/io_base_open.c \ base/io_base_request.c \ base/io_base_register_datarep.c diff --git a/ompi/mca/io/base/base.h b/ompi/mca/io/base/base.h index ac6d30943c..33ae5374f8 100644 --- a/ompi/mca/io/base/base.h +++ b/ompi/mca/io/base/base.h @@ -30,7 +30,7 @@ #include "mpi.h" #include "opal/class/opal_list.h" -#include "ompi/class/ompi_free_list.h" +#include "opal/mca/base/base.h" #include "ompi/mca/io/io.h" @@ -39,28 +39,6 @@ */ BEGIN_C_DECLS - /** - * Initialize the io MCA framework - * - * @retval OMPI_SUCCESS Upon success - * @retval OMPI_ERROR Upon failure - * - * This must be the first function invoked in the io MCA - * framework. It initializes the io MCA framework, finds and - * opens io components, etc. - * - * This function is invoked during ompi_mpi_init() and during the - * initialization of the special case of the laminfo command. - * - * This function fills in the internal global variable - * mca_io_base_components_opened, which is a list of all io components - * that were successfully opened. This variable should \em only be - * used by other io base functions -- it is not considered a - * public interface member -- and is only mentioned here for - * completeness. - */ - OMPI_DECLSPEC int mca_io_base_open(void); - /** * Create list of available io components. * @@ -179,19 +157,6 @@ BEGIN_C_DECLS OMPI_DECLSPEC int mca_io_base_delete(char *filename, struct ompi_info_t *info); - /** - * Shut down the io MCA framework. - * - * @retval OMPI_SUCCESS Always - * - * This function shuts down everything in the io MCA framework, - * and is called during ompi_mpi_finalize() and the special case of - * the laminfo fileand. - * - * It must be the last function invoked on the io MCA framework. - */ - OMPI_DECLSPEC int mca_io_base_close(void); - OMPI_DECLSPEC int mca_io_base_register_datarep(char *, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, @@ -202,39 +167,7 @@ BEGIN_C_DECLS * Globals */ -/** - * Index number from the "io" MCA parameter, created when the io - * framework is initialized and used during scope selection. - */ -OMPI_DECLSPEC extern int mca_io_base_param; -/** - * io framework debugging stream ID used with opal_output() and - * opal_output_verbose(). - */ -OMPI_DECLSPEC extern int mca_io_base_output; - -/** - * Indicator as to whether the list of opened io components is valid or - * not. - */ -OMPI_DECLSPEC extern bool mca_io_base_components_opened_valid; -/** - * List of all opened components; created when the io framework is - * initialized and destroyed when we reduce the list to all available - * io components. - */ -OMPI_DECLSPEC extern opal_list_t mca_io_base_components_opened; -/** - * Indicator as to whether the list of available io components is valid - * or not. - */ -OMPI_DECLSPEC extern bool mca_io_base_components_available_valid; -/** - * List of all available components; created by reducing the list of open - * components to all those who indicate that they may run during this - * process. - */ -OMPI_DECLSPEC extern opal_list_t mca_io_base_components_available; +OMPI_DECLSPEC extern mca_base_framework_t ompi_io_base_framework; END_C_DECLS #endif /* MCA_BASE_IO_H */ diff --git a/ompi/mca/io/base/io_base_close.c b/ompi/mca/io/base/io_base_close.c deleted file mode 100644 index 4256b9b09c..0000000000 --- a/ompi/mca/io/base/io_base_close.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include - -#include "ompi/constants.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "ompi/mca/io/io.h" -#include "ompi/mca/io/base/base.h" -#include "ompi/mca/io/base/io_base_request.h" - - -int mca_io_base_close(void) -{ - /* Close all components that are still open. This may be the opened - list (if we're in ompi_info), or it may be the available list (if - we're anywhere else). */ - - if (mca_io_base_components_opened_valid) { - mca_base_components_close(mca_io_base_output, - &mca_io_base_components_opened, NULL); - OBJ_DESTRUCT(&mca_io_base_components_opened); - mca_io_base_components_opened_valid = false; - } else if (mca_io_base_components_available_valid) { - mca_base_components_close(mca_io_base_output, - &mca_io_base_components_available, NULL); - OBJ_DESTRUCT(&mca_io_base_components_available); - mca_io_base_components_available_valid = false; - } - - /* Close the framework output */ - opal_output_close (mca_io_base_output); - mca_io_base_output = -1; - - /* All done */ - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/io/base/io_base_delete.c b/ompi/mca/io/base/io_base_delete.c index ec175b0af1..cf9e3e46ac 100644 --- a/ompi/mca/io/base/io_base_delete.c +++ b/ompi/mca/io/base/io_base_delete.c @@ -75,26 +75,20 @@ static OBJ_CLASS_INSTANCE(avail_io_t, opal_list_item_t, NULL, NULL); */ int mca_io_base_delete(char *filename, struct ompi_info_t *info) { - int err, num_names; - char **name_array; + int err; opal_list_t *selectable; opal_list_item_t *item; avail_io_t *avail, selected; - const char **names_value, *names; /* Announce */ - opal_output_verbose(10, mca_io_base_output, + opal_output_verbose(10, ompi_io_base_framework.framework_output, "io:base:delete: deleting file: %s", filename); /* See if a set of component was requested by the MCA parameter. Don't check for error. */ - names_value = NULL; - (void) mca_base_var_get_value(mca_io_base_param, &names_value, NULL, NULL); - names = names_value ? names_value[0] : NULL; - /* Compute the intersection of all of my available components with the components from all the other processes in this file */ @@ -104,27 +98,10 @@ int mca_io_base_delete(char *filename, struct ompi_info_t *info) and check them all */ err = OMPI_ERROR; - if (NULL != names && 0 < strlen(names)) { - name_array = opal_argv_split(names, ','); - num_names = opal_argv_count(name_array); - - opal_output_verbose(10, mca_io_base_output, - "io:base:delete: Checking specific modules: %s", - names); - selectable = check_components(&mca_io_base_components_available, - filename, info, name_array, num_names); - opal_argv_free(name_array); - } - - /* Nope -- a specific [set of] component[s] was not requested. Go - check them all. */ - - else { - opal_output_verbose(10, mca_io_base_output, - "io:base:delete: Checking all available modules"); - selectable = check_components(&mca_io_base_components_available, - filename, info, NULL, 0); - } + opal_output_verbose(10, ompi_io_base_framework.framework_output, + "io:base:delete: Checking all available modules"); + selectable = check_components(&ompi_io_base_framework.framework_components, + filename, info, NULL, 0); /* Upon return from the above, the modules list will contain the list of modules that returned (priority >= 0). If we have no @@ -169,7 +146,7 @@ int mca_io_base_delete(char *filename, struct ompi_info_t *info) /* Announce the winner */ - opal_output_verbose(10, mca_io_base_output, + opal_output_verbose(10, ompi_io_base_framework.framework_output, "io:base:delete: Selected io component %s", selected.ai_component.v2_0_0.io_version.mca_component_name); @@ -177,6 +154,22 @@ int mca_io_base_delete(char *filename, struct ompi_info_t *info) } +static int avail_io_compare (opal_list_item_t **itema, + opal_list_item_t **itemb) +{ + const avail_io_t *availa = (const avail_io_t *) *itema; + const avail_io_t *availb = (const avail_io_t *) *itemb; + + /* highest component last */ + if (availa->ai_priority > availb->ai_priority) { + return 1; + } else if (availa->ai_priority < availb->ai_priority) { + return -1; + } else { + return 0; + } +} + /* * For each module in the list, if it is in the list of names (or the * list of names is NULL), then check and see if it wants to run, and @@ -190,10 +183,10 @@ static opal_list_t *check_components(opal_list_t *components, { int i; const mca_base_component_t *component; - opal_list_item_t *item, *item2; + mca_base_component_list_item_t *cli; bool want_to_check; opal_list_t *selectable; - avail_io_t *avail, *avail2; + avail_io_t *avail; /* Make a list of the components that query successfully */ @@ -202,12 +195,9 @@ static opal_list_t *check_components(opal_list_t *components, /* Scan through the list of components. This nested loop is O(N^2), but we should never have too many components and/or names, so this *hopefully* shouldn't matter... */ - - for (item = opal_list_get_first(components); - item != opal_list_get_end(components); - item = opal_list_get_next(item)) { - component = ((mca_base_component_priority_list_item_t *) - item)->super.cli_component; + + OPAL_LIST_FOREACH(cli, components, mca_base_component_list_item_t) { + component = cli->cli_component; /* If we have a list of names, scan through it */ @@ -232,49 +222,8 @@ static opal_list_t *check_components(opal_list_t *components, /* Put this item on the list in priority order (highest priority first). Should it go first? */ /* MSC actually put it Lowest priority first */ - - for(item2 = opal_list_get_first(selectable); - item2 != opal_list_get_end(selectable); - item2 = opal_list_get_next(item2)) { - avail2 = (avail_io_t*)item2; - if(avail->ai_priority < avail2->ai_priority) { - opal_list_insert_pos(selectable, - item2, (opal_list_item_t*)avail); - break; - } - } - - if(opal_list_get_end(selectable) == item2) { - opal_list_append(selectable, (opal_list_item_t*)avail); - } - - /* - item2 = opal_list_get_first(selectable); - avail2 = (avail_io_t *) item2; - if (opal_list_get_end(selectable) == item2 || - avail->ai_priority > avail2->ai_priority) { - opal_list_prepend(selectable, (opal_list_item_t*) avail); - } else { - for (i = 1; item2 != opal_list_get_end(selectable); - item2 = opal_list_get_next(selectable), ++i) { - avail2 = (avail_io_t *) item2; - if (avail->ai_priority > avail2->ai_priority) { - opal_list_insert(selectable, - (opal_list_item_t *) avail, i); - break; - } - } - */ - /* If we didn't find a place to put it in the - list, then append it (because it has the lowest - priority found so far) */ - /* - if (opal_list_get_end(selectable) == item2) { - opal_list_append(selectable, - (opal_list_item_t *) avail); - } - } - */ + /* NTH sort this out later */ + opal_list_append(selectable, (opal_list_item_t*)avail); } } } @@ -286,6 +235,8 @@ static opal_list_t *check_components(opal_list_t *components, return NULL; } + opal_list_sort(selectable, avail_io_compare); + /* All done */ return selectable; @@ -306,12 +257,12 @@ static avail_io_t *check_one_component(const mca_base_component_t *component, avail->ai_priority : 100; avail->ai_priority = (avail->ai_priority < 0) ? 0 : avail->ai_priority; - opal_output_verbose(10, mca_io_base_output, + opal_output_verbose(10, ompi_io_base_framework.framework_output, "io:base:delete: component available: %s, priority: %d", component->mca_component_name, avail->ai_priority); } else { - opal_output_verbose(10, mca_io_base_output, + opal_output_verbose(10, ompi_io_base_framework.framework_output, "io:base:delete: component not available: %s", component->mca_component_name); } diff --git a/ompi/mca/io/base/io_base_file_select.c b/ompi/mca/io/base/io_base_file_select.c index 16eed135e4..50ad2f80ad 100644 --- a/ompi/mca/io/base/io_base_file_select.c +++ b/ompi/mca/io/base/io_base_file_select.c @@ -92,9 +92,7 @@ static OBJ_CLASS_INSTANCE(avail_io_t, opal_list_item_t, NULL, NULL); int mca_io_base_file_select(ompi_file_t *file, mca_base_component_t *preferred) { - const char **names_value, *names; - int err, num_names; - char **name_array; + int err; char *str; opal_list_t *selectable; opal_list_item_t *item; @@ -102,7 +100,7 @@ int mca_io_base_file_select(ompi_file_t *file, /* Announce */ - opal_output_verbose(10, mca_io_base_output, + opal_output_verbose(10, ompi_io_base_framework.framework_output, "io:base:file_select: new file: %s", file->f_filename); @@ -111,13 +109,6 @@ int mca_io_base_file_select(ompi_file_t *file, file->f_io_version = MCA_IO_BASE_V_NONE; file->f_io_selected_data = NULL; - - /* See if a set of component was requested by the MCA parameter. - Don't check for error. */ - - names_value = NULL; - mca_base_var_get_value(mca_io_base_param, &names_value, NULL, NULL); - names = names_value ? names_value[0] : NULL; /* Compute the intersection of all of my available components with the components from all the other processes in this file */ @@ -132,10 +123,10 @@ int mca_io_base_file_select(ompi_file_t *file, if (NULL != preferred) { str = &(preferred->mca_component_name[0]); - opal_output_verbose(10, mca_io_base_output, + opal_output_verbose(10, ompi_io_base_framework.framework_output, "io:base:file_select: Checking preferred module: %s", str); - selectable = check_components(&mca_io_base_components_available, + selectable = check_components(&ompi_io_base_framework.framework_components, file, &str, 1); /* If we didn't get a preferred module, then call again @@ -150,28 +141,13 @@ int mca_io_base_file_select(ompi_file_t *file, the preferred modules */ } - /* If there was no preferred module, then see if there were any - listed in the MCA parameter; parse them and check them all */ - - else if (NULL != names && 0 < strlen(names)) { - name_array = opal_argv_split(names, ','); - num_names = opal_argv_count(name_array); - - opal_output_verbose(10, mca_io_base_output, - "io:base:file_select: Checking specific modules: %s", - names); - selectable = check_components(&mca_io_base_components_available, - file, name_array, num_names); - opal_argv_free(name_array); - } - /* Nope -- a specific [set of] component[s] was not requested. Go check them all. */ else { - opal_output_verbose(10, mca_io_base_output, + opal_output_verbose(10, ompi_io_base_framework.framework_output, "io:base:file_select: Checking all available modules"); - selectable = check_components(&mca_io_base_components_available, + selectable = check_components(&ompi_io_base_framework.framework_components, file, NULL, 0); } @@ -223,16 +199,16 @@ int mca_io_base_file_select(ompi_file_t *file, "ompio")) { int ret; - if (OMPI_SUCCESS != (ret = mca_fs_base_open())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_fs_base_framework, 0))) { return err; } - if (OMPI_SUCCESS != (ret = mca_fcoll_base_open())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_fcoll_base_framework, 0))) { return err; } - if (OMPI_SUCCESS != (ret = mca_fbtl_base_open())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_fbtl_base_framework, 0))) { return err; } - if (OMPI_SUCCESS != (ret = mca_sharedfp_base_open())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_sharedfp_base_framework, 0))) { return err; } @@ -265,13 +241,28 @@ int mca_io_base_file_select(ompi_file_t *file, /* Announce the winner */ - opal_output_verbose(10, mca_io_base_output, + opal_output_verbose(10, ompi_io_base_framework.framework_output, "io:base:file_select: Selected io module %s", selected.ai_component.v2_0_0.io_version.mca_component_name); return OMPI_SUCCESS; } +static int avail_io_compare (opal_list_item_t **itema, + opal_list_item_t **itemb) +{ + const avail_io_t *availa = (const avail_io_t *) *itema; + const avail_io_t *availb = (const avail_io_t *) *itemb; + + /* highest component last */ + if (availa->ai_priority > availb->ai_priority) { + return 1; + } else if (availa->ai_priority < availb->ai_priority) { + return -1; + } else { + return 0; + } +} /* * For each component in the list, if it is in the list of names (or @@ -286,10 +277,10 @@ static opal_list_t *check_components(opal_list_t *components, { int i; const mca_base_component_t *component; - opal_list_item_t *item, *item2; + mca_base_component_list_item_t *cli; bool want_to_check; opal_list_t *selectable; - avail_io_t *avail, *avail2; + avail_io_t *avail; /* Make a list of the components that query successfully */ @@ -299,11 +290,8 @@ static opal_list_t *check_components(opal_list_t *components, O(N^2), but we should never have too many components and/or names, so this *hopefully* shouldn't matter... */ - for (item = opal_list_get_first(components); - item != opal_list_get_end(components); - item = opal_list_get_next(item)) { - component = ((mca_base_component_priority_list_item_t *) - item)->super.cli_component; + OPAL_LIST_FOREACH(cli, components, mca_base_component_list_item_t) { + component = cli->cli_component; /* If we have a list of names, scan through it */ @@ -324,52 +312,11 @@ static opal_list_t *check_components(opal_list_t *components, if (want_to_check) { avail = check_one_component(file, component); if (NULL != avail) { - /* Put this item on the list in priority order (highest priority first). Should it go first? */ /* MSC actually put it Lowest priority first */ - - for(item2 = opal_list_get_first(selectable); - item2 != opal_list_get_end(selectable); - item2 = opal_list_get_next(item2)) { - avail2 = (avail_io_t*)item2; - if(avail->ai_priority < avail2->ai_priority) { - opal_list_insert_pos(selectable, - item2, (opal_list_item_t*)avail); - break; - } - } - - if(opal_list_get_end(selectable) == item2) { - opal_list_append(selectable, (opal_list_item_t*)avail); - } - - /* - item2 = opal_list_get_first(selectable); - avail2 = (avail_io_t *) item2; - if (opal_list_get_end(selectable) == item2 || - avail->ai_priority > avail2->ai_priority) { - opal_list_prepend(selectable, (opal_list_item_t*) avail); - } else { - for (i = 1; item2 != opal_list_get_end(selectable); - item2 = opal_list_get_next(selectable), ++i) { - avail2 = (avail_io_t *) item2; - if (avail->ai_priority > avail2->ai_priority) { - opal_list_insert(selectable, - (opal_list_item_t *) avail, i); - break; - } - } - */ - /* If we didn't find a place to put it in the - list, then append it (because it has the lowest - priority found so far) */ - /* - if (opal_list_get_end(selectable) == item2) { - opal_list_append(selectable, - (opal_list_item_t *) avail); - } - }*/ + /* NTH sorted later */ + opal_list_append(selectable, (opal_list_item_t*)avail); } } } @@ -381,12 +328,13 @@ static opal_list_t *check_components(opal_list_t *components, return NULL; } + opal_list_sort(selectable, avail_io_compare); + /* All done */ return selectable; } - /* * Check a single component */ @@ -401,12 +349,12 @@ static avail_io_t *check_one_component(ompi_file_t *file, avail->ai_priority : 100; avail->ai_priority = (avail->ai_priority < 0) ? 0 : avail->ai_priority; - opal_output_verbose(10, mca_io_base_output, + opal_output_verbose(10, ompi_io_base_framework.framework_output, "io:base:file_select: component available: %s, priority: %d", component->mca_component_name, avail->ai_priority); } else { - opal_output_verbose(10, mca_io_base_output, + opal_output_verbose(10, ompi_io_base_framework.framework_output, "io:base:file_select: component not available: %s", component->mca_component_name); } diff --git a/ompi/mca/io/base/io_base_find_available.c b/ompi/mca/io/base/io_base_find_available.c index 559466743f..930a4daef9 100644 --- a/ompi/mca/io/base/io_base_find_available.c +++ b/ompi/mca/io/base/io_base_find_available.c @@ -24,11 +24,9 @@ #include "mpi.h" #include "ompi/constants.h" -#include "opal/class/opal_list.h" #include "opal/util/output.h" #include "opal/mca/mca.h" #include "opal/mca/base/base.h" -#include "opal/mca/base/mca_base_component_repository.h" #include "ompi/mca/io/io.h" #include "ompi/mca/io/base/base.h" #include "ompi/mca/io/base/io_base_request.h" @@ -39,11 +37,9 @@ * Private functions */ static int init_query(const mca_base_component_t *ls, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads); static int init_query_2_0_0(const mca_base_component_t *ls, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads); @@ -63,62 +59,30 @@ static int init_query_2_0_0(const mca_base_component_t *ls, int mca_io_base_find_available(bool enable_progress_threads, bool enable_mpi_threads) { - mca_base_component_priority_list_item_t *entry; - opal_list_item_t *p; - const mca_base_component_t *component; - - /* Initialize the list */ - - OBJ_CONSTRUCT(&mca_io_base_components_available, opal_list_t); - mca_io_base_components_available_valid = true; + mca_base_component_list_item_t *cli, *next; /* The list of components that we should check has already been established in mca_io_base_open. */ - for (p = opal_list_remove_first(&mca_io_base_components_opened); - p != NULL; - p = opal_list_remove_first(&mca_io_base_components_opened)) { - component = ((mca_base_component_list_item_t *) p)->cli_component; - + OPAL_LIST_FOREACH_SAFE(cli, next, &ompi_io_base_framework.framework_components, mca_base_component_list_item_t) { + const mca_base_component_t *component = cli->cli_component; + /* Call a subroutine to do the work, because the component may represent different versions of the io MCA. */ - entry = OBJ_NEW(mca_base_component_priority_list_item_t); - entry->super.cli_component = component; - entry->cpli_priority = 0; - if (OMPI_SUCCESS == init_query(component, entry, + if (OMPI_SUCCESS != init_query(component, enable_progress_threads, enable_mpi_threads)) { - /* Save the results in the list. The priority isn't - relevant, because selection is decided at - communicator-constructor time. But we save the thread - arguments (set in the init_query() function) so that - the initial selection algorithm can negotiate the - overall thread level for this process. */ - - opal_list_append(&mca_io_base_components_available, - (opal_list_item_t *) entry); - } else { - /* If the component doesn't want to run, then close it. It's already had its close() method invoked; now close it out of the DSO repository (if it's there). */ - - mca_base_component_repository_release(component); - OBJ_RELEASE(entry); + opal_list_remove_item(&ompi_io_base_framework.framework_components, &cli->super); + mca_base_component_close(component, ompi_io_base_framework.framework_output); + OBJ_RELEASE(cli); } - - /* Free the entry from the "opened" list */ - - OBJ_RELEASE(p); } - /* The opened list is now no longer useful and we can free it */ - - OBJ_DESTRUCT(&mca_io_base_components_opened); - mca_io_base_components_opened_valid = false; - /* All done */ return OMPI_SUCCESS; @@ -130,13 +94,12 @@ int mca_io_base_find_available(bool enable_progress_threads, * some information. If it doesn't, close it. */ static int init_query(const mca_base_component_t *m, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads) { int ret; - opal_output_verbose(10, mca_io_base_output, + opal_output_verbose(10, ompi_io_base_framework.framework_output, "io:find_available: querying io component %s", m->mca_component_name); @@ -146,12 +109,12 @@ static int init_query(const mca_base_component_t *m, if (2 == m->mca_type_major_version && 0 == m->mca_type_minor_version && 0 == m->mca_type_release_version) { - ret = init_query_2_0_0(m, entry, enable_progress_threads, + ret = init_query_2_0_0(m, enable_progress_threads, enable_mpi_threads); } else { /* Unrecognized io API version */ - opal_output_verbose(10, mca_io_base_output, + opal_output_verbose(10, ompi_io_base_framework.framework_output, "io:find_available: unrecognized io API version (%d.%d.%d)", m->mca_type_major_version, m->mca_type_minor_version, @@ -163,14 +126,11 @@ static int init_query(const mca_base_component_t *m, /* Query done -- look at the return value to see what happened */ if (OMPI_SUCCESS != ret) { - opal_output_verbose(10, mca_io_base_output, + opal_output_verbose(10, ompi_io_base_framework.framework_output, "io:find_available: io component %s is not available", m->mca_component_name); - if (NULL != m->mca_close_component) { - m->mca_close_component(); - } } else { - opal_output_verbose(10, mca_io_base_output, + opal_output_verbose(10, ompi_io_base_framework.framework_output, "io:find_available: io component %s is available", m->mca_component_name); } @@ -185,7 +145,6 @@ static int init_query(const mca_base_component_t *m, * Query a specific component, io v2.0.0 */ static int init_query_2_0_0(const mca_base_component_t *component, - mca_base_component_priority_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads) { diff --git a/ompi/mca/io/base/io_base_frame.c b/ompi/mca/io/base/io_base_frame.c new file mode 100644 index 0000000000..173a280eb4 --- /dev/null +++ b/ompi/mca/io/base/io_base_frame.c @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + + +#include "ompi_config.h" + +#include "ompi/mca/io/base/base.h" + + +/* + * The following file was created by configure. It contains extern + * statements and the definition of an array of pointers to each + * component's public mca_base_component_t struct. + */ +#include "ompi/mca/io/base/static-components.h" + +static int mca_io_base_open(mca_base_open_flag_t flags) +{ + int ret; + + if (OPAL_SUCCESS != + (ret = mca_base_framework_components_open(&ompi_io_base_framework, flags))) { + return ret; + } + + return mca_io_base_find_available(OMPI_ENABLE_PROGRESS_THREADS, OMPI_ENABLE_THREAD_MULTIPLE); +} + +MCA_BASE_FRAMEWORK_DECLARE(ompi, io, NULL, mca_io_base_open, NULL, NULL, + mca_io_base_static_components, 0); diff --git a/ompi/mca/io/base/io_base_open.c b/ompi/mca/io/base/io_base_open.c deleted file mode 100644 index b06ee3ec73..0000000000 --- a/ompi/mca/io/base/io_base_open.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "ompi_config.h" -#include - -#include "opal/mca/mca.h" -#include "opal/util/output.h" -#include "opal/mca/base/base.h" - - -#include "ompi/mca/io/io.h" -#include "ompi/mca/io/base/base.h" -#include "ompi/mca/io/base/io_base_request.h" - - -/* - * The following file was created by configure. It contains extern - * statements and the definition of an array of pointers to each - * component's public mca_base_component_t struct. - */ -#ifdef __WINDOWS__ - const mca_base_component_t *mca_io_base_static_components[] = {NULL}; -#else -#include "ompi/mca/io/base/static-components.h" -#endif - -/* - * Global variables; most of which are loaded by back-ends of MCA - * variables - */ -int mca_io_base_param = -1; -int mca_io_base_output = -1; - -bool mca_io_base_components_opened_valid = false; -opal_list_t mca_io_base_components_opened; - -bool mca_io_base_components_available_valid = false; -opal_list_t mca_io_base_components_available; - -/* - * Function for finding and opening either all MCA components, or the one - * that was specifically requested via a MCA parameter. - */ -int mca_io_base_open(void) -{ - /* Open an output stream for this framework */ - - mca_io_base_output = opal_output_open(NULL); - - /* Open up all available components */ - - if (OMPI_SUCCESS != - mca_base_components_open("io", mca_io_base_output, - mca_io_base_static_components, - &mca_io_base_components_opened, true)) { - return OMPI_ERROR; - } - mca_io_base_components_opened_valid = true; - - /* Find the index of the MCA "io" param for selection */ - - mca_io_base_param = mca_base_var_find("ompi", "io", NULL, NULL); - - /* All done */ - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/io/base/io_base_register_datarep.c b/ompi/mca/io/base/io_base_register_datarep.c index 9b0febbd84..7a4df09fbc 100644 --- a/ompi/mca/io/base/io_base_register_datarep.c +++ b/ompi/mca/io/base/io_base_register_datarep.c @@ -33,7 +33,7 @@ mca_io_base_register_datarep(char *datarep, MPI_Datarep_extent_function* extent_fn, void* state) { - opal_list_item_t *p; + mca_base_component_list_item_t *cli; const mca_base_component_t *component; const mca_io_base_component_2_0_0_t *v200; int tmp, ret = OMPI_SUCCESS; @@ -41,11 +41,8 @@ mca_io_base_register_datarep(char *datarep, /* Find the maximum additional number of bytes required by all io components for requests and make that the request size */ - for (p = opal_list_get_first(&mca_io_base_components_available); - p != opal_list_get_end(&mca_io_base_components_available); - p = opal_list_get_next(p)) { - component = ((mca_base_component_priority_list_item_t *) - p)->super.cli_component; + OPAL_LIST_FOREACH(cli, &ompi_io_base_framework.framework_components, mca_base_component_list_item_t) { + component = cli->cli_component; /* Only know how to handle v2.0.0 components for now */ if (component->mca_type_major_version == 2 && diff --git a/ompi/mca/mpool/base/Makefile.am b/ompi/mca/mpool/base/Makefile.am index 4e03794da6..c9f785b5ec 100644 --- a/ompi/mca/mpool/base/Makefile.am +++ b/ompi/mca/mpool/base/Makefile.am @@ -22,8 +22,7 @@ headers += \ base/mpool_base_mem_cb.h \ base/mpool_base_tree.h libmca_mpool_la_SOURCES += \ - base/mpool_base_open.c \ - base/mpool_base_close.c \ + base/mpool_base_frame.c \ base/mpool_base_init.c \ base/mpool_base_lookup.c \ base/mpool_base_alloc.c \ diff --git a/ompi/mca/mpool/base/base.h b/ompi/mca/mpool/base/base.h index 627c1d263b..853ff6b544 100644 --- a/ompi/mca/mpool/base/base.h +++ b/ompi/mca/mpool/base/base.h @@ -24,8 +24,7 @@ #include "ompi_config.h" -#include "opal/class/opal_list.h" -#include "opal/mca/mca.h" +#include "opal/mca/base/base.h" #include "ompi/mca/mpool/mpool.h" BEGIN_C_DECLS @@ -65,9 +64,7 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_mpool_base_selected_module_t); * Global functions for MCA: overall mpool open and close */ -OMPI_DECLSPEC int mca_mpool_base_open(void); OMPI_DECLSPEC int mca_mpool_base_init(bool enable_progress_threads, bool enable_mpi_threads); -OMPI_DECLSPEC int mca_mpool_base_close(void); OMPI_DECLSPEC mca_mpool_base_component_t* mca_mpool_base_component_lookup(const char* name); OMPI_DECLSPEC mca_mpool_base_module_t* mca_mpool_base_module_create( const char* name, @@ -79,14 +76,14 @@ OMPI_DECLSPEC int mca_mpool_base_module_destroy(mca_mpool_base_module_t *module) /* * Globals */ -OMPI_DECLSPEC extern int mca_mpool_base_output; -OMPI_DECLSPEC extern opal_list_t mca_mpool_base_components; extern opal_list_t mca_mpool_base_modules; OMPI_DECLSPEC extern uint32_t mca_mpool_base_page_size; OMPI_DECLSPEC extern uint32_t mca_mpool_base_page_size_log; /* only used within base -- no need to DECLSPEC */ extern int mca_mpool_base_used_mem_hooks; + +OMPI_DECLSPEC extern mca_base_framework_t ompi_mpool_base_framework; END_C_DECLS diff --git a/ompi/mca/mpool/base/mpool_base_close.c b/ompi/mca/mpool/base/mpool_base_close.c deleted file mode 100644 index 3c4eb774ed..0000000000 --- a/ompi/mca/mpool/base/mpool_base_close.c +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2007 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include - -#include "ompi/constants.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "ompi/mca/mpool/base/base.h" -#include "mpool_base_mem_cb.h" - - -int mca_mpool_base_close(void) -{ - opal_list_item_t *item; - mca_mpool_base_selected_module_t *sm; - int32_t modules_length; - - /* Need the initial length in order to know if some of the initializations - * are done in the open function. - */ - modules_length = opal_list_get_size(&mca_mpool_base_modules); - - /* Finalize all the mpool components and free their list items */ - - for (item = opal_list_remove_first(&mca_mpool_base_modules); - NULL != item; - item = opal_list_remove_first(&mca_mpool_base_modules)) { - sm = (mca_mpool_base_selected_module_t *) item; - - /* Blatently ignore the return code (what would we do to recover, - anyway? This component is going away, so errors don't matter - anymore). Note that it's legal for the module to have NULL for - the finalize function. */ - - if (NULL != sm->mpool_module->mpool_finalize) { - sm->mpool_module->mpool_finalize(sm->mpool_module); - } - OBJ_RELEASE(sm); - } - - /* Close all remaining available components (may be one if this is a - OMPI RTE program, or [possibly] multiple if this is ompi_info) */ - - mca_base_components_close(mca_mpool_base_output, - &mca_mpool_base_components, NULL); - - /* Close the framework output */ - opal_output_close (mca_mpool_base_output); - mca_mpool_base_output = -1; - - /* deregister memory free callback */ - if( (modules_length > 0) && mca_mpool_base_used_mem_hooks && - 0 != (OPAL_MEMORY_FREE_SUPPORT & opal_mem_hooks_support_level())) { - opal_mem_hooks_unregister_release(mca_mpool_base_mem_cb); - } - /* All done */ - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/mpool/base/mpool_base_open.c b/ompi/mca/mpool/base/mpool_base_frame.c similarity index 58% rename from ompi/mca/mpool/base/mpool_base_open.c rename to ompi/mca/mpool/base/mpool_base_frame.c index 2882f705f4..7dd65eb9ee 100644 --- a/ompi/mca/mpool/base/mpool_base_open.c +++ b/ompi/mca/mpool/base/mpool_base_frame.c @@ -33,6 +33,7 @@ #include "opal/mca/base/base.h" #include "opal/memoryhooks/memory.h" #include "ompi/mca/mpool/base/base.h" +#include "mpool_base_mem_cb.h" #include "ompi/constants.h" /* @@ -46,7 +47,6 @@ /* * Global variables */ -int mca_mpool_base_output = -1; /* whether we actually used the mem hooks or not */ int mca_mpool_base_used_mem_hooks = 0; @@ -54,43 +54,18 @@ int mca_mpool_base_used_mem_hooks = 0; uint32_t mca_mpool_base_page_size; uint32_t mca_mpool_base_page_size_log; -opal_list_t mca_mpool_base_components; opal_list_t mca_mpool_base_modules; -static int ompi_mpool_base_verbose = 0; - -static int mca_mpool_base_register(int flags) -{ - /* Verbose output */ - ompi_mpool_base_verbose = 0; - mca_base_var_register("ompi", "mpool", "base", "verbose", - "Verbosity level for the mpool framework (0 = no verbosity)", - MCA_BASE_VAR_TYPE_INT, NULL, 0, - MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_LOCAL, - &ompi_mpool_base_verbose); - - return OMPI_SUCCESS; -} - /** * Function for finding and opening either all MCA components, or the one * that was specifically requested via a MCA parameter. */ -int mca_mpool_base_open(void) +static int mca_mpool_base_open(mca_base_open_flag_t flags) { /* Open up all available components - and populate the - mca_mpool_base_components list */ - - (void) mca_mpool_base_register(0); - - mca_mpool_base_output = opal_output_open(NULL); - opal_output_set_verbosity(mca_mpool_base_output, ompi_mpool_base_verbose); - + ompi_mpool_base_framework.framework_components list */ if (OMPI_SUCCESS != - mca_base_components_open("mpool", mca_mpool_base_output, mca_mpool_base_static_components, - &mca_mpool_base_components, true)) { + mca_base_framework_components_open(&ompi_mpool_base_framework, flags)) { return OMPI_ERROR; } @@ -109,3 +84,46 @@ int mca_mpool_base_open(void) return OMPI_SUCCESS; } +static int mca_mpool_base_close(void) +{ + opal_list_item_t *item; + mca_mpool_base_selected_module_t *sm; + int32_t modules_length; + + /* Need the initial length in order to know if some of the initializations + * are done in the open function. + */ + modules_length = opal_list_get_size(&mca_mpool_base_modules); + + /* Finalize all the mpool components and free their list items */ + + while(NULL != (item = opal_list_remove_first(&mca_mpool_base_modules))) { + sm = (mca_mpool_base_selected_module_t *) item; + + /* Blatently ignore the return code (what would we do to recover, + anyway? This component is going away, so errors don't matter + anymore). Note that it's legal for the module to have NULL for + the finalize function. */ + + if (NULL != sm->mpool_module->mpool_finalize) { + sm->mpool_module->mpool_finalize(sm->mpool_module); + } + OBJ_RELEASE(sm); + } + + /* Close all remaining available components (may be one if this is a + OMPI RTE program, or [possibly] multiple if this is ompi_info) */ + (void) mca_base_framework_components_close(&ompi_mpool_base_framework, NULL); + + /* deregister memory free callback */ + if( (modules_length > 0) && mca_mpool_base_used_mem_hooks && + 0 != (OPAL_MEMORY_FREE_SUPPORT & opal_mem_hooks_support_level())) { + opal_mem_hooks_unregister_release(mca_mpool_base_mem_cb); + } + /* All done */ + + return OMPI_SUCCESS; +} + +MCA_BASE_FRAMEWORK_DECLARE(ompi, mpool, NULL, NULL, mca_mpool_base_open, + mca_mpool_base_close, mca_mpool_base_static_components, 0); diff --git a/ompi/mca/mpool/base/mpool_base_lookup.c b/ompi/mca/mpool/base/mpool_base_lookup.c index 3c67eb1f80..c0e31b28fd 100644 --- a/ompi/mca/mpool/base/mpool_base_lookup.c +++ b/ompi/mca/mpool/base/mpool_base_lookup.c @@ -38,6 +38,7 @@ #include "ompi/mca/mpool/mpool.h" #include "ompi/mca/mpool/base/base.h" +#include "opal/memoryhooks/memory.h" #include "mpool_base_mem_cb.h" @@ -45,8 +46,8 @@ mca_mpool_base_component_t* mca_mpool_base_component_lookup(const char* name) { /* Traverse the list of available modules; call their init functions. */ opal_list_item_t* item; - for (item = opal_list_get_first(&mca_mpool_base_components); - item != opal_list_get_end(&mca_mpool_base_components); + for (item = opal_list_get_first(&ompi_mpool_base_framework.framework_components); + item != opal_list_get_end(&ompi_mpool_base_framework.framework_components); item = opal_list_get_next(item)) { mca_base_component_list_item_t *cli = (mca_base_component_list_item_t *) item; @@ -70,8 +71,8 @@ mca_mpool_base_module_t* mca_mpool_base_module_create( opal_list_item_t* item; mca_mpool_base_selected_module_t *sm; - for (item = opal_list_get_first(&mca_mpool_base_components); - item != opal_list_get_end(&mca_mpool_base_components); + for (item = opal_list_get_first(&ompi_mpool_base_framework.framework_components); + item != opal_list_get_end(&ompi_mpool_base_framework.framework_components); item = opal_list_get_next(item)) { mca_base_component_list_item_t *cli = (mca_base_component_list_item_t *) item; @@ -82,7 +83,7 @@ mca_mpool_base_module_t* mca_mpool_base_module_create( } } - if (opal_list_get_end(&mca_mpool_base_components) == item) { + if (opal_list_get_end(&ompi_mpool_base_framework.framework_components) == item) { return NULL; } module = component->mpool_init(resources); diff --git a/ompi/mca/mpool/base/mpool_base_mem_cb.c b/ompi/mca/mpool/base/mpool_base_mem_cb.c index be19d12479..83c35dc452 100644 --- a/ompi/mca/mpool/base/mpool_base_mem_cb.c +++ b/ompi/mca/mpool/base/mpool_base_mem_cb.c @@ -35,6 +35,8 @@ #include "ompi/mca/mpool/base/mpool_base_mem_cb.h" #include "ompi/mca/mpool/base/base.h" +#include "opal/mca/mca.h" +#include "opal/memoryhooks/memory.h" static char msg[512]; diff --git a/ompi/mca/mpool/base/mpool_base_mem_cb.h b/ompi/mca/mpool/base/mpool_base_mem_cb.h index 4b94b2d158..09a010293d 100644 --- a/ompi/mca/mpool/base/mpool_base_mem_cb.h +++ b/ompi/mca/mpool/base/mpool_base_mem_cb.h @@ -23,9 +23,6 @@ #include "ompi_config.h" -#include "opal/mca/mca.h" -#include "opal/memoryhooks/memory.h" - BEGIN_C_DECLS /* diff --git a/ompi/mca/mpool/sm/mpool_sm_component.c b/ompi/mca/mpool/sm/mpool_sm_component.c index d9ee331397..dacf28635c 100644 --- a/ompi/mca/mpool/sm/mpool_sm_component.c +++ b/ompi/mca/mpool/sm/mpool_sm_component.c @@ -175,10 +175,10 @@ mca_mpool_sm_init(struct mca_mpool_base_resources_t *resources) /* if specified allocator cannot be loaded - look for an alternative */ if (NULL == allocator_component) { - if (opal_list_get_size(&mca_allocator_base_components) == 0) { + if (opal_list_get_size(&ompi_allocator_base_framework.framework_components) == 0) { mca_base_component_list_item_t *item = (mca_base_component_list_item_t *) - opal_list_get_first(&mca_allocator_base_components); + opal_list_get_first(&ompi_allocator_base_framework.framework_components); allocator_component = (mca_allocator_base_component_t *)item->cli_component; opal_output( diff --git a/ompi/mca/mtl/base/Makefile.am b/ompi/mca/mtl/base/Makefile.am index 5af59379d1..73bfda0c6c 100644 --- a/ompi/mca/mtl/base/Makefile.am +++ b/ompi/mca/mtl/base/Makefile.am @@ -21,4 +21,4 @@ headers += \ base/mtl_base_datatype.h libmca_mtl_la_SOURCES += \ - base/mtl_base_component.c + base/mtl_base_frame.c diff --git a/ompi/mca/mtl/base/base.h b/ompi/mca/mtl/base/base.h index c2b7e461fc..56c39e0b3b 100644 --- a/ompi/mca/mtl/base/base.h +++ b/ompi/mca/mtl/base/base.h @@ -33,14 +33,10 @@ BEGIN_C_DECLS OMPI_DECLSPEC extern mca_mtl_base_component_t* ompi_mtl_base_selected_component; -OMPI_DECLSPEC int ompi_mtl_base_open(void); OMPI_DECLSPEC int ompi_mtl_base_select(bool enable_progress_threads, bool enable_mpi_threads); -OMPI_DECLSPEC int ompi_mtl_base_close(void); - -OMPI_DECLSPEC extern opal_list_t ompi_mtl_base_components_opened; -OMPI_DECLSPEC extern int ompi_mtl_base_output; +OMPI_DECLSPEC extern mca_base_framework_t ompi_mtl_base_framework; END_C_DECLS #endif /* MCA_MTL_BASE_H */ diff --git a/ompi/mca/mtl/base/mtl_base_component.c b/ompi/mca/mtl/base/mtl_base_frame.c similarity index 67% rename from ompi/mca/mtl/base/mtl_base_component.c rename to ompi/mca/mtl/base/mtl_base_frame.c index 0fbecaa994..1d15625e71 100644 --- a/ompi/mca/mtl/base/mtl_base_component.c +++ b/ompi/mca/mtl/base/mtl_base_frame.c @@ -35,40 +35,8 @@ #include "ompi/mca/mtl/base/static-components.h" - -int ompi_mtl_base_output = 0; -opal_list_t ompi_mtl_base_components_opened; mca_mtl_base_component_t *ompi_mtl_base_selected_component = NULL; -mca_mtl_base_module_t *ompi_mtl; - - -/* - * Function for finding and opening either all MCA components, or the one - * that was specifically requested via a MCA parameter. - */ -int -ompi_mtl_base_open(void) -{ - /* setup the output stream */ - ompi_mtl_base_output = opal_output_open(NULL); - - /* Open up all available components */ - if (OMPI_SUCCESS != - mca_base_components_open("mtl", ompi_mtl_base_output, - mca_mtl_base_static_components, - &ompi_mtl_base_components_opened, - !MCA_ompi_mtl_DIRECT_CALL)) { - return OMPI_ERROR; - } - - - /* Set a sentinel in case we don't select any components (e.g., - ompi_info) */ - ompi_mtl = NULL; - - return OMPI_SUCCESS; -} - +mca_mtl_base_module_t *ompi_mtl = NULL; /* * Function for selecting one component from all those that are @@ -88,31 +56,31 @@ ompi_mtl_base_select(bool enable_progress_threads, /* Traverse the list of available components; call their init functions. */ - for (item = opal_list_get_first(&ompi_mtl_base_components_opened); - opal_list_get_end(&ompi_mtl_base_components_opened) != item; + for (item = opal_list_get_first(&ompi_mtl_base_framework.framework_components); + opal_list_get_end(&ompi_mtl_base_framework.framework_components) != item; item = opal_list_get_next(item) ) { cli = (mca_base_component_list_item_t *) item; component = (mca_mtl_base_component_t *) cli->cli_component; if (NULL == component->mtl_init) { - opal_output_verbose( 10, ompi_mtl_base_output, + opal_output_verbose( 10, ompi_mtl_base_framework.framework_output, "select: no init function; ignoring component %s", component->mtl_version.mca_component_name ); continue; } - opal_output_verbose( 10, ompi_mtl_base_output, + opal_output_verbose( 10, ompi_mtl_base_framework.framework_output, "select: initializing %s component %s", component->mtl_version.mca_type_name, component->mtl_version.mca_component_name ); module = component->mtl_init(enable_progress_threads, enable_mpi_threads); if (NULL == module) { - opal_output_verbose( 10, ompi_mtl_base_output, + opal_output_verbose( 10, ompi_mtl_base_framework.framework_output, "select: init returned failure for component %s", component->mtl_version.mca_component_name ); continue; } - opal_output_verbose( 10, ompi_mtl_base_output, + opal_output_verbose( 10, ompi_mtl_base_framework.framework_output, "select: init returned success"); ompi_mtl_base_selected_component = component; @@ -122,17 +90,18 @@ ompi_mtl_base_select(bool enable_progress_threads, /* This base function closes, unloads, and removes from the available list all unselected components. The available list will contain only the selected component. */ - mca_base_components_close(ompi_mtl_base_output, - &ompi_mtl_base_components_opened, - (mca_base_component_t *) ompi_mtl_base_selected_component); + if (ompi_mtl_base_selected_component) { + (void) mca_base_framework_components_close(&ompi_mtl_base_framework, + (mca_base_component_t *) ompi_mtl_base_selected_component); + } /* All done */ if (NULL == module) { - opal_output_verbose( 10, ompi_mtl_base_output, + opal_output_verbose( 10, ompi_mtl_base_framework.framework_output, "select: no component selected"); return OMPI_ERR_NOT_FOUND; } else { - opal_output_verbose( 10, ompi_mtl_base_output, + opal_output_verbose( 10, ompi_mtl_base_framework.framework_output, "select: component %s selected", ompi_mtl_base_selected_component-> mtl_version.mca_component_name ); @@ -141,18 +110,16 @@ ompi_mtl_base_select(bool enable_progress_threads, } -int +static int ompi_mtl_base_close(void) { + /* NTH: Should we be freeing the mtl module here? */ + ompi_mtl = NULL; + /* Close all remaining available modules (may be one if this is a OMPI RTE program, or [possibly] multiple if this is ompi_info) */ - mca_base_components_close(ompi_mtl_base_output, - &ompi_mtl_base_components_opened, NULL); - - /* Close the framework output */ - opal_output_close (ompi_mtl_base_output); - ompi_mtl_base_output = -1; - - /* All done */ - return OMPI_SUCCESS; + return mca_base_framework_components_close(&ompi_mtl_base_framework, NULL); } + +MCA_BASE_FRAMEWORK_DECLARE(ompi, mtl, NULL, NULL, NULL, ompi_mtl_base_close, + mca_mtl_base_static_components, 0); diff --git a/ompi/mca/mtl/mx/mtl_mx.c b/ompi/mca/mtl/mx/mtl_mx.c index c3e92f33a0..748d72d9d5 100644 --- a/ompi/mca/mtl/mx/mtl_mx.c +++ b/ompi/mca/mtl/mx/mtl_mx.c @@ -103,7 +103,7 @@ int ompi_mtl_mx_module_init(){ &ompi_mtl_mx.mx_endpoint); if(mx_return != MX_SUCCESS) { - opal_output(ompi_mtl_base_output, "Error in mx_open_endpoint (error %s)\n", mx_strerror(mx_return)); + opal_output(ompi_mtl_base_framework.framework_output, "Error in mx_open_endpoint (error %s)\n", mx_strerror(mx_return)); return OMPI_ERROR; } @@ -112,7 +112,7 @@ int ompi_mtl_mx_module_init(){ &ompi_mtl_mx.mx_endpoint_addr); if(mx_return != MX_SUCCESS) { - opal_output(ompi_mtl_base_output, "Error in mx_get_endpoint_addr (error %s)\n", mx_strerror(mx_return)); + opal_output(ompi_mtl_base_framework.framework_output, "Error in mx_get_endpoint_addr (error %s)\n", mx_strerror(mx_return)); return OMPI_ERROR; } @@ -120,10 +120,10 @@ int ompi_mtl_mx_module_init(){ &(ompi_mtl_mx.mx_addr.endpoint_id) ); if(mx_return != MX_SUCCESS) { - opal_output(ompi_mtl_base_output, "Error in mx_decompose_endpoint_addr (error %s)\n", mx_strerror(mx_return)); + opal_output(ompi_mtl_base_framework.framework_output, "Error in mx_decompose_endpoint_addr (error %s)\n", mx_strerror(mx_return)); return OMPI_ERROR; } - opal_output_verbose(10, ompi_mtl_base_output, + opal_output_verbose(10, ompi_mtl_base_framework.framework_output, "mtl:mx: local nic %d, endpoint %d, got nic %d, ep %d\n", nic, ep, (int)ompi_mtl_mx.mx_addr.nic_id, ompi_mtl_mx.mx_addr.endpoint_id); @@ -147,7 +147,7 @@ ompi_mtl_mx_finalize(struct mca_mtl_base_module_t* mtl) { /* free resources */ mx_return = mx_close_endpoint(ompi_mtl_mx.mx_endpoint); if(mx_return != MX_SUCCESS){ - opal_output(ompi_mtl_base_output, "Error in mx_close_endpoint (error %s)\n", mx_strerror(mx_return)); + opal_output(ompi_mtl_base_framework.framework_output, "Error in mx_close_endpoint (error %s)\n", mx_strerror(mx_return)); return OMPI_ERROR; } @@ -227,7 +227,7 @@ int ompi_mtl_mx_progress( void ) { &result); if( OPAL_UNLIKELY(mx_return != MX_SUCCESS) ) { - opal_output(ompi_mtl_base_output, "Error in mx_ipeek (error %s)\n", mx_strerror(mx_return)); + opal_output(ompi_mtl_base_framework.framework_output, "Error in mx_ipeek (error %s)\n", mx_strerror(mx_return)); } if(result) { completed++; @@ -236,11 +236,11 @@ int ompi_mtl_mx_progress( void ) { &mx_status, &result); if( OPAL_UNLIKELY(mx_return != MX_SUCCESS) ) { - opal_output(ompi_mtl_base_output, "Error in mx_test (error %s)\n", mx_strerror(mx_return)); + opal_output(ompi_mtl_base_framework.framework_output, "Error in mx_test (error %s)\n", mx_strerror(mx_return)); abort(); } if( OPAL_UNLIKELY(0 == result) ) { - opal_output(ompi_mtl_base_output, "Error in ompi_mtl_mx_progress, mx_ipeek returned a request, mx_test on the request resulted failure.\n"); + opal_output(ompi_mtl_base_framework.framework_output, "Error in ompi_mtl_mx_progress, mx_ipeek returned a request, mx_test on the request resulted failure.\n"); abort(); } mtl_mx_request = (mca_mtl_mx_request_t*) mx_status.context; diff --git a/ompi/mca/mtl/mx/mtl_mx_endpoint.c b/ompi/mca/mtl/mx/mtl_mx_endpoint.c index 440e5a78ff..ae1c794ef9 100644 --- a/ompi/mca/mtl/mx/mtl_mx_endpoint.c +++ b/ompi/mca/mtl/mx/mtl_mx_endpoint.c @@ -93,7 +93,7 @@ mca_mtl_mx_endpoint_t* mca_mtl_mx_endpoint_create(ompi_proc_t* ompi_proc) { if(MX_SUCCESS != mx_nic_id_to_hostname( mx_peer->nic_id, peer_name)) { sprintf( peer_name, "unknown %lx nic_id", (long)mx_peer->nic_id ); } - opal_output(ompi_mtl_base_output, + opal_output(ompi_mtl_base_framework.framework_output, "mx_connect fail for %s with key %x (error %s)\n", peer_name, ompi_mtl_mx.mx_filter, mx_strerror(mx_return) ); return NULL; diff --git a/ompi/mca/mtl/mx/mtl_mx_probe.c b/ompi/mca/mtl/mx/mtl_mx_probe.c index 91fa200fb7..af30f3451b 100644 --- a/ompi/mca/mtl/mx/mtl_mx_probe.c +++ b/ompi/mca/mtl/mx/mtl_mx_probe.c @@ -54,7 +54,7 @@ ompi_mtl_mx_iprobe(struct mca_mtl_base_module_t* mtl, &mx_status, &result); if (MX_SUCCESS != ret) { - opal_output(ompi_mtl_base_output, "Error in mx_iprobe (error %s)\n", mx_strerror(ret)); + opal_output(ompi_mtl_base_framework.framework_output, "Error in mx_iprobe (error %s)\n", mx_strerror(ret)); return OMPI_ERROR; } diff --git a/ompi/mca/mtl/mx/mtl_mx_recv.c b/ompi/mca/mtl/mx/mtl_mx_recv.c index 2ea44eef6a..1d8e5682ab 100644 --- a/ompi/mca/mtl/mx/mtl_mx_recv.c +++ b/ompi/mca/mtl/mx/mtl_mx_recv.c @@ -59,7 +59,7 @@ ompi_mtl_mx_irecv(struct mca_mtl_base_module_t* mtl, src, tag); - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "recv bits: 0x%016" PRIu64 " 0x%016" PRIu64 "\n", match_bits, mask_bits)); @@ -71,7 +71,7 @@ ompi_mtl_mx_irecv(struct mca_mtl_base_module_t* mtl, mtl_mx_request, &mtl_mx_request->mx_request); if(mx_return != MX_SUCCESS) { - opal_output(ompi_mtl_base_output, "Error in mx_irecv (error %s)\n", mx_strerror(mx_return)); + opal_output(ompi_mtl_base_framework.framework_output, "Error in mx_irecv (error %s)\n", mx_strerror(mx_return)); return OMPI_ERROR; } diff --git a/ompi/mca/mtl/mx/mtl_mx_send.c b/ompi/mca/mtl/mx/mtl_mx_send.c index 7e058591b5..a8396dbfd1 100644 --- a/ompi/mca/mtl/mx/mtl_mx_send.c +++ b/ompi/mca/mtl/mx/mtl_mx_send.c @@ -59,7 +59,7 @@ ompi_mtl_mx_send(struct mca_mtl_base_module_t* mtl, mtl_mx_request.convertor = convertor; mtl_mx_request.type = OMPI_MTL_MX_ISEND; - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "issend bits: 0x%016" PRIu64 "\n", match_bits)); @@ -89,7 +89,7 @@ ompi_mtl_mx_send(struct mca_mtl_base_module_t* mtl, if(MX_SUCCESS != mx_nic_id_to_hostname( mx_endpoint->mx_peer->nic_id, peer_name)) { sprintf( peer_name, "unknown %lx nic_id", (long)mx_endpoint->mx_peer->nic_id ); } - opal_output(ompi_mtl_base_output, "Error in %s (error %s) sending to %s\n", + opal_output(ompi_mtl_base_framework.framework_output, "Error in %s (error %s) sending to %s\n", where, mx_strerror(mx_return), peer_name); /* Free buffer if needed */ @@ -105,11 +105,11 @@ ompi_mtl_mx_send(struct mca_mtl_base_module_t* mtl, &mx_status, &result); if( OPAL_UNLIKELY(mx_return != MX_SUCCESS) ) { - opal_output(ompi_mtl_base_output, "Error in mx_wait (error %s)\n", mx_strerror(mx_return)); + opal_output(ompi_mtl_base_framework.framework_output, "Error in mx_wait (error %s)\n", mx_strerror(mx_return)); abort(); } if( OPAL_UNLIKELY(result && mx_status.code != MX_STATUS_SUCCESS) ) { - opal_output(ompi_mtl_base_output, + opal_output(ompi_mtl_base_framework.framework_output, "Error in ompi_mtl_mx_send, mx_wait returned something other than MX_STATUS_SUCCESS: mx_status.code = %d.\n", mx_status.code); abort(); @@ -154,7 +154,7 @@ ompi_mtl_mx_isend(struct mca_mtl_base_module_t* mtl, mtl_mx_request->convertor = convertor; mtl_mx_request->type = OMPI_MTL_MX_ISEND; - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "issend bits: 0x%016" PRIu64 "\n", match_bits)); if(mode == MCA_PML_BASE_SEND_SYNCHRONOUS) { @@ -183,7 +183,7 @@ ompi_mtl_mx_isend(struct mca_mtl_base_module_t* mtl, if(MX_SUCCESS != mx_nic_id_to_hostname( mx_endpoint->mx_peer->nic_id, peer_name)) { sprintf( peer_name, "unknown %lx nic_id", (long)mx_endpoint->mx_peer->nic_id ); } - opal_output(ompi_mtl_base_output, "Error in %s (error %s) sending to %s\n", + opal_output(ompi_mtl_base_framework.framework_output, "Error in %s (error %s) sending to %s\n", where, mx_strerror(mx_return), peer_name); return OMPI_ERROR; } diff --git a/ompi/mca/mtl/portals4/mtl_portals4.c b/ompi/mca/mtl/portals4/mtl_portals4.c index 365758859a..a000214ad2 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4.c +++ b/ompi/mca/mtl/portals4/mtl_portals4.c @@ -76,9 +76,9 @@ ompi_mtl_portals4_add_procs(struct mca_mtl_base_module_t *mtl, } if (procs[i]->proc_arch != ompi_proc_local()->proc_arch) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "Portals 4 MTL does not support heterogeneous operations."); - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "Proc %s architecture %x, mine %x.", OMPI_NAME_PRINT(&procs[i]->proc_name), procs[i]->proc_arch, ompi_proc_local()->proc_arch); @@ -87,7 +87,7 @@ ompi_mtl_portals4_add_procs(struct mca_mtl_base_module_t *mtl, mtl_peer_data[i] = malloc(sizeof(struct mca_mtl_base_endpoint_t)); if (NULL == mtl_peer_data[i]) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: malloc failed: %d\n", __FILE__, __LINE__, ret); return OMPI_ERR_OUT_OF_RESOURCE; @@ -96,12 +96,12 @@ ompi_mtl_portals4_add_procs(struct mca_mtl_base_module_t *mtl, ret = ompi_modex_recv(&mca_mtl_portals4_component.mtl_version, procs[i], (void**) &id, &size); if (OMPI_SUCCESS != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: ompi_modex_recv failed: %d\n", __FILE__, __LINE__, ret); return ret; } else if (sizeof(ptl_process_t) != size) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: ompi_modex_recv failed: %d\n", __FILE__, __LINE__, ret); return OMPI_ERR_BAD_PARAM; @@ -113,7 +113,7 @@ ompi_mtl_portals4_add_procs(struct mca_mtl_base_module_t *mtl, #if OMPI_MTL_PORTALS4_FLOW_CONTROL ret = ompi_mtl_portals4_flowctl_add_procs(me, nprocs, mtl_peer_data); if (OMPI_SUCCESS != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: flowctl_add_procs failed: %d\n", __FILE__, __LINE__, ret); return ret; diff --git a/ompi/mca/mtl/portals4/mtl_portals4_component.c b/ompi/mca/mtl/portals4/mtl_portals4_component.c index ac25d8ab60..d840948b6b 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4_component.c +++ b/ompi/mca/mtl/portals4/mtl_portals4_component.c @@ -64,7 +64,7 @@ mca_mtl_base_component_2_0_0_t mca_mtl_portals4_component = { ompi_mtl_portals4_component_init, /* component init */ }; -static int mca_base_var_enum_value_t long_protocol_values[] = { +static mca_base_var_enum_value_t long_protocol_values[] = { {eager, "eager"}, {rndv, "rndv"}, {0, NULL} @@ -162,7 +162,7 @@ ompi_mtl_portals4_component_register(void) &ompi_mtl_portals4.protocol); OBJ_RELEASE(new_enum); if (OPAL_SUCCESS != ret) { - opal_output(ompi_mtl_base_output, "Unknown protocol"); + opal_output(ompi_mtl_base_framework.framework_output, "Unknown protocol"); return OMPI_ERR_NOT_SUPPORTED; } @@ -172,18 +172,18 @@ ompi_mtl_portals4_component_register(void) static int ompi_mtl_portals4_component_open(void) { - int i; + unsigned int i; uint64_t fixed_md_nb; ompi_mtl_portals4.base.mtl_request_size = sizeof(ompi_mtl_portals4_request_t) - sizeof(struct mca_mtl_request_t); - if (ompi_mtl_portals4_md_size_bit_width < tmp) ompi_mtl_portals4_md_size_bit_width = 48; + if (48 < ompi_mtl_portals4_md_size_bit_width) ompi_mtl_portals4_md_size_bit_width = 48; ompi_mtl_portals4.fixed_md_distance = (unsigned long int) 1< fixed_md_distance) fixed_md_nb = MEMORY_MAX_SIZE/fixed_md_distance; else fixed_md_nb = 1; - opal_output_verbose(1, ompi_mtl_base_output, "Fixed MDs :\n"); + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "Fixed MDs :\n"); /* Bind the fixed MDs */ for (i=0; i> 1)) offset += EXTENDED_ADDR; - opal_output_verbose(1, ompi_mtl_base_output, " %2d: [ %16lx - %16lx ]\n", i, offset, offset + fixed_md_distance - 2); + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, " %2d: [ %16lx - %16lx ]\n", i, offset, offset + fixed_md_distance - 2); md.start = (char *) offset; md.length = fixed_md_distance - 1; @@ -392,14 +392,14 @@ ompi_mtl_portals4_component_init(bool enable_progress_threads, &md, &ompi_mtl_portals4.fixed_md_h[i]); if (PTL_OK != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlMDBind failed: %d\n", __FILE__, __LINE__, ret); goto error; } } } - else opal_output_verbose(1, ompi_mtl_base_output, "No fixed MD\n"); + else opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "No fixed MD\n"); /* Handle long overflows */ me.start = NULL; @@ -424,7 +424,7 @@ ompi_mtl_portals4_component_init(bool enable_progress_threads, NULL, &ompi_mtl_portals4.long_overflow_me_h); if (PTL_OK != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlMEAppend failed: %d\n", __FILE__, __LINE__, ret); goto error; @@ -433,7 +433,7 @@ ompi_mtl_portals4_component_init(bool enable_progress_threads, /* attach short unex recv blocks */ ret = ompi_mtl_portals4_recv_short_init(); if (OMPI_SUCCESS != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: short receive block initialization failed: %d\n", __FILE__, __LINE__, ret); goto error; @@ -447,7 +447,7 @@ ompi_mtl_portals4_component_init(bool enable_progress_threads, #if OMPI_MTL_PORTALS4_FLOW_CONTROL ret = ompi_mtl_portals4_flowctl_init(); if (OMPI_SUCCESS != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: ompi_mtl_portals4_flowctl_init failed: %d\n", __FILE__, __LINE__, ret); goto error; @@ -457,7 +457,7 @@ ompi_mtl_portals4_component_init(bool enable_progress_threads, /* activate progress callback */ ret = opal_progress_register(ompi_mtl_portals4_progress); if (OMPI_SUCCESS != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: opal_progress_register failed: %d\n", __FILE__, __LINE__, ret); goto error; @@ -570,7 +570,7 @@ ompi_mtl_portals4_progress(void) while (true) { ret = PtlEQPoll(ompi_mtl_portals4.eqs_h, 2, 0, &ev, &which); if (PTL_OK == ret) { - OPAL_OUTPUT_VERBOSE((60, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((60, ompi_mtl_base_framework.framework_output, "Found event of type %d\n", ev.type)); count++; switch (ev.type) { @@ -588,7 +588,7 @@ ompi_mtl_portals4_progress(void) ptl_request = ev.user_ptr; ret = ptl_request->event_callback(&ev, ptl_request); if (OMPI_SUCCESS != ret) { - opal_output(ompi_mtl_base_output, + opal_output(ompi_mtl_base_framework.framework_output, "Error returned from target event callback: %d", ret); abort(); } @@ -597,18 +597,18 @@ ompi_mtl_portals4_progress(void) case PTL_EVENT_PT_DISABLED: #if OMPI_MTL_PORTALS4_FLOW_CONTROL - OPAL_OUTPUT_VERBOSE((10, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((10, ompi_mtl_base_framework.framework_output, "Received PT_DISABLED event on pt %d\n", (int) ev.pt_index)); ret = ompi_mtl_portals4_flowctl_trigger(); if (OMPI_SUCCESS != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: flowctl_trigger() failed: %d\n", __FILE__, __LINE__, ret); abort(); } #else - opal_output(ompi_mtl_base_output, + opal_output(ompi_mtl_base_framework.framework_output, "Flow control situation without recovery (PT_DISABLED)"); abort(); #endif @@ -619,18 +619,18 @@ ompi_mtl_portals4_progress(void) case PTL_EVENT_FETCH_ATOMIC_OVERFLOW: case PTL_EVENT_ATOMIC: case PTL_EVENT_ATOMIC_OVERFLOW: - opal_output(ompi_mtl_base_output, + opal_output(ompi_mtl_base_framework.framework_output, "Unexpected event of type %d", ev.type); } } else if (PTL_EQ_EMPTY == ret) { break; } else if (PTL_EQ_DROPPED == ret) { - opal_output(ompi_mtl_base_output, + opal_output(ompi_mtl_base_framework.framework_output, "Flow control situation without recovery (EQ_DROPPED): %d", which); abort(); } else { - opal_output(ompi_mtl_base_output, + opal_output(ompi_mtl_base_framework.framework_output, "Error returned from PtlEQGet: %d", ret); break; } diff --git a/ompi/mca/mtl/portals4/mtl_portals4_flowctl.c b/ompi/mca/mtl/portals4/mtl_portals4_flowctl.c index d2dacab419..82940b99ac 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4_flowctl.c +++ b/ompi/mca/mtl/portals4/mtl_portals4_flowctl.c @@ -59,7 +59,7 @@ ompi_mtl_portals4_flowctl_init(void) REQ_FLOWCTL_TABLE_ID, &ompi_mtl_portals4.flowctl_idx); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlPTAlloc failed: %d\n", __FILE__, __LINE__, ret); goto error; @@ -68,7 +68,7 @@ ompi_mtl_portals4_flowctl_init(void) ret = PtlCTAlloc(ompi_mtl_portals4.ni_h, &ompi_mtl_portals4.flowctl.trigger_ct_h); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlCTAlloc failed: %d\n", __FILE__, __LINE__, ret); goto error; @@ -99,7 +99,7 @@ ompi_mtl_portals4_flowctl_init(void) NULL, &ompi_mtl_portals4.flowctl.trigger_me_h); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlMEAppend failed: %d\n", __FILE__, __LINE__, ret); goto error; @@ -111,7 +111,7 @@ ompi_mtl_portals4_flowctl_init(void) ret = PtlCTAlloc(ompi_mtl_portals4.ni_h, &ompi_mtl_portals4.flowctl.alert_ct_h); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlCTAlloc failed: %d\n", __FILE__, __LINE__, ret); goto error; @@ -130,7 +130,7 @@ ompi_mtl_portals4_flowctl_init(void) &ompi_mtl_portals4.flowctl.alert_req, &ompi_mtl_portals4.flowctl.alert_me_h); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlMEAppend failed: %d\n", __FILE__, __LINE__, ret); goto error; @@ -140,7 +140,7 @@ ompi_mtl_portals4_flowctl_init(void) ret = PtlCTAlloc(ompi_mtl_portals4.ni_h, &ompi_mtl_portals4.flowctl.fanin_ct_h); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlCTAlloc failed: %d\n", __FILE__, __LINE__, ret); goto error; @@ -160,7 +160,7 @@ ompi_mtl_portals4_flowctl_init(void) NULL, &ompi_mtl_portals4.flowctl.fanin_me_h); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlMEAppend failed: %d\n", __FILE__, __LINE__, ret); goto error; @@ -170,7 +170,7 @@ ompi_mtl_portals4_flowctl_init(void) ret = PtlCTAlloc(ompi_mtl_portals4.ni_h, &ompi_mtl_portals4.flowctl.fanout_ct_h); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlCTAlloc failed: %d\n", __FILE__, __LINE__, ret); goto error; @@ -189,7 +189,7 @@ ompi_mtl_portals4_flowctl_init(void) &ompi_mtl_portals4.flowctl.fanout_req, &ompi_mtl_portals4.flowctl.fanout_me_h); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlMEAppend failed: %d\n", __FILE__, __LINE__, ret); goto error; @@ -281,7 +281,7 @@ ompi_mtl_portals4_flowctl_trigger(void) NULL, 0); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlPut failed: %d\n", __FILE__, __LINE__, ret); return ret; @@ -317,14 +317,14 @@ start_recover(void) ompi_mtl_portals4.flowctl.flowctl_active = true; ompi_mtl_portals4.flowctl.epoch_counter++; - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "Entering flowctl_start_recover %d", ompi_mtl_portals4.flowctl.epoch_counter); /* re-arm trigger/alarm for next time */ ret = setup_alarm(ompi_mtl_portals4.flowctl.epoch_counter); if (OMPI_SUCCESS != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d setup_alarm failed: %d\n", __FILE__, __LINE__, ret); return ret; @@ -333,7 +333,7 @@ start_recover(void) /* setup barrier tree for getting us out of flow control */ ret = setup_barrier(ompi_mtl_portals4.flowctl.epoch_counter); if (OMPI_SUCCESS != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d setup_barrier failed: %d\n", __FILE__, __LINE__, ret); return ret; @@ -351,7 +351,7 @@ start_recover(void) /* check short block active count */ ret = ompi_mtl_portals4_recv_short_link(1); if (OMPI_SUCCESS != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: recv_short_link failed: %d", __FILE__, __LINE__, ret); } @@ -359,7 +359,7 @@ start_recover(void) /* reorder the pending sends by operation count */ ret = opal_list_sort(&ompi_mtl_portals4.flowctl.pending_sends, seqnum_compare); if (OMPI_SUCCESS != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d opal_list_sort failed: %d\n", __FILE__, __LINE__, ret); return ret; @@ -380,7 +380,7 @@ start_recover(void) NULL, 0); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlPut failed: %d\n", __FILE__, __LINE__, ret); goto error; @@ -391,7 +391,7 @@ start_recover(void) ret = OMPI_SUCCESS; error: - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Exiting flowctl_start_recover %d", ompi_mtl_portals4.flowctl.epoch_counter)); @@ -420,7 +420,7 @@ setup_alarm(uint32_t epoch) ompi_mtl_portals4.flowctl.trigger_ct_h, (epoch * ompi_mtl_portals4.flowctl.num_procs) + 1); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlTriggeredPut failed: %d\n", __FILE__, __LINE__, ret); goto cleanup; @@ -442,7 +442,7 @@ setup_alarm(uint32_t epoch) ompi_mtl_portals4.flowctl.alert_ct_h, epoch + 1); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlTriggeredPut failed: %d\n", __FILE__, __LINE__, ret); goto cleanup; @@ -470,7 +470,7 @@ setup_barrier(uint32_t epoch) ompi_mtl_portals4.flowctl.fanin_ct_h, epoch * (ompi_mtl_portals4.flowctl.num_children + 1)); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlTriggeredCTSet failed: %d\n", __FILE__, __LINE__, ret); goto cleanup; @@ -489,7 +489,7 @@ setup_barrier(uint32_t epoch) ompi_mtl_portals4.flowctl.fanin_ct_h, epoch * (ompi_mtl_portals4.flowctl.num_children + 1)); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlTriggeredPut failed: %d\n", __FILE__, __LINE__, ret); goto cleanup; @@ -508,7 +508,7 @@ setup_barrier(uint32_t epoch) ompi_mtl_portals4.flowctl.fanin_ct_h, epoch * (ompi_mtl_portals4.flowctl.num_children + 1)); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlTriggeredPut failed: %d\n", __FILE__, __LINE__, ret); goto cleanup; @@ -529,7 +529,7 @@ setup_barrier(uint32_t epoch) ompi_mtl_portals4.flowctl.fanout_ct_h, epoch); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlTriggeredPut failed: %d\n", __FILE__, __LINE__, ret); return ret; @@ -559,7 +559,7 @@ flowctl_fanout_callback(ptl_event_t *ev, ompi_mtl_portals4.flowctl.flowctl_active = false; ret = PtlPTEnable(ompi_mtl_portals4.ni_h, ompi_mtl_portals4.recv_idx); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlPTEnabled failed: %d\n", __FILE__, __LINE__, ret); return ret; @@ -577,7 +577,7 @@ flowctl_fanout_callback(ptl_event_t *ev, ompi_mtl_portals4_pending_list_progress(); - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Exiting flowctl_fanout_callback %d", ompi_mtl_portals4.flowctl.epoch_counter)); diff --git a/ompi/mca/mtl/portals4/mtl_portals4_probe.c b/ompi/mca/mtl/portals4/mtl_portals4_probe.c index 443c0543d3..9cd8eb0e7c 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4_probe.c +++ b/ompi/mca/mtl/portals4/mtl_portals4_probe.c @@ -32,7 +32,7 @@ completion_fn(ptl_event_t *ev, ompi_mtl_portals4_base_request_t *ptl_base_reques ompi_mtl_portals4_probe_request_t *ptl_request = (ompi_mtl_portals4_probe_request_t*) ptl_base_request; - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: completion_fn: %d %d", __FILE__, __LINE__, ev->type, ev->ni_fail_type); @@ -104,7 +104,7 @@ ompi_mtl_portals4_iprobe(struct mca_mtl_base_module_t* mtl, PTL_SEARCH_ONLY, &request); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlMESearch failed: %d", __FILE__, __LINE__, ret); return ompi_mtl_portals4_get_error(ret); @@ -139,7 +139,7 @@ ompi_mtl_portals4_improbe(struct mca_mtl_base_module_t *mtl, ptl_match_bits_t match_bits, ignore_bits; int ret; - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: improbe %d %d %d", __FILE__, __LINE__, comm->c_contextid, src, tag); @@ -178,7 +178,7 @@ ompi_mtl_portals4_improbe(struct mca_mtl_base_module_t *mtl, PTL_SEARCH_DELETE, &request); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlMESearch failed: %d", __FILE__, __LINE__, ret); return ompi_mtl_portals4_get_error(ret); diff --git a/ompi/mca/mtl/portals4/mtl_portals4_recv.c b/ompi/mca/mtl/portals4/mtl_portals4_recv.c index 34b7cf0e03..4957af0fdd 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4_recv.c +++ b/ompi/mca/mtl/portals4/mtl_portals4_recv.c @@ -50,11 +50,11 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev, switch (ev->type) { case PTL_EVENT_PUT: - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "Recv %lu (0x%lx) got put event", + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Recv %lu (0x%lx) got put event", ptl_request->opcount, ev->hdr_data)); if (ev->ni_fail_type != PTL_NI_OK) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PTL_EVENT_PUT with ni_fail_type: %d", __FILE__, __LINE__, ev->ni_fail_type); goto callback_error; @@ -68,7 +68,7 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev, ptl_request->super.super.ompi_req->req_status.MPI_TAG = MTL_PORTALS4_GET_TAG(ev->match_bits); if (OPAL_UNLIKELY(msg_length > ptl_request->delivery_len)) { - opal_output_verbose(1, ompi_mtl_base_output, "truncate expected: %ld %ld", + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "truncate expected: %ld %ld", msg_length, ptl_request->delivery_len); ptl_request->super.super.ompi_req->req_status.MPI_ERROR = MPI_ERR_TRUNCATE; } @@ -92,7 +92,7 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev, &ptl_request->md_h); if (OPAL_UNLIKELY(PTL_OK != ret)) { if (NULL != ptl_request->buffer_ptr) free(ptl_request->buffer_ptr); - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlMDBind failed: %d", __FILE__, __LINE__, ret); goto callback_error; @@ -107,7 +107,7 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev, ompi_mtl_portals4.eager_limit, ptl_request); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlGet failed: %d", __FILE__, __LINE__, ret); PtlMDRelease(ptl_request->md_h); @@ -121,25 +121,25 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev, ev->start, ev->mlength); if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: ompi_mtl_datatype_unpack failed: %d", __FILE__, __LINE__, ret); ptl_request->super.super.ompi_req->req_status.MPI_ERROR = ret; } ptl_request->super.super.ompi_req->req_status._ucount = ev->mlength; - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "Recv %lu (0x%lx) completed, expected", + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Recv %lu (0x%lx) completed, expected", ptl_request->opcount, ptl_request->hdr_data)); ptl_request->super.super.completion_callback(&ptl_request->super.super); } break; case PTL_EVENT_REPLY: - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "Recv %lu (0x%lx) got reply event", + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Recv %lu (0x%lx) got reply event", ptl_request->opcount, ptl_request->hdr_data)); if (OPAL_UNLIKELY(ev->ni_fail_type != PTL_NI_OK)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PTL_EVENT_REPLY with ni_fail_type: %d", __FILE__, __LINE__, ev->ni_fail_type); PtlMDRelease(ptl_request->md_h); @@ -162,24 +162,24 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev, ptl_request->delivery_ptr, ptl_request->super.super.ompi_req->req_status._ucount); if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: ompi_mtl_datatype_unpack failed: %d", __FILE__, __LINE__, ret); ptl_request->super.super.ompi_req->req_status.MPI_ERROR = ret; } PtlMDRelease(ptl_request->md_h); - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "Recv %lu (0x%lx) completed, reply", + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Recv %lu (0x%lx) completed, reply", ptl_request->opcount, ptl_request->hdr_data)); ptl_request->super.super.completion_callback(&ptl_request->super.super); break; case PTL_EVENT_PUT_OVERFLOW: - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "Recv %lu (0x%lx) got put_overflow event", + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Recv %lu (0x%lx) got put_overflow event", ptl_request->opcount, ev->hdr_data)); if (OPAL_UNLIKELY(ev->ni_fail_type != PTL_NI_OK)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PTL_EVENT_PUT_OVERFLOW with ni_fail_type: %d", __FILE__, __LINE__, ev->ni_fail_type); goto callback_error; @@ -193,7 +193,7 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev, ptl_request->super.super.ompi_req->req_status.MPI_TAG = MTL_PORTALS4_GET_TAG(ev->match_bits); if (OPAL_UNLIKELY(msg_length > ptl_request->delivery_len)) { - opal_output_verbose(1, ompi_mtl_base_output, "truncate unexpected: %ld %ld %d", + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "truncate unexpected: %ld %ld %d", msg_length, ptl_request->delivery_len, MTL_PORTALS4_IS_SHORT_MSG(ev->match_bits)); ptl_request->super.super.ompi_req->req_status.MPI_ERROR = MPI_ERR_TRUNCATE; } @@ -219,7 +219,7 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev, &max_data ); if (NULL != ptl_request->buffer_ptr) free(ptl_request->buffer_ptr); if (OPAL_UNLIKELY(ret < 0)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: opal_convertor_unpack failed: %d", __FILE__, __LINE__, ret); goto callback_error; @@ -227,7 +227,7 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev, } /* if it's a sync, send the ack */ if (MTL_PORTALS4_IS_SYNC_MSG(ev->hdr_data)) { - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Recv %lu (0x%lx) sending sync ack", ptl_request->opcount, ptl_request->hdr_data)); ret = PtlPut(ompi_mtl_portals4.zero_md_h, @@ -241,14 +241,14 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev, NULL, 0); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlPut failed: %d", __FILE__, __LINE__, ret); goto callback_error; } } - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Recv %lu (0x%lx) completed, unexpected short (0x%lx)", ptl_request->opcount, ptl_request->hdr_data, (long) ev->start)); ptl_request->super.super.completion_callback(&ptl_request->super.super); @@ -273,13 +273,13 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev, &ptl_request->md_h); if (OPAL_UNLIKELY(PTL_OK != ret)) { if (NULL != ptl_request->buffer_ptr) free(ptl_request->buffer_ptr); - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlMDBind failed: %d", __FILE__, __LINE__, ret); goto callback_error; } - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "Recv %lu (0x%lx) getting long data", + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Recv %lu (0x%lx) getting long data", ptl_request->opcount, ptl_request->hdr_data)); ret = PtlGet(ptl_request->md_h, 0, @@ -290,7 +290,7 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev, ev->mlength, ptl_request); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlGet failed: %d", __FILE__, __LINE__, ret); if (NULL != ptl_request->buffer_ptr) free(ptl_request->buffer_ptr); @@ -305,7 +305,7 @@ ompi_mtl_portals4_recv_progress(ptl_event_t *ev, break; default: - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "Unhandled receive callback with event type %d", ev->type); return OMPI_ERROR; @@ -370,7 +370,7 @@ ompi_mtl_portals4_irecv(struct mca_mtl_base_module_t* mtl, ptl_request->req_started = false; ptl_request->super.super.ompi_req->req_status.MPI_ERROR = OMPI_SUCCESS; - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Recv %lu from %x,%x of length %d (0x%lx, 0x%lx, 0x%lx)\n", ptl_request->opcount, remote_proc.phys.nid, remote_proc.phys.pid, @@ -400,7 +400,7 @@ ompi_mtl_portals4_irecv(struct mca_mtl_base_module_t* mtl, &ptl_request->me_h); if (OPAL_UNLIKELY(PTL_OK != ret)) { if (NULL != ptl_request->buffer_ptr) free(ptl_request->buffer_ptr); - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlMEAppend failed: %d", __FILE__, __LINE__, ret); return ompi_mtl_portals4_get_error(ret); @@ -451,7 +451,7 @@ ompi_mtl_portals4_imrecv(struct mca_mtl_base_module_t* mtl, ptl_request->delivery_len = length; ptl_request->super.super.ompi_req->req_status.MPI_ERROR = OMPI_SUCCESS; - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Mrecv %lu of length %d (0x%lx)\n", ptl_request->opcount, (int)length, (unsigned long) ptl_request)); diff --git a/ompi/mca/mtl/portals4/mtl_portals4_recv_short.c b/ompi/mca/mtl/portals4/mtl_portals4_recv_short.c index 25dcbcc915..c295f0d824 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4_recv_short.c +++ b/ompi/mca/mtl/portals4/mtl_portals4_recv_short.c @@ -56,7 +56,7 @@ ompi_mtl_portals4_recv_block_progress(ptl_event_t *ev, opal_list_append(&ompi_mtl_portals4.waiting_recv_short_blocks, &block->base); } else { - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "OVERFLOW EVENT %d, hdr_data = %lx", ev->type, (long unsigned) ev->hdr_data)); } diff --git a/ompi/mca/mtl/portals4/mtl_portals4_send.c b/ompi/mca/mtl/portals4/mtl_portals4_send.c index 92451ce105..0449e70ab0 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4_send.c +++ b/ompi/mca/mtl/portals4/mtl_portals4_send.c @@ -52,13 +52,13 @@ ompi_mtl_portals4_callback(ptl_event_t *ev, ompi_mtl_portals4_pending_request_t *pending = ptl_request->pending; - OPAL_OUTPUT_VERBOSE((10, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((10, ompi_mtl_base_framework.framework_output, "send %lu hit flow control (%d)", ptl_request->opcount, ev->type)); /* BWB: FIX ME: this is a hack.. */ if (pending->fc_notified) { - return; + return OMPI_SUCCESS; } pending->fc_notified = 1; @@ -67,7 +67,7 @@ ompi_mtl_portals4_callback(ptl_event_t *ev, if (!PtlHandleIsEqual(ptl_request->me_h, PTL_INVALID_HANDLE)) { ret = PtlMEUnlink(ptl_request->me_h); if (PTL_OK != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: send callback PtlMEUnlink returned %d", __FILE__, __LINE__, ret); } @@ -83,14 +83,14 @@ ompi_mtl_portals4_callback(ptl_event_t *ev, #endif if (OPAL_UNLIKELY(ev->ni_fail_type != PTL_NI_OK)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: send callback ni_fail_type: %d", __FILE__, __LINE__, ev->ni_fail_type); *complete = true; return OMPI_ERROR; } - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "send %lu got event of type %d", ptl_request->opcount, ev->type)); @@ -106,7 +106,7 @@ ompi_mtl_portals4_callback(ptl_event_t *ev, 1, so they don't need to enter this path) */ ret = PtlMEUnlink(ptl_request->me_h); if (PTL_OK != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: send callback PtlMEUnlink returned %d", __FILE__, __LINE__, ret); } @@ -123,14 +123,14 @@ ompi_mtl_portals4_callback(ptl_event_t *ev, if (PTL_INVALID_HANDLE != ptl_request->md_h) { ret = PtlMDRelease(ptl_request->md_h); if (PTL_OK != ret) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: send callback PtlMDRelease returned %d", __FILE__, __LINE__, ret); retval = OMPI_ERROR; } } - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "send %lu completed", + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "send %lu completed", ptl_request->opcount)); *complete = true; @@ -230,20 +230,20 @@ ompi_mtl_portals4_short_isend(mca_pml_base_send_mode_t mode, ptl_request, &ptl_request->me_h); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlMEAppend failed: %d", __FILE__, __LINE__, ret); return ompi_mtl_portals4_get_error(ret); } - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Send %lu short sync send with hdr_data 0x%lx (0x%lx)", ptl_request->opcount, hdr_data, match_bits)); } else { ptl_request->event_count = 1; ptl_request->me_h = PTL_INVALID_HANDLE; - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Send %lu short send with hdr_data 0x%lx (0x%lx)", ptl_request->opcount, hdr_data, match_bits)); } @@ -264,7 +264,7 @@ ompi_mtl_portals4_short_isend(mca_pml_base_send_mode_t mode, ptl_request, hdr_data); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlPut failed: %d", __FILE__, __LINE__, ret); if (MCA_PML_BASE_SEND_SYNCHRONOUS == mode) { @@ -317,13 +317,13 @@ ompi_mtl_portals4_long_isend(void *start, int length, int contextid, int tag, ptl_request, &ptl_request->me_h); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlMEAppend failed: %d", __FILE__, __LINE__, ret); return ompi_mtl_portals4_get_error(ret); } - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Send %lu long send with hdr_data 0x%lx (0x%lx)", ptl_request->opcount, hdr_data, match_bits)); @@ -346,7 +346,7 @@ ompi_mtl_portals4_long_isend(void *start, int length, int contextid, int tag, ptl_request, hdr_data); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlPut failed: %d", __FILE__, __LINE__, ret); PtlMEUnlink(ptl_request->me_h); @@ -437,7 +437,7 @@ ompi_mtl_portals4_send_start(struct mca_mtl_base_module_t* mtl, ptl_request->buffer_ptr = (free_after) ? start : NULL; ptl_request->event_count = 0; - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "Send %lu to %x,%x of length %d\n", ptl_request->opcount, endpoint->ptl_proc.phys.nid, @@ -583,9 +583,9 @@ ompi_mtl_portals4_try_to_use_fixed_md(void *start, /* If fixed_md_distance is defined for MD and if the memory buffer is strictly contained in one of them, then use one */ if ((0 != ompi_mtl_portals4.fixed_md_distance) && (((addr % ompi_mtl_portals4.fixed_md_distance) + length) < ompi_mtl_portals4.fixed_md_distance)) { - if (0 == length) OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, " Memory : [ %16lx - (len = 0) ] is in fixed MD number: %d\n\n", + if (0 == length) OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, " Memory : [ %16lx - (len = 0) ] is in fixed MD number: %d\n\n", start, addr / ompi_mtl_portals4.fixed_md_distance)); - else OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, " Memory : [ %16lx - %16lx ] is in fixed MD number: %d\n\n", + else OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, " Memory : [ %16lx - %16lx ] is in fixed MD number: %d\n\n", start, (long int)start + length - 1, addr / ompi_mtl_portals4.fixed_md_distance)); /* Use the fixed MD */ *md_h = ompi_mtl_portals4.fixed_md_h[addr / ompi_mtl_portals4.fixed_md_distance]; @@ -594,8 +594,8 @@ ompi_mtl_portals4_try_to_use_fixed_md(void *start, } else { if (0 == ompi_mtl_portals4.fixed_md_distance) - OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "\nWARNING: Memory cannot be connected to a fixed MD\n")); - else OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_output, "\nWARNING: Memory outside the scope of the fixed MD %x\n\n", addr / ompi_mtl_portals4.fixed_md_distance)); + OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "\nWARNING: Memory cannot be connected to a fixed MD\n")); + else OPAL_OUTPUT_VERBOSE((50, ompi_mtl_base_framework.framework_output, "\nWARNING: Memory outside the scope of the fixed MD %x\n\n", addr / ompi_mtl_portals4.fixed_md_distance)); /* Bind the MD (and unbind it where necessary) */ md.start = start; @@ -608,7 +608,7 @@ ompi_mtl_portals4_try_to_use_fixed_md(void *start, &md, &ptl_request->md_h); if (OPAL_UNLIKELY(PTL_OK != ret)) { - opal_output_verbose(1, ompi_mtl_base_output, + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: PtlMDBind failed: %d\n", __FILE__, __LINE__, ret); if (unlink_me) { diff --git a/ompi/mca/op/base/Makefile.include b/ompi/mca/op/base/Makefile.include index a3899de9c9..044f39eee2 100644 --- a/ompi/mca/op/base/Makefile.include +++ b/ompi/mca/op/base/Makefile.include @@ -25,8 +25,7 @@ headers += \ base/functions.h libmca_op_la_SOURCES += \ - base/op_base_close.c \ - base/op_base_open.c \ + base/op_base_frame.c \ base/op_base_find_available.c \ base/op_base_functions.c \ base/op_base_op_select.c diff --git a/ompi/mca/op/base/base.h b/ompi/mca/op/base/base.h index 0a7ea54011..2aed7fc50a 100644 --- a/ompi/mca/op/base/base.h +++ b/ompi/mca/op/base/base.h @@ -34,8 +34,7 @@ #define MCA_OP_BASE_H #include "ompi_config.h" -#include "opal/class/opal_list.h" -#include "opal/mca/mca.h" +#include "opal/mca/base/base.h" #include "ompi/mca/op/op.h" BEGIN_C_DECLS @@ -47,11 +46,6 @@ typedef struct ompi_op_base_selected_module_t { } ompi_op_base_selected_module_t; -/** - * Open the op framework. - */ -OMPI_DECLSPEC int ompi_op_base_open(void); - /** * Find all available op components. */ @@ -99,40 +93,7 @@ int ompi_op_base_op_select(struct ompi_op_t *op); */ OMPI_DECLSPEC int ompi_op_base_op_unselect(struct ompi_op_t *op); -/** - * Close the op framework - */ -OMPI_DECLSPEC int ompi_op_base_close(void); - - -/** - * Verbose output stream for this framework - */ -OMPI_DECLSPEC extern int ompi_op_base_output; - -/** - * List of all opened components; created when the op framework is - * initialized and destroyed when we reduce the list to all available - * op components. - */ -OMPI_DECLSPEC extern opal_list_t ompi_op_base_components_opened; - -/** - * Indicator as to whether the list of opened op components is valid - * or not. - */ -OMPI_DECLSPEC extern bool ompi_op_base_components_opened_valid; - -/** - * List of all available components. - */ -OMPI_DECLSPEC extern opal_list_t ompi_op_base_components_available; - -/** - * Indicator as to whether the list of available op components is - * valid or not. - */ -OMPI_DECLSPEC extern bool ompi_op_base_components_available_valid; +OMPI_DECLSPEC extern mca_base_framework_t ompi_op_base_framework; END_C_DECLS #endif /* MCA_OP_BASE_H */ diff --git a/ompi/mca/op/base/op_base_close.c b/ompi/mca/op/base/op_base_close.c deleted file mode 100644 index 8db92558ad..0000000000 --- a/ompi/mca/op/base/op_base_close.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" - -#include "ompi/constants.h" -#include "ompi/mca/op/op.h" -#include "ompi/mca/op/base/base.h" -#include "opal/util/output.h" - -int ompi_op_base_close(void) -{ - /* Close all components that are still open. This may be the - * opened list (if we're in ompi_info), or it may be the available - * list (if we're anywhere else). */ - - if (ompi_op_base_components_opened_valid) { - mca_base_components_close(ompi_op_base_output, - &ompi_op_base_components_opened, NULL); - OBJ_DESTRUCT(&ompi_op_base_components_opened); - ompi_op_base_components_opened_valid = false; - } else if (ompi_op_base_components_available_valid) { - mca_base_components_close(ompi_op_base_output, - &ompi_op_base_components_available, - NULL); - OBJ_DESTRUCT(&ompi_op_base_components_available); - ompi_op_base_components_available_valid = false; - } - - /* Close the framework output */ - opal_output_close (ompi_op_base_output); - ompi_op_base_output = -1; - - /* All done */ - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/op/base/op_base_find_available.c b/ompi/mca/op/base/op_base_find_available.c index bc85da42ae..bc53b5bad2 100644 --- a/ompi/mca/op/base/op_base_find_available.c +++ b/ompi/mca/op/base/op_base_find_available.c @@ -36,24 +36,14 @@ #include "ompi/mca/op/op.h" #include "ompi/mca/op/base/base.h" - -/* - * Global variables - */ -bool ompi_op_base_components_available_valid = false; -opal_list_t ompi_op_base_components_available; - - /* * Private functions */ static int init_query(const mca_base_component_t * ls, - mca_base_component_priority_list_item_t * entry, bool enable_progress_threads, bool enable_mpi_threads); static int init_query_1_0_0(const mca_base_component_t * ls, - mca_base_component_priority_list_item_t * - entry, bool enable_progress_threads, + bool enable_progress_threads, bool enable_mpi_threads); /* @@ -69,57 +59,28 @@ static int init_query_1_0_0(const mca_base_component_t * ls, int ompi_op_base_find_available(bool enable_progress_threads, bool enable_mpi_threads) { - bool found = false; - mca_base_component_priority_list_item_t *entry; - opal_list_item_t *p; - const mca_base_component_t *component; - - /* Initialize the list */ - - OBJ_CONSTRUCT(&ompi_op_base_components_available, opal_list_t); - ompi_op_base_components_available_valid = true; + mca_base_component_list_item_t *cli, *next; /* The list of components that we should check has already been established in ompi_op_base_open. */ - for (found = false, - p = opal_list_remove_first(&ompi_op_base_components_opened); - p != NULL; - p = opal_list_remove_first(&ompi_op_base_components_opened)) { - component = ((mca_base_component_list_item_t *) p)->cli_component; + OPAL_LIST_FOREACH_SAFE(cli, next, &ompi_op_base_framework.framework_components, mca_base_component_list_item_t) { + const mca_base_component_t *component = cli->cli_component; /* Call a subroutine to do the work, because the component may represent different versions of the op MCA. */ - entry = OBJ_NEW(mca_base_component_priority_list_item_t); - entry->super.cli_component = component; - entry->cpli_priority = 0; - if (OMPI_SUCCESS == init_query(component, entry, + if (OMPI_SUCCESS != init_query(component, enable_progress_threads, enable_mpi_threads)) { - opal_list_append(&ompi_op_base_components_available, - (opal_list_item_t *) entry); - found = true; - } else { - /* If the component doesn't want to run, then close it. - It's already had its close() method invoked; now close - it out of the DSO repository (if it's there). */ - - mca_base_component_repository_release(component); - OBJ_RELEASE(entry); + /* If the component doesn't want to run, then close it. */ + opal_list_remove_item(&ompi_op_base_framework.framework_components, &cli->super); + mca_base_component_close(component, ompi_op_base_framework.framework_output); + OBJ_RELEASE(cli); } - - /* Free the entry from the "opened" list */ - - OBJ_RELEASE(p); } - /* The opened list is now no longer useful and we can free it */ - - OBJ_DESTRUCT(&ompi_op_base_components_opened); - ompi_op_base_components_opened_valid = false; - /* It is not an error if there are no components available; we'll just fall back to the base functions. */ @@ -132,12 +93,11 @@ int ompi_op_base_find_available(bool enable_progress_threads, * some information. If it doesn't, close it. */ static int init_query(const mca_base_component_t * c, - mca_base_component_priority_list_item_t * entry, bool enable_progress_threads, bool enable_mpi_threads) { int ret; - opal_output_verbose(10, ompi_op_base_output, + opal_output_verbose(10, ompi_op_base_framework.framework_output, "op:find_available: querying op component %s", c->mca_component_name); @@ -147,12 +107,12 @@ static int init_query(const mca_base_component_t * c, if (1 == c->mca_type_major_version && 0 == c->mca_type_minor_version && 0 == c->mca_type_release_version) { - ret = init_query_1_0_0(c, entry, enable_progress_threads, + ret = init_query_1_0_0(c, enable_progress_threads, enable_mpi_threads); } else { /* Unrecognized op API version */ - opal_output_verbose(10, ompi_op_base_output, + opal_output_verbose(10, ompi_op_base_framework.framework_output, "op:find_available: unrecognized op API version (%d.%d.%d, ignored)", c->mca_type_major_version, c->mca_type_minor_version, @@ -163,14 +123,11 @@ static int init_query(const mca_base_component_t * c, /* Query done -- look at the return value to see what happened */ if (OMPI_SUCCESS != ret) { - opal_output_verbose(10, ompi_op_base_output, + opal_output_verbose(10, ompi_op_base_framework.framework_output, "op:find_available: op component %s is not available", c->mca_component_name); - if (NULL != c->mca_close_component) { - c->mca_close_component(); - } } else { - opal_output_verbose(10, ompi_op_base_output, + opal_output_verbose(10, ompi_op_base_framework.framework_output, "op:find_available: op component %s is available", c->mca_component_name); } @@ -185,7 +142,6 @@ static int init_query(const mca_base_component_t * c, * Query a specific component, op v2.0.0 */ static int init_query_1_0_0(const mca_base_component_t * component, - mca_base_component_priority_list_item_t * entry, bool enable_progress_threads, bool enable_mpi_threads) { diff --git a/ompi/mca/op/base/op_base_open.c b/ompi/mca/op/base/op_base_frame.c similarity index 57% rename from ompi/mca/op/base/op_base_open.c rename to ompi/mca/op/base/op_base_frame.c index adbfa1b9aa..8fc208a002 100644 --- a/ompi/mca/op/base/op_base_open.c +++ b/ompi/mca/op/base/op_base_frame.c @@ -40,19 +40,6 @@ */ #include "ompi/mca/op/base/static-components.h" - -/* - * Globals - */ -int ompi_op_base_output = -1; -bool ompi_op_base_components_opened_valid = false; -opal_list_t ompi_op_base_components_opened; - -/* - * Locals - */ -static int ompi_op_base_verbose; - static void module_constructor(ompi_op_base_module_t *m) { m->opm_enable = NULL; @@ -74,45 +61,5 @@ OBJ_CLASS_INSTANCE(ompi_op_base_module_t, opal_object_t, OBJ_CLASS_INSTANCE(ompi_op_base_module_1_0_0_t, opal_object_t, module_constructor_1_0_0, NULL); -static int ompi_op_base_register(int flags) -{ - /* Debugging / verbose output */ - ompi_op_base_verbose = 0; - (void) mca_base_var_register("ompi", "op", "base", "verbose", - "Verbosity level of the op framework", - MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &ompi_op_base_verbose); - - return OMPI_SUCCESS; -} - -/* - * Function for finding and opening either all MCA components, or the one - * that was specifically requested via a MCA parameter. - */ -int ompi_op_base_open(void) -{ - (void) ompi_op_base_register(0); - - if (0 != ompi_op_base_verbose) { - ompi_op_base_output = opal_output_open(NULL); - } else { - ompi_op_base_output = -1; - } - - /* Open up all available components */ - - if (OPAL_SUCCESS != - mca_base_components_open("op", ompi_op_base_output, - mca_op_base_static_components, - &ompi_op_base_components_opened, true)) { - return OPAL_ERROR; - } - ompi_op_base_components_opened_valid = true; - - /* All done */ - - return OPAL_SUCCESS; -} +MCA_BASE_FRAMEWORK_DECLARE(ompi, op, NULL, NULL, NULL, NULL, + mca_op_base_static_components, 0); diff --git a/ompi/mca/op/base/op_base_op_select.c b/ompi/mca/op/base/op_base_op_select.c index 7b2a93e019..aa621a8978 100644 --- a/ompi/mca/op/base/op_base_op_select.c +++ b/ompi/mca/op/base/op_base_op_select.c @@ -93,7 +93,7 @@ int ompi_op_base_op_select(ompi_op_t *op) ompi_op_base_module_t *module; /* Announce */ - opal_output_verbose(10, ompi_op_base_output, + opal_output_verbose(10, ompi_op_base_framework.framework_output, "op:base:op_select: new op: %s", op->o_name); @@ -126,9 +126,9 @@ int ompi_op_base_op_select(ompi_op_t *op) /* Check for any components that want to run. It's not an error if there are none; we'll just use all the base functions in this case. */ - opal_output_verbose(10, ompi_op_base_output, + opal_output_verbose(10, ompi_op_base_framework.framework_output, "op:base:op_select: Checking all available components"); - selectable = check_components(&ompi_op_base_components_available, op); + selectable = check_components(&ompi_op_base_framework.framework_components, op); /* Do the selection loop. The selectable list is in priority order; lowest priority first. */ @@ -203,6 +203,20 @@ int ompi_op_base_op_select(ompi_op_t *op) return OMPI_SUCCESS; } +static int avail_op_compare(opal_list_item_t **itema, + opal_list_item_t **itemb) +{ + avail_op_t *availa = (avail_op_t *) itema; + avail_op_t *availb = (avail_op_t *) itemb; + + if (availa->ao_priority > availb->ao_priority) { + return 1; + } else if (availa->ao_priority < availb->ao_priority) { + return -1; + } else { + return 0; + } +} /* * For each module in the list, check and see if it wants to run, and @@ -214,11 +228,11 @@ static opal_list_t *check_components(opal_list_t *components, ompi_op_t *op) { int priority; + mca_base_component_list_item_t *cli; const mca_base_component_t *component; - opal_list_item_t *item, *item2; ompi_op_base_module_1_0_0_t *module; opal_list_t *selectable; - avail_op_t *avail, *avail2; + avail_op_t *avail; /* Make a list of the components that query successfully */ selectable = OBJ_NEW(opal_list_t); @@ -226,41 +240,24 @@ static opal_list_t *check_components(opal_list_t *components, /* Scan through the list of components. This nested loop is O(N^2), but we should never have too many components and/or names, so this *hopefully* shouldn't matter... */ - - for (item = opal_list_get_first(components); - item != opal_list_get_end(components); - item = opal_list_get_next(item)) { - component = ((mca_base_component_priority_list_item_t *) - item)->super.cli_component; + + OPAL_LIST_FOREACH(cli, components, mca_base_component_list_item_t) { + component = cli->cli_component; priority = check_one_component(op, component, &module); if (priority >= 0) { - /* We have a component that indicated that it wants to run by giving us a module */ avail = OBJ_NEW(avail_op_t); avail->ao_priority = priority; avail->ao_module = module; - /* Put this item on the list in priority order (lowest - priority first). Should it go first? */ - for (item2 = opal_list_get_first(selectable); - item2 != opal_list_get_end(selectable); - item2 = opal_list_get_next(item2)) { - avail2 = (avail_op_t*)item2; - if(avail->ao_priority < avail2->ao_priority) { - opal_list_insert_pos(selectable, - item2, (opal_list_item_t*)avail); - break; - } - } - - if (opal_list_get_end(selectable) == item2) { - opal_list_append(selectable, (opal_list_item_t*)avail); - } + opal_list_append(selectable, (opal_list_item_t*)avail); } } + opal_list_sort(selectable, avail_op_compare); + /* All done (even if the list is empty; that's ok) */ return selectable; } @@ -280,13 +277,13 @@ static int check_one_component(ompi_op_t *op, if (OMPI_SUCCESS == err) { priority = (priority < 100) ? priority : 100; - opal_output_verbose(10, ompi_op_base_output, + opal_output_verbose(10, ompi_op_base_framework.framework_output, "op:base:op_select: component available: %s, priority: %d", component->mca_component_name, priority); } else { priority = -1; - opal_output_verbose(10, ompi_op_base_output, + opal_output_verbose(10, ompi_op_base_framework.framework_output, "op:base:op_select: component not available: %s", component->mca_component_name); } diff --git a/ompi/mca/op/example/op_example_component.c b/ompi/mca/op/example/op_example_component.c index ee7f1c630b..f6bd094737 100644 --- a/ompi/mca/op/example/op_example_component.c +++ b/ompi/mca/op/example/op_example_component.c @@ -77,7 +77,7 @@ ompi_op_example_component_t mca_op_example_component = { */ static int example_component_open(void) { - opal_output(ompi_op_base_output, "example component open"); + opal_output(ompi_op_base_framework.framework_output, "example component open"); /* A first level check to see if example is even available in this process. E.g., you may want to do a first-order check to see @@ -99,7 +99,7 @@ static int example_component_open(void) */ static int example_component_close(void) { - opal_output(ompi_op_base_output, "example component close"); + opal_output(ompi_op_base_framework.framework_output, "example component close"); /* If example was opened successfully, close it (i.e., release any resources that may have been allocated on this component). @@ -121,7 +121,7 @@ static int example_component_register(void) int val; char *str; - opal_output(ompi_op_base_output, "example component register"); + opal_output(ompi_op_base_framework.framework_output, "example component register"); /* Register any relevant MCA params. At a minimum, perhaps some information MCA params that return version and capability @@ -181,7 +181,7 @@ static int example_component_register(void) static int example_component_init_query(bool enable_progress_threads, bool enable_mpi_thread_multiple) { - opal_output(ompi_op_base_output, "example component init query"); + opal_output(ompi_op_base_framework.framework_output, "example component init query"); /* Query to see if we have the desired hardware / resources to be able to perform reduction operations. This is a much more @@ -249,7 +249,7 @@ static struct ompi_op_base_module_1_0_0_t * { ompi_op_base_module_t *module = NULL; - opal_output(ompi_op_base_output, "example component op query"); + opal_output(ompi_op_base_framework.framework_output, "example component op query"); /* Sanity check -- although the framework should never invoke the _component_op_query() on non-intrinsic MPI_Op's, we'll put a diff --git a/ompi/mca/op/x86/op_x86_component.c b/ompi/mca/op/x86/op_x86_component.c index 4d25d15329..885d516a78 100644 --- a/ompi/mca/op/x86/op_x86_component.c +++ b/ompi/mca/op/x86/op_x86_component.c @@ -80,7 +80,7 @@ ompi_op_x86_component_t mca_op_x86_component = { */ static int x86_component_open(void) { - opal_output(ompi_op_base_output, "x86 component open"); + opal_output(ompi_op_base_framework.framework_output, "x86 component open"); /* A first level check to see if x86 is even available in this process. E.g., you may want to do a first-order check to see @@ -102,7 +102,7 @@ static int x86_component_open(void) */ static int x86_component_close(void) { - opal_output(ompi_op_base_output, "x86 component close"); + opal_output(ompi_op_base_framework.framework_output, "x86 component close"); /* If x86 was opened successfully, close it (i.e., release any resources that may have been allocated on this component). @@ -136,7 +136,7 @@ static int x86_component_register(void) { int val; - opal_output(ompi_op_base_output, "x86 component register"); + opal_output(ompi_op_base_framework.framework_output, "x86 component register"); /* Probe the hardware and see what we have */ hardware_probe(); @@ -196,7 +196,7 @@ static int x86_component_register(void) static int x86_component_init_query(bool enable_progress_threads, bool enable_mpi_threads) { - opal_output(ompi_op_base_output, "x86 component init query"); + opal_output(ompi_op_base_framework.framework_output, "x86 component init query"); /* If we have any hardware and we're not threaded, success */ if (0 != mca_op_x86_component.oxc_hw_flags && !enable_mpi_threads) { @@ -214,7 +214,7 @@ static struct ompi_op_base_module_1_0_0_t * { ompi_op_base_module_t *module = NULL; - opal_output(ompi_op_base_output, "x86 component op query"); + opal_output(ompi_op_base_framework.framework_output, "x86 component op query"); /* Sanity check -- although the framework should never invoke the _component_op_query() on non-intrinsic MPI_Op's, we'll put a diff --git a/ompi/mca/osc/base/Makefile.am b/ompi/mca/osc/base/Makefile.am index cddebad100..a79b091af3 100644 --- a/ompi/mca/osc/base/Makefile.am +++ b/ompi/mca/osc/base/Makefile.am @@ -19,7 +19,6 @@ headers += \ base/osc_base_obj_convert.h libmca_osc_la_SOURCES += \ - base/osc_base_close.c \ - base/osc_base_open.c \ + base/osc_base_frame.c \ base/osc_base_init.c \ base/osc_base_obj_convert.c diff --git a/ompi/mca/osc/base/base.h b/ompi/mca/osc/base/base.h index a9f358923d..b6c7148cc2 100644 --- a/ompi/mca/osc/base/base.h +++ b/ompi/mca/osc/base/base.h @@ -23,7 +23,7 @@ #include "ompi/info/info.h" #include "ompi/communicator/communicator.h" #include "ompi/win/win.h" -#include "opal/class/opal_list.h" +#include "opal/mca/base/base.h" /* * Global functions for MCA overall collective open and close @@ -33,7 +33,6 @@ BEGIN_C_DECLS /* * function definitions */ -OMPI_DECLSPEC int ompi_osc_base_open(void); int ompi_osc_base_find_available(bool enable_progress_threads, bool enable_mpi_threads); @@ -42,11 +41,8 @@ int ompi_osc_base_select(ompi_win_t *win, ompi_communicator_t *comm); int ompi_osc_base_finalize(void); -OMPI_DECLSPEC int ompi_osc_base_close(void); -OMPI_DECLSPEC extern opal_list_t ompi_osc_base_open_components; -extern opal_list_t ompi_osc_base_avail_components; -OMPI_DECLSPEC extern int ompi_osc_base_output; +OMPI_DECLSPEC extern mca_base_framework_t ompi_osc_base_framework; END_C_DECLS diff --git a/ompi/mca/osc/base/osc_base_close.c b/ompi/mca/osc/base/osc_base_close.c deleted file mode 100644 index d497acea50..0000000000 --- a/ompi/mca/osc/base/osc_base_close.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2004-2005 The Trustees of the University of Tennessee. - * All rights reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include - -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "ompi/mca/osc/osc.h" -#include "ompi/mca/osc/base/base.h" -#include "opal/class/opal_list.h" - - -int -ompi_osc_base_finalize(void) -{ - opal_list_item_t* item; - - /* Finalize all available modules */ - while (NULL != - (item = opal_list_remove_first(&ompi_osc_base_avail_components))) { - ompi_osc_base_component_t *component = (ompi_osc_base_component_t*) - ((mca_base_component_list_item_t*) item)->cli_component; - component->osc_finalize(); - } - return OMPI_SUCCESS; -} - -int -ompi_osc_base_close(void) -{ - /* close all components not already closed*/ - - /* join the two lists of components */ - opal_list_join(&ompi_osc_base_open_components, - opal_list_get_end(&ompi_osc_base_open_components), - &ompi_osc_base_avail_components); - - mca_base_components_close(ompi_osc_base_output, - &ompi_osc_base_open_components, NULL); - - OBJ_DESTRUCT(&ompi_osc_base_open_components); - OBJ_DESTRUCT(&ompi_osc_base_avail_components); - - /* Close the framework output */ - opal_output_close (ompi_osc_base_output); - ompi_osc_base_output = -1; - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/osc/base/osc_base_frame.c b/ompi/mca/osc/base/osc_base_frame.c new file mode 100644 index 0000000000..2f0ff39a56 --- /dev/null +++ b/ompi/mca/osc/base/osc_base_frame.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University. + * All rights reserved. + * Copyright (c) 2004-2005 The Trustees of the University of Tennessee. + * All rights reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "ompi/constants.h" + +#include "opal/mca/mca.h" +#include "opal/util/output.h" +#include "opal/mca/base/base.h" + + +#include "ompi/mca/osc/osc.h" +#include "ompi/mca/osc/base/base.h" + + +/* + * The following file was created by configure. It contains extern + * statements and the definition of an array of pointers to each + * component's public mca_base_component_t struct. + */ + +#include "ompi/mca/osc/base/static-components.h" + +int +ompi_osc_base_find_available(bool enable_progress_threads, + bool enable_mpi_threads) +{ + mca_base_component_list_item_t *cli, *next; + + OPAL_LIST_FOREACH_SAFE(cli, next, &ompi_osc_base_framework.framework_components, mca_base_component_list_item_t) { + int ret; + ompi_osc_base_component_t *component = (ompi_osc_base_component_t*) cli->cli_component; + + /* see if this component is ready to run... */ + ret = component->osc_init(enable_progress_threads, enable_mpi_threads); + if (OMPI_SUCCESS != ret) { + /* not available. close the component */ + opal_list_remove_item(&ompi_osc_base_framework.framework_components, &cli->super); + mca_base_component_close((mca_base_component_t *)component, + ompi_osc_base_framework.framework_output); + OBJ_RELEASE(cli); + } + } + return OMPI_SUCCESS; +} + +int +ompi_osc_base_finalize(void) +{ + opal_list_item_t* item; + + /* Finalize all available modules */ + while (NULL != + (item = opal_list_remove_first(&ompi_osc_base_framework.framework_components))) { + ompi_osc_base_component_t *component = (ompi_osc_base_component_t*) + ((mca_base_component_list_item_t*) item)->cli_component; + component->osc_finalize(); + } + return OMPI_SUCCESS; +} + +MCA_BASE_FRAMEWORK_DECLARE(ompi, osc, "One-sided communication", NULL, NULL, NULL, + mca_osc_base_static_components, 0); diff --git a/ompi/mca/osc/base/osc_base_init.c b/ompi/mca/osc/base/osc_base_init.c index 6dd26eb444..8e02ac00c4 100644 --- a/ompi/mca/osc/base/osc_base_init.c +++ b/ompi/mca/osc/base/osc_base_init.c @@ -34,13 +34,13 @@ ompi_osc_base_select(ompi_win_t *win, ompi_osc_base_component_t *best_component = NULL; int best_priority = -1, priority; - if (opal_list_get_size(&ompi_osc_base_avail_components) <= 0) { + if (opal_list_get_size(&ompi_osc_base_framework.framework_components) <= 0) { /* we don't have any components to support us... */ return OMPI_ERR_NOT_SUPPORTED; } - for (item = opal_list_get_first(&ompi_osc_base_avail_components) ; - item != opal_list_get_end(&ompi_osc_base_avail_components) ; + for (item = opal_list_get_first(&ompi_osc_base_framework.framework_components) ; + item != opal_list_get_end(&ompi_osc_base_framework.framework_components) ; item = opal_list_get_next(item)) { ompi_osc_base_component_t *component = (ompi_osc_base_component_t*) ((mca_base_component_list_item_t*) item)->cli_component; diff --git a/ompi/mca/osc/base/osc_base_open.c b/ompi/mca/osc/base/osc_base_open.c deleted file mode 100644 index 2a5e482632..0000000000 --- a/ompi/mca/osc/base/osc_base_open.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2004-2005 The Trustees of the University of Tennessee. - * All rights reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" -#include "ompi/constants.h" - -#include "opal/mca/mca.h" -#include "opal/util/output.h" -#include "opal/mca/base/base.h" - - -#include "ompi/mca/osc/osc.h" -#include "ompi/mca/osc/base/base.h" - - -/* - * The following file was created by configure. It contains extern - * statements and the definition of an array of pointers to each - * component's public mca_base_component_t struct. - */ - -#include "ompi/mca/osc/base/static-components.h" - - -opal_list_t ompi_osc_base_open_components; -opal_list_t ompi_osc_base_avail_components; -int ompi_osc_base_output = 0; - - -/** - * Function for finding and opening either all MCA components, or the one - * that was specifically requested via a MCA parameter. - */ -int -ompi_osc_base_open(void) -{ - int ret; - - /* setup the output stream */ - ompi_osc_base_output = opal_output_open(NULL); - - /* initialize the base code */ - OBJ_CONSTRUCT(&ompi_osc_base_open_components, opal_list_t); - OBJ_CONSTRUCT(&ompi_osc_base_avail_components, opal_list_t); - - /* Open up all available components */ - if (OMPI_SUCCESS != - (ret = mca_base_components_open("osc", ompi_osc_base_output, - mca_osc_base_static_components, - &ompi_osc_base_open_components, true))) { - return ret; - } - - /* All done */ - return OMPI_SUCCESS; -} - - -int -ompi_osc_base_find_available(bool enable_progress_threads, - bool enable_mpi_threads) -{ - opal_list_item_t *component_item, *tmp; - - for (component_item = opal_list_get_first(&ompi_osc_base_open_components) ; - component_item != opal_list_get_end(&ompi_osc_base_open_components) ; - component_item = opal_list_get_next(component_item)) { - int ret; - ompi_osc_base_component_t *component = (ompi_osc_base_component_t*) - ((mca_base_component_list_item_t*) component_item)->cli_component; - - /* see if this component is ready to run... */ - ret = component->osc_init(enable_progress_threads, enable_mpi_threads); - if (OMPI_SUCCESS != ret) { - /* leave the component in the list and move on */ - continue; - } else { - /* the component is useable on this node. put it in the - available list */ - tmp = component_item; - component_item = opal_list_remove_item(&ompi_osc_base_open_components, - component_item); - opal_list_append(&ompi_osc_base_avail_components, tmp); - } - } - - mca_base_components_close(0, &ompi_osc_base_open_components, NULL); - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt.c b/ompi/mca/osc/pt2pt/osc_pt2pt.c index 874e947a06..2d1ea1c0df 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt.c @@ -35,7 +35,7 @@ ompi_osc_pt2pt_module_free(ompi_win_t *win) int ret = OMPI_SUCCESS; ompi_osc_pt2pt_module_t *module = P2P_MODULE(win); - opal_output_verbose(1, ompi_osc_base_output, + opal_output_verbose(1, ompi_osc_base_framework.framework_output, "pt2pt component destroying window with id %d", ompi_comm_get_cid(module->p2p_comm)); diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_component.c b/ompi/mca/osc/pt2pt/osc_pt2pt_component.c index c58af5017e..5e4f1933da 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_component.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_component.c @@ -199,7 +199,7 @@ ompi_osc_pt2pt_component_select(ompi_win_t *win, ret = ompi_comm_dup(comm, &(module->p2p_comm)); if (ret != OMPI_SUCCESS) goto cleanup; - opal_output_verbose(1, ompi_osc_base_output, + opal_output_verbose(1, ompi_osc_base_framework.framework_output, "pt2pt component creating window with id %d", ompi_comm_get_cid(module->p2p_comm)); @@ -425,7 +425,7 @@ component_fragment_cb(ompi_request_t *request) datatype = ompi_osc_base_datatype_create(proc, &payload); if (NULL == datatype) { - opal_output(ompi_osc_base_output, + opal_output(ompi_osc_base_framework.framework_output, "Error recreating datatype. Aborting."); ompi_mpi_abort(module->p2p_comm, 1, false); } @@ -555,7 +555,7 @@ component_fragment_cb(ompi_request_t *request) break; default: - opal_output_verbose(5, ompi_osc_base_output, + opal_output_verbose(5, ompi_osc_base_framework.framework_output, "received one-sided packet for with unknown type"); } diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_data_move.c b/ompi/mca/osc/pt2pt/osc_pt2pt_data_move.c index 3a04773185..c3d79010f0 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_data_move.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_data_move.c @@ -94,7 +94,7 @@ ompi_osc_pt2pt_sendreq_send_long_cb(ompi_request_t *request) ompi_osc_pt2pt_sendreq_t *sendreq = longreq->req_basereq.req_sendreq; int32_t count; - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d completed long sendreq to %d", ompi_comm_rank(sendreq->req_module->p2p_comm), sendreq->req_target_rank)); @@ -285,7 +285,7 @@ ompi_osc_pt2pt_sendreq_send(ompi_osc_pt2pt_module_t *module, #endif /* send fragment */ - OPAL_OUTPUT_VERBOSE((51, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((51, ompi_osc_base_framework.framework_output, "%d sending sendreq to %d", ompi_comm_rank(sendreq->req_module->p2p_comm), sendreq->req_target_rank)); @@ -308,7 +308,7 @@ ompi_osc_pt2pt_sendreq_send(ompi_osc_pt2pt_module_t *module, ompi_osc_pt2pt_longreq_alloc(&longreq); longreq->req_basereq.req_sendreq = sendreq; - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d starting long sendreq to %d (%d)", ompi_comm_rank(sendreq->req_module->p2p_comm), sendreq->req_target_rank, @@ -559,7 +559,7 @@ ompi_osc_pt2pt_sendreq_recv_put(ompi_osc_pt2pt_module_t *module, ompi_osc_base_datatype_create(proc, &inbuf); if (NULL == datatype) { - opal_output(ompi_osc_base_output, + opal_output(ompi_osc_base_framework.framework_output, "Error recreating datatype. Aborting."); ompi_mpi_abort(module->p2p_comm, 1, false); } @@ -696,7 +696,7 @@ ompi_osc_pt2pt_sendreq_recv_accum_long_cb(ompi_request_t *request) /* unlock the window for accumulates */ OPAL_THREAD_UNLOCK(&longreq->req_module->p2p_acc_lock); - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d finished receiving long accum message from %d", ompi_comm_rank(longreq->req_module->p2p_comm), header->hdr_origin)); @@ -732,7 +732,7 @@ ompi_osc_pt2pt_sendreq_recv_accum(ompi_osc_pt2pt_module_t *module, ((unsigned long)header->hdr_target_disp * module->p2p_win->w_disp_unit); if (NULL == datatype) { - opal_output(ompi_osc_base_output, + opal_output(ompi_osc_base_framework.framework_output, "Error recreating datatype. Aborting."); ompi_mpi_abort(module->p2p_comm, 1, false); } @@ -849,7 +849,7 @@ ompi_osc_pt2pt_sendreq_recv_accum(ompi_osc_pt2pt_module_t *module, inmsg_mark_complete(module); - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d received accum message from %d", ompi_comm_rank(module->p2p_comm), header->hdr_origin)); @@ -893,7 +893,7 @@ ompi_osc_pt2pt_sendreq_recv_accum(ompi_osc_pt2pt_module_t *module, ompi_osc_pt2pt_sendreq_recv_accum_long_cb, longreq); - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d started long recv accum message from %d (%d)", ompi_comm_rank(module->p2p_comm), header->hdr_origin, diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_sync.c b/ompi/mca/osc/pt2pt/osc_pt2pt_sync.c index 92345fa2a6..38ba5fac2a 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_sync.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_sync.c @@ -108,7 +108,7 @@ ompi_osc_pt2pt_module_fence(int assert, ompi_win_t *win) return ret; } - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "fence: waiting on %d in and %d out", module->p2p_num_pending_in, module->p2p_num_pending_out)); @@ -124,7 +124,7 @@ ompi_osc_pt2pt_module_fence(int assert, ompi_win_t *win) ret = ompi_osc_pt2pt_sendreq_send(module, req); if (OMPI_ERR_TEMP_OUT_OF_RESOURCE == ret) { - opal_output_verbose(5, ompi_osc_base_output, + opal_output_verbose(5, ompi_osc_base_framework.framework_output, "complete: failure in starting sendreq (%d). Will try later.", ret); opal_list_append(&(module->p2p_copy_pending_sendreqs), item); @@ -269,7 +269,7 @@ ompi_osc_pt2pt_module_complete(ompi_win_t *win) ret = ompi_osc_pt2pt_sendreq_send(module, req); if (OMPI_ERR_TEMP_OUT_OF_RESOURCE == ret) { - opal_output_verbose(5, ompi_osc_base_output, + opal_output_verbose(5, ompi_osc_base_framework.framework_output, "complete: failure in starting sendreq (%d). Will try later.", ret); opal_list_append(&(module->p2p_copy_pending_sendreqs), item); @@ -417,7 +417,7 @@ ompi_osc_pt2pt_module_lock(int lock_type, ompi_win_remove_mode(win, OMPI_WIN_FENCE); ompi_win_append_mode(win, OMPI_WIN_ACCESS_EPOCH | OMPI_WIN_LOCK_ACCESS); - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d: sending lock request to %d", ompi_comm_rank(module->p2p_comm), target)); @@ -474,7 +474,7 @@ ompi_osc_pt2pt_module_unlock(int target, OPAL_THREAD_UNLOCK(&module->p2p_lock); /* send the unlock request */ - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d: sending unlock request to %d with %d requests", ompi_comm_rank(module->p2p_comm), target, out_count)); @@ -492,7 +492,7 @@ ompi_osc_pt2pt_module_unlock(int target, ret = ompi_osc_pt2pt_sendreq_send(module, req); if (OMPI_ERR_TEMP_OUT_OF_RESOURCE == ret) { - opal_output_verbose(5, ompi_osc_base_output, + opal_output_verbose(5, ompi_osc_base_framework.framework_output, "complete: failure in starting sendreq (%d). Will try later.", ret); opal_list_append(&(module->p2p_copy_pending_sendreqs), item); @@ -508,7 +508,7 @@ ompi_osc_pt2pt_module_unlock(int target, } OPAL_THREAD_UNLOCK(&module->p2p_lock); - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d: finished unlock to %d", ompi_comm_rank(module->p2p_comm), target)); @@ -533,13 +533,13 @@ ompi_osc_pt2pt_passive_lock(ompi_osc_pt2pt_module_t *module, if (lock_type == MPI_LOCK_EXCLUSIVE) { if (module->p2p_lock_status == 0) { module->p2p_lock_status = MPI_LOCK_EXCLUSIVE; - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d: setting lock status to EXCLUSIVE (from %d)", ompi_comm_rank(module->p2p_comm), origin)); ompi_win_append_mode(module->p2p_win, OMPI_WIN_EXPOSE_EPOCH); send_ack = true; } else { - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d: queuing lock request from %d (type=%d)", ompi_comm_rank(module->p2p_comm), origin, lock_type)); new_pending = OBJ_NEW(ompi_osc_pt2pt_pending_lock_t); @@ -551,13 +551,13 @@ ompi_osc_pt2pt_passive_lock(ompi_osc_pt2pt_module_t *module, if (module->p2p_lock_status != MPI_LOCK_EXCLUSIVE) { module->p2p_lock_status = MPI_LOCK_SHARED; module->p2p_shared_count++; - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d: setting lock status to SHARED (from %d), count %d", ompi_comm_rank(module->p2p_comm), origin, module->p2p_shared_count)); ompi_win_append_mode(module->p2p_win, OMPI_WIN_EXPOSE_EPOCH); send_ack = true; } else { - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d: queuing lock request from %d (type=%d)", ompi_comm_rank(module->p2p_comm), origin, lock_type)); new_pending = OBJ_NEW(ompi_osc_pt2pt_pending_lock_t); @@ -571,7 +571,7 @@ ompi_osc_pt2pt_passive_lock(ompi_osc_pt2pt_module_t *module, OPAL_THREAD_UNLOCK(&(module->p2p_lock)); if (send_ack) { - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d: sending lock ack to %d", ompi_comm_rank(module->p2p_comm), origin)); ompi_osc_pt2pt_control_send(module, proc, @@ -594,7 +594,7 @@ ompi_osc_pt2pt_passive_unlock(ompi_osc_pt2pt_module_t *module, assert(module->p2p_lock_status != 0); - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d: received unlock request from %d with %d requests\n", ompi_comm_rank(module->p2p_comm), origin, count)); @@ -630,7 +630,7 @@ ompi_osc_pt2pt_passive_unlock_complete(ompi_osc_pt2pt_module_t *module) module->p2p_lock_status = 0; } else { module->p2p_shared_count -= opal_list_get_size(&module->p2p_unlocks_pending); - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d: decrementing shared count to %d", ompi_comm_rank(module->p2p_comm), module->p2p_shared_count)); @@ -651,7 +651,7 @@ ompi_osc_pt2pt_passive_unlock_complete(ompi_osc_pt2pt_module_t *module) /* issue whichever unlock acks we should issue */ while (NULL != (new_pending = (ompi_osc_pt2pt_pending_lock_t*) opal_list_remove_first(©_unlock_acks))) { - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d: sending unlock ack to proc %d", ompi_comm_rank(module->p2p_comm), new_pending->proc->proc_name.vpid)); @@ -671,7 +671,7 @@ ompi_osc_pt2pt_passive_unlock_complete(ompi_osc_pt2pt_module_t *module) new_pending = (ompi_osc_pt2pt_pending_lock_t*) opal_list_remove_first(&(module->p2p_locks_pending)); if (NULL != new_pending) { - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d: sending lock ack to proc %d", ompi_comm_rank(module->p2p_comm), new_pending->proc->proc_name.vpid)); diff --git a/ompi/mca/osc/rdma/osc_rdma.c b/ompi/mca/osc/rdma/osc_rdma.c index 8226bc5496..45d962d43f 100644 --- a/ompi/mca/osc/rdma/osc_rdma.c +++ b/ompi/mca/osc/rdma/osc_rdma.c @@ -36,7 +36,7 @@ ompi_osc_rdma_module_free(ompi_win_t *win) int i; ompi_osc_rdma_module_t *module = GET_MODULE(win); - opal_output_verbose(1, ompi_osc_base_output, + opal_output_verbose(1, ompi_osc_base_framework.framework_output, "rdma component destroying window with id %d", ompi_comm_get_cid(module->m_comm)); diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index 7f518732d4..088a2544dc 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -256,7 +256,7 @@ ompi_osc_rdma_component_finalize(void) if (0 != (num_modules = opal_hash_table_get_size(&mca_osc_rdma_component.c_modules))) { - opal_output(ompi_osc_base_output, + opal_output(ompi_osc_base_framework.framework_output, "WARNING: There were %d Windows created but not freed.", (int) num_modules); } @@ -324,7 +324,7 @@ ompi_osc_rdma_component_select(ompi_win_t *win, ret = ompi_comm_dup(comm, &module->m_comm); if (ret != OMPI_SUCCESS) goto cleanup; - opal_output_verbose(1, ompi_osc_base_output, + opal_output_verbose(1, ompi_osc_base_framework.framework_output, "rdma component creating window with id %d", ompi_comm_get_cid(module->m_comm)); @@ -446,7 +446,7 @@ ompi_osc_rdma_component_select(ompi_win_t *win, } if (OMPI_SUCCESS != ret) goto cleanup; - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "done creating window %d", ompi_comm_get_cid(module->m_comm))); return OMPI_SUCCESS; @@ -610,7 +610,7 @@ component_fragment_cb(struct mca_btl_base_module_t *btl, datatype = ompi_osc_base_datatype_create(proc, &payload); if (NULL == datatype) { - opal_output(ompi_osc_base_output, + opal_output(ompi_osc_base_framework.framework_output, "Error recreating datatype. Aborting."); ompi_mpi_abort(module->m_comm, 1, false); } @@ -866,12 +866,12 @@ component_fragment_cb(struct mca_btl_base_module_t *btl, endpoint = (mca_bml_base_endpoint_t*) proc->proc_bml; bml_btl = mca_bml_base_btl_array_find(&endpoint->btl_rdma, btl); if (NULL == bml_btl) { - opal_output(ompi_osc_base_output, + opal_output(ompi_osc_base_framework.framework_output, "received rdma info for unknown btl from rank %d", origin); return; } else { - OPAL_OUTPUT_VERBOSE((1, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((1, ompi_osc_base_framework.framework_output, "received rdma info from rank %d for BTL %s", origin, bml_btl->btl-> @@ -903,7 +903,7 @@ component_fragment_cb(struct mca_btl_base_module_t *btl, default: /* BWB - FIX ME - this sucks */ - opal_output(ompi_osc_base_output, + opal_output(ompi_osc_base_framework.framework_output, "received packet for Window with unknown type"); } diff --git a/ompi/mca/osc/rdma/osc_rdma_data_move.c b/ompi/mca/osc/rdma/osc_rdma_data_move.c index 0ee8d92305..b08b3407f1 100644 --- a/ompi/mca/osc/rdma/osc_rdma_data_move.c +++ b/ompi/mca/osc/rdma/osc_rdma_data_move.c @@ -262,7 +262,7 @@ ompi_osc_rdma_sendreq_send_long_cb(ompi_request_t *request) ompi_osc_rdma_sendreq_t *sendreq = longreq->req_basereq.req_sendreq; int32_t count; - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d completed long sendreq to %d", ompi_comm_rank(sendreq->req_module->m_comm), sendreq->req_target_rank)); @@ -339,7 +339,7 @@ ompi_osc_rdma_sendreq_send_cb(struct mca_btl_base_module_t* btl, longreq->req_basereq.req_sendreq = sendreq; - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d starting long sendreq to %d (%d)", ompi_comm_rank(sendreq->req_module->m_comm), sendreq->req_target_rank, @@ -386,7 +386,7 @@ ompi_osc_rdma_sendreq_send_cb(struct mca_btl_base_module_t* btl, int ret, i, len; len = opal_list_get_size(&module->m_queued_sendreqs); - OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_framework.framework_output, "%d items in restart queue", len)); for (i = 0 ; i < len ; ++i) { @@ -618,7 +618,7 @@ ompi_osc_rdma_sendreq_send(ompi_osc_rdma_module_t *module, #endif /* send fragment */ - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d sending sendreq to %d", ompi_comm_rank(sendreq->req_module->m_comm), sendreq->req_target_rank)); @@ -827,7 +827,7 @@ ompi_osc_rdma_sendreq_recv_put_long_cb(ompi_request_t *request) OBJ_RELEASE(longreq->req_datatype); - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d finished receiving long put message", ompi_comm_rank(longreq->req_module->m_comm))); @@ -853,7 +853,7 @@ ompi_osc_rdma_sendreq_recv_put(ompi_osc_rdma_module_t *module, ompi_osc_base_datatype_create(proc, inbuf); if (NULL == datatype) { - opal_output(ompi_osc_base_output, + opal_output(ompi_osc_base_framework.framework_output, "Error recreating datatype. Aborting."); ompi_mpi_abort(module->m_comm, 1, false); } @@ -894,7 +894,7 @@ ompi_osc_rdma_sendreq_recv_put(ompi_osc_rdma_module_t *module, inmsg_mark_complete(module); *inbuf = ((char*) *inbuf) + header->hdr_msg_length; - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d received put message from %d", ompi_comm_rank(module->m_comm), header->hdr_origin)); @@ -915,7 +915,7 @@ ompi_osc_rdma_sendreq_recv_put(ompi_osc_rdma_module_t *module, ompi_osc_rdma_sendreq_recv_put_long_cb, longreq); - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d started long recv put message from %d (%d)", ompi_comm_rank(module->m_comm), header->hdr_origin, @@ -997,7 +997,7 @@ ompi_osc_rdma_sendreq_recv_accum_long_cb(ompi_request_t *request) /* unlock the window for accumulates */ OPAL_THREAD_UNLOCK(&longreq->req_module->m_acc_lock); - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d finished receiving long accum message from %d", ompi_comm_rank(longreq->req_module->m_comm), header->hdr_origin)); @@ -1031,7 +1031,7 @@ ompi_osc_rdma_sendreq_recv_accum(ompi_osc_rdma_module_t *module, ompi_osc_base_datatype_create(proc, payload); if (NULL == datatype) { - opal_output(ompi_osc_base_output, + opal_output(ompi_osc_base_framework.framework_output, "Error recreating datatype. Aborting."); ompi_mpi_abort(module->m_comm, 1, false); } @@ -1153,7 +1153,7 @@ ompi_osc_rdma_sendreq_recv_accum(ompi_osc_rdma_module_t *module, inmsg_mark_complete(module); - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d received accum message from %d", ompi_comm_rank(module->m_comm), header->hdr_origin)); @@ -1199,7 +1199,7 @@ ompi_osc_rdma_sendreq_recv_accum(ompi_osc_rdma_module_t *module, ompi_osc_rdma_sendreq_recv_accum_long_cb, longreq); - OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "%d started long recv accum message from %d (%d)", ompi_comm_rank(module->m_comm), header->hdr_origin, diff --git a/ompi/mca/osc/rdma/osc_rdma_sync.c b/ompi/mca/osc/rdma/osc_rdma_sync.c index 12b3c0e00c..4431e506fe 100644 --- a/ompi/mca/osc/rdma/osc_rdma_sync.c +++ b/ompi/mca/osc/rdma/osc_rdma_sync.c @@ -113,7 +113,7 @@ ompi_osc_rdma_module_fence(int assert, ompi_win_t *win) here */ len = opal_list_get_size(&(module->m_copy_pending_sendreqs)); started_send = 0; - OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_framework.framework_output, "fence: trying to start %d reqs", len)); for (i = 0 ; i < len ; ++i) { @@ -132,7 +132,7 @@ ompi_osc_rdma_module_fence(int assert, ompi_win_t *win) will restart the rest. */ while (0 == started_send && len != 0) { opal_progress(); - OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_framework.framework_output, "fence: restarting %d reqs", len)); len = opal_list_get_size(&(module->m_copy_pending_sendreqs)); for (i = 0 ; i < len ; ++i) { @@ -149,7 +149,7 @@ ompi_osc_rdma_module_fence(int assert, ompi_win_t *win) } } } - OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_framework.framework_output, "fence: done with initial start")); if (module->m_use_rdma) { @@ -194,7 +194,7 @@ ompi_osc_rdma_module_fence(int assert, ompi_win_t *win) module->m_num_pending_in += incoming_reqs; module->m_num_pending_out += num_outgoing; - OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_framework.framework_output, "fence: waiting on %d in and %d out, now %d, %d", incoming_reqs, num_outgoing, @@ -512,7 +512,7 @@ ompi_osc_rdma_module_lock(int lock_type, ompi_win_remove_mode(win, OMPI_WIN_FENCE); ompi_win_append_mode(win, OMPI_WIN_ACCESS_EPOCH | OMPI_WIN_LOCK_ACCESS); - OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_framework.framework_output, "%d sending lock request to %d", ompi_comm_rank(module->m_comm), target)); /* generate a lock request */ @@ -570,7 +570,7 @@ ompi_osc_rdma_module_unlock(int target, OPAL_THREAD_UNLOCK(&module->m_lock); /* send the unlock request */ - OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_framework.framework_output, "%d sending unlock request to %d with %d requests", ompi_comm_rank(module->m_comm), target, out_count)); @@ -640,7 +640,7 @@ ompi_osc_rdma_passive_lock(ompi_osc_rdma_module_t *module, ompi_win_append_mode(module->m_win, OMPI_WIN_EXPOSE_EPOCH); send_ack = true; } else { - OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_framework.framework_output, "%d queuing lock request from %d (%d)", ompi_comm_rank(module->m_comm), origin, lock_type)); @@ -656,7 +656,7 @@ ompi_osc_rdma_passive_lock(ompi_osc_rdma_module_t *module, ompi_win_append_mode(module->m_win, OMPI_WIN_EXPOSE_EPOCH); send_ack = true; } else { - OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_framework.framework_output, "queuing lock request from %d (%d) lock_type:%d", ompi_comm_rank(module->m_comm), origin, lock_type)); @@ -671,7 +671,7 @@ ompi_osc_rdma_passive_lock(ompi_osc_rdma_module_t *module, OPAL_THREAD_UNLOCK(&(module->m_lock)); if (send_ack) { - OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_framework.framework_output, "%d sending lock ack to %d", ompi_comm_rank(module->m_comm), origin)); ompi_osc_rdma_control_send(module, proc, @@ -694,7 +694,7 @@ ompi_osc_rdma_passive_unlock(ompi_osc_rdma_module_t *module, assert(module->m_lock_status != 0); - OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_framework.framework_output, "received unlock request from %d with %d requests\n", origin, count)); @@ -746,7 +746,7 @@ ompi_osc_rdma_passive_unlock_complete(ompi_osc_rdma_module_t *module) /* issue whichever unlock acks we should issue */ while (NULL != (new_pending = (ompi_osc_rdma_pending_lock_t*) opal_list_remove_first(©_unlock_acks))) { - OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_framework.framework_output, "sending unlock reply to proc")); ompi_osc_rdma_control_send(module, new_pending->proc, @@ -777,7 +777,7 @@ ompi_osc_rdma_passive_unlock_complete(ompi_osc_rdma_module_t *module) OPAL_THREAD_UNLOCK(&(module->m_lock)); if (NULL != new_pending) { - OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_output, + OPAL_OUTPUT_VERBOSE((40, ompi_osc_base_framework.framework_output, "sending lock request to proc")); ompi_osc_rdma_control_send(module, new_pending->proc, diff --git a/ompi/mca/pml/base/Makefile.am b/ompi/mca/pml/base/Makefile.am index 49b44e4ab0..a5b8245a1c 100644 --- a/ompi/mca/pml/base/Makefile.am +++ b/ompi/mca/pml/base/Makefile.am @@ -9,6 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. +# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -26,8 +27,7 @@ headers += \ libmca_pml_la_SOURCES += \ base/pml_base_bsend.c \ - base/pml_base_close.c \ - base/pml_base_open.c \ + base/pml_base_frame.c \ base/pml_base_recvreq.c \ base/pml_base_request.c \ base/pml_base_select.c \ diff --git a/ompi/mca/pml/base/base.h b/ompi/mca/pml/base/base.h index 933b7d899a..ea7fd06017 100644 --- a/ompi/mca/pml/base/base.h +++ b/ompi/mca/pml/base/base.h @@ -10,6 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,10 +24,12 @@ #include "ompi_config.h" #include "opal/mca/mca.h" -#include "ompi/mca/pml/pml.h" +#include "opal/mca/base/mca_base_framework.h" #include "opal/class/opal_list.h" #include "opal/class/opal_pointer_array.h" +#include "ompi/mca/pml/pml.h" + /* * Global functions for the PML */ @@ -40,10 +43,16 @@ BEGIN_C_DECLS */ #define PML_SELECT_WRAPPER_PRIORITY -128 -OMPI_DECLSPEC int mca_pml_base_open(void); -OMPI_DECLSPEC int mca_pml_base_progress(void); +/* + * MCA framework + */ +OMPI_DECLSPEC extern mca_base_framework_t ompi_pml_base_framework; +/* + * Select an available component. + */ OMPI_DECLSPEC int mca_pml_base_select(bool enable_progress_threads, bool enable_mpi_threads); +OMPI_DECLSPEC int mca_pml_base_progress(void); /* share in modex the name of the selected component */ OMPI_DECLSPEC int mca_pml_base_pml_selected(const char *name); /* verify that all new procs are using the currently selected component */ @@ -53,15 +62,11 @@ OMPI_DECLSPEC int mca_pml_base_pml_check_selected(const char *my_pml, OMPI_DECLSPEC int mca_pml_base_finalize(void); -OMPI_DECLSPEC int mca_pml_base_close(void); - OMPI_DECLSPEC int mca_pml_base_ft_event(int state); /* * Globals */ -OMPI_DECLSPEC extern int mca_pml_base_output; -OMPI_DECLSPEC extern opal_list_t mca_pml_base_components_available; OMPI_DECLSPEC extern mca_pml_base_component_t mca_pml_base_selected_component; OMPI_DECLSPEC extern mca_pml_base_module_t mca_pml; OMPI_DECLSPEC extern opal_pointer_array_t mca_pml_base_pml; diff --git a/ompi/mca/pml/base/pml_base_close.c b/ompi/mca/pml/base/pml_base_close.c deleted file mode 100644 index a8cc5a411b..0000000000 --- a/ompi/mca/pml/base/pml_base_close.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include - -#include "ompi/constants.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "ompi/mca/pml/pml.h" -#include "ompi/mca/pml/base/base.h" -#include "ompi/mca/pml/base/pml_base_request.h" -#include "opal/runtime/opal_progress.h" - - -int mca_pml_base_finalize(void) { - if (NULL != mca_pml_base_selected_component.pmlm_finalize) { - return mca_pml_base_selected_component.pmlm_finalize(); - } - return OMPI_SUCCESS; -} - - -int mca_pml_base_close(void) -{ - int i, j; - - /* turn off the progress code for the pml */ - if( NULL != mca_pml.pml_progress ) { - opal_progress_unregister(mca_pml.pml_progress); - } - - /* Blatently ignore the return code (what would we do to recover, - anyway? This module is going away, so errors don't matter - anymore) */ - - /** - * Destruct the send and receive queues. The ompi_free_list_t destructor - * will return the memory to the mpool, so this has to be done before the - * mpool get released by the PML close function. - */ - OBJ_DESTRUCT(&mca_pml_base_send_requests); - OBJ_DESTRUCT(&mca_pml_base_recv_requests); - - mca_pml.pml_progress = mca_pml_base_progress; - - /* Free all the strings in the array */ - j = opal_pointer_array_get_size(&mca_pml_base_pml); - for (i = 0; i < j; ++i) { - char *str; - str = (char*) opal_pointer_array_get_item(&mca_pml_base_pml, i); - free(str); - } - OBJ_DESTRUCT(&mca_pml_base_pml); - - /* Close all remaining available modules (may be one if this is a - OMPI RTE program, or [possibly] multiple if this is ompi_info) */ - - mca_base_components_close(mca_pml_base_output, - &mca_pml_base_components_available, NULL); - - /* Close the framework output */ - opal_output_close (mca_pml_base_output); - mca_pml_base_output = -1; - - /* All done */ - - return OMPI_SUCCESS; -} - diff --git a/ompi/mca/pml/base/pml_base_open.c b/ompi/mca/pml/base/pml_base_frame.c similarity index 77% rename from ompi/mca/pml/base/pml_base_open.c rename to ompi/mca/pml/base/pml_base_frame.c index adf35a0e6b..71c7decdfc 100644 --- a/ompi/mca/pml/base/pml_base_open.c +++ b/ompi/mca/pml/base/pml_base_frame.c @@ -11,6 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -57,7 +58,6 @@ int mca_pml_base_progress(void) /* * Global variables */ -int mca_pml_base_output = 0; mca_pml_base_module_t mca_pml = { NULL, /* pml_add_procs */ NULL, /* pml_del_procs */ @@ -80,18 +80,15 @@ mca_pml_base_module_t mca_pml = { 0 /* pml_max_tag */ }; -opal_list_t mca_pml_base_components_available; mca_pml_base_component_t mca_pml_base_selected_component; opal_pointer_array_t mca_pml_base_pml; char *ompi_pml_base_bsend_allocator_name; -static int ompi_pml_base_verbose = 0; - #if !MCA_ompi_pml_DIRECT_CALL && OPAL_ENABLE_FT_CR == 1 static char *ompi_pml_base_wrapper = NULL; #endif -static int pml_base_register(int flags) +static int mca_pml_base_register(mca_base_register_flag_t flags) { #if !MCA_ompi_pml_DIRECT_CALL && OPAL_ENABLE_FT_CR == 1 int var_id; @@ -104,14 +101,6 @@ static int pml_base_register(int flags) MCA_BASE_VAR_SCOPE_READONLY, &ompi_pml_base_bsend_allocator_name); - ompi_pml_base_verbose = 0; - (void) mca_base_var_register("ompi", "pml", "base", "verbose", - "Verbosity level of the PML framework", - MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &ompi_pml_base_verbose); - #if !MCA_ompi_pml_DIRECT_CALL && OPAL_ENABLE_FT_CR == 1 ompi_pml_base_wrapper = NULL; var_id = mca_base_var_register("ompi", "pml", "base", "wrapper", @@ -126,26 +115,60 @@ static int pml_base_register(int flags) return OMPI_SUCCESS; } +int mca_pml_base_finalize(void) { + if (NULL != mca_pml_base_selected_component.pmlm_finalize) { + return mca_pml_base_selected_component.pmlm_finalize(); + } + return OMPI_SUCCESS; +} + + +static int mca_pml_base_close(void) +{ + int i, j; + + /* turn off the progress code for the pml */ + if( NULL != mca_pml.pml_progress ) { + opal_progress_unregister(mca_pml.pml_progress); + } + + /* Blatently ignore the return code (what would we do to recover, + anyway? This module is going away, so errors don't matter + anymore) */ + + /** + * Destruct the send and receive queues. The ompi_free_list_t destructor + * will return the memory to the mpool, so this has to be done before the + * mpool get released by the PML close function. + */ + OBJ_DESTRUCT(&mca_pml_base_send_requests); + OBJ_DESTRUCT(&mca_pml_base_recv_requests); + + mca_pml.pml_progress = mca_pml_base_progress; + + /* Free all the strings in the array */ + j = opal_pointer_array_get_size(&mca_pml_base_pml); + for (i = 0; i < j; ++i) { + char *str; + str = (char*) opal_pointer_array_get_item(&mca_pml_base_pml, i); + free(str); + } + OBJ_DESTRUCT(&mca_pml_base_pml); + + /* Close all remaining available components */ + return mca_base_framework_components_close(&ompi_pml_base_framework, NULL); +} + /** * Function for finding and opening either all MCA components, or the one * that was specifically requested via a MCA parameter. */ -int mca_pml_base_open(void) +static int mca_pml_base_open(mca_base_open_flag_t flags) { #if OPAL_ENABLE_FT_CR == 1 char* wrapper_pml = NULL; #endif - (void) pml_base_register(0); - - /* - * Register some MCA parameters - */ - /* Debugging/Verbose output */ - - mca_pml_base_output = opal_output_open(NULL); - opal_output_set_verbosity(mca_pml_base_output, ompi_pml_base_verbose); - /** * Construct the send and receive request queues. There are 2 reasons to do it * here. First, as they are globals it's better to construct them in one common @@ -160,10 +183,8 @@ int mca_pml_base_open(void) /* Open up all available components */ - if (OMPI_SUCCESS != - mca_base_components_open("pml", mca_pml_base_output, mca_pml_base_static_components, - &mca_pml_base_components_available, - !MCA_ompi_pml_DIRECT_CALL)) { + if (OPAL_SUCCESS != + mca_base_framework_components_open(&ompi_pml_base_framework, flags)) { return OMPI_ERROR; } @@ -215,3 +236,7 @@ int mca_pml_base_open(void) return OMPI_SUCCESS; } + +MCA_BASE_FRAMEWORK_DECLARE(ompi, pml, "OMPI PML", mca_pml_base_register, + mca_pml_base_open, mca_pml_base_close, + mca_pml_base_static_components, 0); diff --git a/ompi/mca/pml/base/pml_base_select.c b/ompi/mca/pml/base/pml_base_select.c index 7870402ae8..d7dcfc37c2 100644 --- a/ompi/mca/pml/base/pml_base_select.c +++ b/ompi/mca/pml/base/pml_base_select.c @@ -80,10 +80,7 @@ int mca_pml_base_select(bool enable_progress_threads, best_component = NULL; module = NULL; OBJ_CONSTRUCT(&opened, opal_list_t); - for (item = opal_list_get_first(&mca_pml_base_components_available); - opal_list_get_end(&mca_pml_base_components_available) != item; - item = opal_list_get_next(item) ) { - cli = (mca_base_component_list_item_t *) item; + OPAL_LIST_FOREACH(cli, &ompi_pml_base_framework.framework_components, mca_base_component_list_item_t) { component = (mca_pml_base_component_t *) cli->cli_component; /* if there is an include list - item must be in the list to be included */ @@ -103,7 +100,7 @@ int mca_pml_base_select(bool enable_progress_threads, } if(!found_pml && opal_pointer_array_get_size(&mca_pml_base_pml)) { - opal_output_verbose( 10, mca_pml_base_output, + opal_output_verbose( 10, ompi_pml_base_framework.framework_output, "select: component %s not in the include list", component->pmlm_version.mca_component_name ); @@ -112,7 +109,7 @@ int mca_pml_base_select(bool enable_progress_threads, /* if there is no init function - ignore it */ if (NULL == component->pmlm_init) { - opal_output_verbose( 10, mca_pml_base_output, + opal_output_verbose( 10, ompi_pml_base_framework.framework_output, "select: no init function; ignoring component %s", component->pmlm_version.mca_component_name ); continue; @@ -122,7 +119,7 @@ int mca_pml_base_select(bool enable_progress_threads, num_pml++; /* Init component to get its priority */ - opal_output_verbose( 10, mca_pml_base_output, + opal_output_verbose( 10, ompi_pml_base_framework.framework_output, "select: initializing %s component %s", component->pmlm_version.mca_type_name, component->pmlm_version.mca_component_name ); @@ -130,18 +127,18 @@ int mca_pml_base_select(bool enable_progress_threads, module = component->pmlm_init(&priority, enable_progress_threads, enable_mpi_threads); if (NULL == module) { - opal_output_verbose( 10, mca_pml_base_output, + opal_output_verbose( 10, ompi_pml_base_framework.framework_output, "select: init returned failure for component %s", component->pmlm_version.mca_component_name ); continue; } - opal_output_verbose( 10, mca_pml_base_output, + opal_output_verbose( 10, ompi_pml_base_framework.framework_output, "select: init returned priority %d", priority ); #if OPAL_ENABLE_FT_CR == 1 /* Determine if this is the wrapper component */ if( priority <= PML_SELECT_WRAPPER_PRIORITY) { - opal_output_verbose( 10, mca_pml_base_output, + opal_output_verbose( 10, ompi_pml_base_framework.framework_output, "pml:select: Wrapper Component: Component %s was determined to be a Wrapper PML with priority %d", component->pmlm_version.mca_component_name, priority ); wrapper_priority = priority; @@ -184,7 +181,7 @@ int mca_pml_base_select(bool enable_progress_threads, } } - opal_output_verbose( 10, mca_pml_base_output, + opal_output_verbose( 10, ompi_pml_base_framework.framework_output, "selected %s best priority %d\n", best_component->pmlm_version.mca_component_name, best_priority); @@ -216,7 +213,7 @@ int mca_pml_base_select(bool enable_progress_threads, don't matter anymore) */ om->om_component->pmlm_finalize(); - opal_output_verbose(10, mca_pml_base_output, + opal_output_verbose(10, ompi_pml_base_framework.framework_output, "select: component %s not selected / finalized", om->om_component->pmlm_version.mca_component_name); } @@ -227,18 +224,15 @@ int mca_pml_base_select(bool enable_progress_threads, OBJ_DESTRUCT( &opened ); #if OPAL_ENABLE_FT_CR == 1 - /* Remove the wrapper component from the mca_pml_base_components_available list + /* Remove the wrapper component from the ompi_pml_base_framework.framework_components list * so we don't unload it prematurely in the next call */ if( NULL != wrapper_component ) { - for (item = opal_list_get_first(&mca_pml_base_components_available); - item != opal_list_get_end(&mca_pml_base_components_available); - item = opal_list_get_next(item) ) { - cli = (mca_base_component_list_item_t *) item; + OPAL_LIST_FOREACH(cli, &ompi_pml_base_framework.framework_components, mca_base_component_list_item_t) { component = (mca_pml_base_component_t *) cli->cli_component; if( component == wrapper_component ) { - opal_list_remove_item(&mca_pml_base_components_available, item); + opal_list_remove_item(&ompi_pml_base_framework.framework_components, item); } } } @@ -248,7 +242,7 @@ int mca_pml_base_select(bool enable_progress_threads, mca_pml_base_selected_component = *best_component; mca_pml = *best_module; - opal_output_verbose( 10, mca_pml_base_output, + opal_output_verbose( 10, ompi_pml_base_framework.framework_output, "select: component %s selected", mca_pml_base_selected_component.pmlm_version.mca_component_name ); @@ -256,15 +250,15 @@ int mca_pml_base_select(bool enable_progress_threads, available list all unselected components. The available list will contain only the selected component. */ - mca_base_components_close(mca_pml_base_output, - &mca_pml_base_components_available, + mca_base_components_close(ompi_pml_base_framework.framework_output, + &ompi_pml_base_framework.framework_components, (mca_base_component_t *) best_component); #if OPAL_ENABLE_FT_CR == 1 /* If we have a wrapper then initalize it */ if( NULL != wrapper_component ) { priority = PML_SELECT_WRAPPER_PRIORITY; - opal_output_verbose( 10, mca_pml_base_output, + opal_output_verbose( 10, ompi_pml_base_framework.framework_output, "pml:select: Wrapping: Component %s [%d] is being wrapped by component %s [%d]", mca_pml_base_selected_component.pmlm_version.mca_component_name, best_priority, @@ -333,14 +327,14 @@ mca_pml_base_pml_check_selected(const char *my_pml, * we can assume success */ if (!modex_reqd) { - opal_output_verbose( 10, mca_pml_base_output, + opal_output_verbose( 10, ompi_pml_base_framework.framework_output, "check:select: modex not reqd"); return OMPI_SUCCESS; } /* if we are rank=0, then we can also assume success */ if (0 == OMPI_PROC_MY_NAME->vpid) { - opal_output_verbose( 10, mca_pml_base_output, + opal_output_verbose( 10, ompi_pml_base_framework.framework_output, "check:select: rank=0"); return OMPI_SUCCESS; } @@ -352,7 +346,7 @@ mca_pml_base_pml_check_selected(const char *my_pml, /* if modex isn't implemented, then just assume all is well... */ if (OMPI_ERR_NOT_IMPLEMENTED == ret) { - opal_output_verbose( 10, mca_pml_base_output, + opal_output_verbose( 10, ompi_pml_base_framework.framework_output, "check:select: modex not implemented"); return OMPI_SUCCESS; } @@ -362,12 +356,12 @@ mca_pml_base_pml_check_selected(const char *my_pml, * is fast...let's be sure */ if (NULL == remote_pml) { - opal_output_verbose( 10, mca_pml_base_output, + opal_output_verbose( 10, ompi_pml_base_framework.framework_output, "check:select: got a NULL pml from rank=0"); return OMPI_ERR_UNREACH; } - opal_output_verbose( 10, mca_pml_base_output, + opal_output_verbose( 10, ompi_pml_base_framework.framework_output, "check:select: checking my pml %s against rank=0 pml %s", my_pml, remote_pml); diff --git a/ompi/mca/pml/bfo/pml_bfo_component.c b/ompi/mca/pml/bfo/pml_bfo_component.c index 7742a652bd..9611de3de0 100644 --- a/ompi/mca/pml/bfo/pml_bfo_component.c +++ b/ompi/mca/pml/bfo/pml_bfo_component.c @@ -169,7 +169,7 @@ static int mca_pml_bfo_component_open(void) } mca_pml_bfo.enabled = false; - return mca_bml_base_open(); + return mca_base_framework_open(&ompi_bml_base_framework, 0); } @@ -177,7 +177,7 @@ static int mca_pml_bfo_component_close(void) { int rc; - if (OMPI_SUCCESS != (rc = mca_bml_base_close())) { + if (OMPI_SUCCESS != (rc = mca_base_framework_close(&ompi_bml_base_framework))) { return rc; } opal_output_close(mca_pml_bfo_output); diff --git a/ompi/mca/pml/cm/pml_cm_component.c b/ompi/mca/pml/cm/pml_cm_component.c index 1d41a7c3c0..7d7a7d09ec 100644 --- a/ompi/mca/pml/cm/pml_cm_component.c +++ b/ompi/mca/pml/cm/pml_cm_component.c @@ -116,10 +116,10 @@ mca_pml_cm_component_open(void) { int ret; - ret = ompi_mtl_base_open(); + ret = mca_base_framework_open(&ompi_mtl_base_framework, 0); if (OMPI_SUCCESS == ret) { /* If no MTL components initialized CM component can be unloaded */ - if (0 == opal_list_get_size(&ompi_mtl_base_components_opened)) { + if (0 == opal_list_get_size(&ompi_mtl_base_framework.framework_components)) { ret = OPAL_ERR_NOT_AVAILABLE; } } @@ -131,7 +131,7 @@ mca_pml_cm_component_open(void) static int mca_pml_cm_component_close(void) { - return ompi_mtl_base_close(); + return mca_base_framework_close(&ompi_mtl_base_framework); } diff --git a/ompi/mca/pml/dr/pml_dr_component.c b/ompi/mca/pml/dr/pml_dr_component.c index 740e050759..283a5b0507 100644 --- a/ompi/mca/pml/dr/pml_dr_component.c +++ b/ompi/mca/pml/dr/pml_dr_component.c @@ -133,17 +133,12 @@ int mca_pml_dr_component_open(void) mca_pml_dr.ack_timer.tv_usec = mca_pml_dr_ack_timer_usec; mca_pml_dr.enabled = false; - return mca_bml_base_open(); + return mca_base_framework_open(&ompi_bml_base_framework, 0); } int mca_pml_dr_component_close(void) { - int rc; - - if(OMPI_SUCCESS != (rc = mca_bml_base_close())) - return rc; - - return OMPI_SUCCESS; + return mca_base_framework_close(&ompi_bml_base_framework); } mca_pml_base_module_t* mca_pml_dr_component_init(int* priority, diff --git a/ompi/mca/pml/ob1/pml_ob1_component.c b/ompi/mca/pml/ob1/pml_ob1_component.c index c9ff6f86ea..31d691b3d0 100644 --- a/ompi/mca/pml/ob1/pml_ob1_component.c +++ b/ompi/mca/pml/ob1/pml_ob1_component.c @@ -178,7 +178,7 @@ static int mca_pml_ob1_component_open(void) } mca_pml_ob1.enabled = false; - return mca_bml_base_open(); + return mca_base_framework_open(&ompi_bml_base_framework, 0); } @@ -186,7 +186,7 @@ static int mca_pml_ob1_component_close(void) { int rc; - if (OMPI_SUCCESS != (rc = mca_bml_base_close())) { + if (OMPI_SUCCESS != (rc = mca_base_framework_close(&ompi_bml_base_framework))) { return rc; } opal_output_close(mca_pml_ob1_output); diff --git a/ompi/mca/pml/v/pml_v_component.c b/ompi/mca/pml/v/pml_v_component.c index dfeaac1832..63c4af9b47 100644 --- a/ompi/mca/pml/v/pml_v_component.c +++ b/ompi/mca/pml/v/pml_v_component.c @@ -79,8 +79,7 @@ static int mca_pml_v_component_register(void) (void) mca_base_component_var_register(&mca_pml_v_component.pmlm_version, "verbose", "Verbosity of the pml v component", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, + OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY, &ompi_pml_v_verbose); ompi_pml_vprotocol_include_list = ""; @@ -88,8 +87,7 @@ static int mca_pml_v_component_register(void) var_id = mca_base_component_var_register(&mca_pml_v_component.pmlm_version, "vprotocol", "Specify a specific vprotocol to use", MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, + OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY, &ompi_pml_vprotocol_include_list); (void) mca_base_var_register_synonym(var_id, "ompi", "vprotocol", NULL, NULL, 0); @@ -98,15 +96,13 @@ static int mca_pml_v_component_register(void) static int mca_pml_v_component_open(void) { - int rc; - pml_v_output_open(ompi_pml_v_output, ompi_pml_v_verbose); V_OUTPUT_VERBOSE(500, "loaded"); - rc = mca_vprotocol_base_open(ompi_pml_vprotocol_include_list); + mca_vprotocol_base_set_include_list(ompi_pml_vprotocol_include_list); - return rc; + return mca_base_framework_open(&ompi_vprotocol_base_framework, 0); } static int mca_pml_v_component_close(void) @@ -154,7 +150,7 @@ static int mca_pml_v_component_parasite_finalize(void) mca_pml_v_component_parasite_close; cli = OBJ_NEW(mca_base_component_list_item_t); cli->cli_component = (mca_base_component_t *) &mca_pml_v_component; - opal_list_prepend(&mca_pml_base_components_available, + opal_list_prepend(&ompi_pml_base_framework.framework_components, (opal_list_item_t *) cli); /* finalize vprotocol component */ @@ -173,7 +169,7 @@ static int mca_pml_v_component_parasite_close(void) mca_pml_v.host_pml_component.pmlm_version.mca_component_name); mca_pml_base_selected_component = mca_pml_v.host_pml_component; - mca_vprotocol_base_close(); + (void) mca_base_framework_close(&ompi_vprotocol_base_framework); pml_v_output_close(); mca_pml.pml_enable = mca_pml_v.host_pml.pml_enable; diff --git a/ompi/mca/pubsub/base/Makefile.am b/ompi/mca/pubsub/base/Makefile.am index 75ab889a29..93e159113f 100644 --- a/ompi/mca/pubsub/base/Makefile.am +++ b/ompi/mca/pubsub/base/Makefile.am @@ -9,6 +9,8 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. +# Copyright (c) 2013 Los Alamos National Security, LLC. +# All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -20,8 +22,7 @@ headers += \ base/base.h libmca_pubsub_la_SOURCES += \ - base/pubsub_base_open.c \ - base/pubsub_base_close.c \ + base/pubsub_base_frame.c \ base/pubsub_base_select.c \ base/pubsub_base_null_fns.c diff --git a/ompi/mca/pubsub/base/base.h b/ompi/mca/pubsub/base/base.h index 64541bb354..d7dc1e707b 100644 --- a/ompi/mca/pubsub/base/base.h +++ b/ompi/mca/pubsub/base/base.h @@ -9,6 +9,8 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, LLC. + * All rights reserved * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,46 +31,21 @@ BEGIN_C_DECLS -/** - * Initialize the PUBSUB MCA framework - * - * @retval OMPI_SUCCESS Upon success - * @retval OMPI_ERROR Upon failures - * - * This function is invoked during ompi_init(); +/* + * MCA framework */ -OMPI_DECLSPEC int ompi_pubsub_base_open(void); - -/** +OMPI_DECLSPEC extern mca_base_framework_t ompi_pubsub_base_framework; +/* * Select an available component. - * - * @retval OMPI_SUCCESS Upon Success - * @retval OMPI_NOT_FOUND If no component can be selected - * @retval OMPI_ERROR Upon other failure - * */ OMPI_DECLSPEC int ompi_pubsub_base_select(void); -/** - * Finalize the PUBSUB MCA framework - * - * @retval OMPI_SUCCESS Upon success - * @retval OMPI_ERROR Upon failures - * - * This function is invoked during ompi_finalize(); - */ -OMPI_DECLSPEC int ompi_pubsub_base_close(void); - - /* NULL functions */ OMPI_DECLSPEC int ompi_pubsub_base_null_publish(char *service, ompi_info_t *info, char *port); OMPI_DECLSPEC int ompi_pubsub_base_null_unpublish(char *service, ompi_info_t *info); OMPI_DECLSPEC char* ompi_pubsub_base_null_lookup(char *service, ompi_info_t *info); /* useful globals */ -OMPI_DECLSPEC extern int ompi_pubsub_base_output; -OMPI_DECLSPEC extern opal_list_t ompi_pubsub_base_components_available; -OMPI_DECLSPEC extern ompi_pubsub_base_component_t ompi_pubsub_base_selected_component; OMPI_DECLSPEC extern ompi_pubsub_base_module_t ompi_pubsub; END_C_DECLS diff --git a/ompi/mca/pubsub/base/pubsub_base_close.c b/ompi/mca/pubsub/base/pubsub_base_close.c deleted file mode 100644 index 1d76726883..0000000000 --- a/ompi/mca/pubsub/base/pubsub_base_close.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2004-2007 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2004-2005 The Trustees of the University of Tennessee. - * All rights reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" - -#include "ompi/mca/pubsub/pubsub.h" -#include "ompi/mca/pubsub/base/base.h" -#include "opal/util/output.h" - -int ompi_pubsub_base_close(void) -{ - /* Close the selected component */ - if( NULL != ompi_pubsub.finalize ) { - ompi_pubsub.finalize(); - } - - /* Close all available modules that are open */ - mca_base_components_close(ompi_pubsub_base_output, - &ompi_pubsub_base_components_available, - NULL); - - /* Close the framework output */ - opal_output_close (ompi_pubsub_base_output); - ompi_pubsub_base_output = -1; - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/pubsub/base/pubsub_base_open.c b/ompi/mca/pubsub/base/pubsub_base_frame.c similarity index 60% rename from ompi/mca/pubsub/base/pubsub_base_open.c rename to ompi/mca/pubsub/base/pubsub_base_frame.c index f676eadd97..2865e54166 100644 --- a/ompi/mca/pubsub/base/pubsub_base_open.c +++ b/ompi/mca/pubsub/base/pubsub_base_frame.c @@ -7,6 +7,8 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, LLC. + * All rights reserved * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,7 +31,6 @@ /* * Globals */ -OMPI_DECLSPEC int ompi_pubsub_base_output = -1; OMPI_DECLSPEC ompi_pubsub_base_module_t ompi_pubsub={ NULL, ompi_pubsub_base_null_publish, @@ -37,27 +38,27 @@ OMPI_DECLSPEC ompi_pubsub_base_module_t ompi_pubsub={ ompi_pubsub_base_null_lookup, NULL }; -opal_list_t ompi_pubsub_base_components_available; -ompi_pubsub_base_component_t ompi_pubsub_base_selected_component; + +static int ompi_pubsub_base_close(void) +{ + /* Close the selected component */ + if( NULL != ompi_pubsub.finalize ) { + ompi_pubsub.finalize(); + } + + return mca_base_framework_components_close(&ompi_pubsub_base_framework, NULL); +} /** * Function for finding and opening either all MCA components, * or the one that was specifically requested via a MCA parameter. */ -int ompi_pubsub_base_open(void) +static int ompi_pubsub_base_open(mca_base_open_flag_t flags) { - /* Debugging/Verbose output */ - ompi_pubsub_base_output = opal_output_open(NULL); - - /* Open up all available components */ - if (OPAL_SUCCESS != - mca_base_components_open("pubsub", - ompi_pubsub_base_output, - mca_pubsub_base_static_components, - &ompi_pubsub_base_components_available, - true)) { - return OMPI_ERROR; - } - - return OMPI_SUCCESS; + /* Open up all available components */ + return mca_base_framework_components_open(&ompi_pubsub_base_framework, flags); } + +MCA_BASE_FRAMEWORK_DECLARE(ompi, pubsub, "OMPI Publish-Subscribe Subsystem", NULL, + ompi_pubsub_base_open, ompi_pubsub_base_close, + mca_pubsub_base_static_components, 0); diff --git a/ompi/mca/pubsub/base/pubsub_base_select.c b/ompi/mca/pubsub/base/pubsub_base_select.c index 146c60acc2..f941faea50 100644 --- a/ompi/mca/pubsub/base/pubsub_base_select.c +++ b/ompi/mca/pubsub/base/pubsub_base_select.c @@ -7,7 +7,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2012 Los Alamos National Security, LLC. All rights + * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. * $COPYRIGHT$ * @@ -36,8 +36,8 @@ int ompi_pubsub_base_select(void) /* * Select the best component */ - if( OPAL_SUCCESS != (ret = mca_base_select("pubsub", ompi_pubsub_base_output, - &ompi_pubsub_base_components_available, + if( OPAL_SUCCESS != (ret = mca_base_select("pubsub", ompi_pubsub_base_framework.framework_output, + &ompi_pubsub_base_framework.framework_components, (mca_base_module_t **) &best_module, (mca_base_component_t **) &best_component))) { /* it is okay not to find any executable components */ @@ -49,7 +49,6 @@ int ompi_pubsub_base_select(void) /* Save the winner */ ompi_pubsub = *best_module; - ompi_pubsub_base_selected_component = *best_component; /* init the selected module */ if (NULL != ompi_pubsub.init) { diff --git a/ompi/mca/pubsub/orte/pubsub_orte.c b/ompi/mca/pubsub/orte/pubsub_orte.c index d02fd6d645..57a0ae2521 100644 --- a/ompi/mca/pubsub/orte/pubsub_orte.c +++ b/ompi/mca/pubsub/orte/pubsub_orte.c @@ -63,7 +63,7 @@ static void setup_server(void) opal_buffer_t buf; int rc; - OPAL_OUTPUT_VERBOSE((1, ompi_pubsub_base_output, + OPAL_OUTPUT_VERBOSE((1, ompi_pubsub_base_framework.framework_output, "%s pubsub:orte: setting up server at URI %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), (NULL == mca_pubsub_orte_component.server_uri) ? "NULL" : mca_pubsub_orte_component.server_uri)); @@ -105,7 +105,7 @@ static void setup_server(void) /* flag the server as found */ mca_pubsub_orte_component.server_found = true; - OPAL_OUTPUT_VERBOSE((1, ompi_pubsub_base_output, + OPAL_OUTPUT_VERBOSE((1, ompi_pubsub_base_framework.framework_output, "%s pubsub:orte: server %s setup", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(&mca_pubsub_orte_component.server))); @@ -167,7 +167,7 @@ static int publish ( char *service_name, ompi_info_t *info, char *port_name ) info_host = &mca_pubsub_orte_component.server; } - OPAL_OUTPUT_VERBOSE((1, ompi_pubsub_base_output, + OPAL_OUTPUT_VERBOSE((1, ompi_pubsub_base_framework.framework_output, "%s pubsub:orte: publishing service %s scope %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), service_name, global_scope ? "Global" : "Local")); @@ -315,7 +315,7 @@ static char* lookup ( char *service_name, ompi_info_t *info ) } } - OPAL_OUTPUT_VERBOSE((1, ompi_pubsub_base_output, + OPAL_OUTPUT_VERBOSE((1, ompi_pubsub_base_framework.framework_output, "%s pubsub:orte: lookup service %s scope %d", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), service_name, lookup[0])); @@ -467,7 +467,7 @@ static int unpublish ( char *service_name, ompi_info_t *info ) info_host = &mca_pubsub_orte_component.server; } - OPAL_OUTPUT_VERBOSE((1, ompi_pubsub_base_output, + OPAL_OUTPUT_VERBOSE((1, ompi_pubsub_base_framework.framework_output, "%s pubsub:orte: unpublish service %s scope %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), service_name, global_scope ? "Global" : "Local")); diff --git a/ompi/mca/rcache/base/Makefile.am b/ompi/mca/rcache/base/Makefile.am index fd9b963c41..2117dd58f4 100644 --- a/ompi/mca/rcache/base/Makefile.am +++ b/ompi/mca/rcache/base/Makefile.am @@ -9,6 +9,8 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. +# Copyright (c) 2013 Los Alamos National Security, LLC. +# All rights reserved # $COPYRIGHT$ # # Additional copyrights may follow @@ -20,6 +22,5 @@ headers += \ base/base.h libmca_rcache_la_SOURCES += \ - base/rcache_base_open.c \ - base/rcache_base_create.c \ - base/rcache_base_close.c + base/rcache_base_frame.c \ + base/rcache_base_create.c diff --git a/ompi/mca/rcache/base/base.h b/ompi/mca/rcache/base/base.h index b2f7ed0910..db5a4a77bd 100644 --- a/ompi/mca/rcache/base/base.h +++ b/ompi/mca/rcache/base/base.h @@ -9,6 +9,8 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, LLC. + * All rights reserved * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,15 +37,9 @@ BEGIN_C_DECLS OMPI_DECLSPEC mca_rcache_base_module_t* mca_rcache_base_module_create(const char* name); /* - * opens all rcache components - */ -OMPI_DECLSPEC int mca_rcache_base_open(void); - -/* - * close all rcache components and call finalize on any open modules - */ -OMPI_DECLSPEC int mca_rcache_base_close(void); - + * MCA framework + */ +OMPI_DECLSPEC extern mca_base_framework_t ompi_rcache_base_framework; struct mca_rcache_base_selected_module_t { opal_list_item_t super; @@ -60,8 +56,6 @@ OMPI_DECLSPEC mca_rcache_base_module_t* mca_rcache_base_module_lookup(const char /* * Globals */ -OMPI_DECLSPEC extern int mca_rcache_base_output; -OMPI_DECLSPEC extern opal_list_t mca_rcache_base_components; OMPI_DECLSPEC extern opal_list_t mca_rcache_base_modules; END_C_DECLS diff --git a/ompi/mca/rcache/base/rcache_base_close.c b/ompi/mca/rcache/base/rcache_base_close.c deleted file mode 100644 index 21d87c53e6..0000000000 --- a/ompi/mca/rcache/base/rcache_base_close.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include - -#include "ompi/constants.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "ompi/mca/rcache/rcache.h" -#include "ompi/mca/rcache/base/base.h" - - -int mca_rcache_base_close(void) -{ - opal_list_item_t *item; - mca_rcache_base_selected_module_t *sm; - - /* Finalize all the rcache components and free their list items */ - - for (item = opal_list_remove_first(&mca_rcache_base_modules); - NULL != item; - item = opal_list_remove_first(&mca_rcache_base_modules)) { - sm = (mca_rcache_base_selected_module_t *) item; - - /* Blatently ignore the return code (what would we do to recover, - anyway? This component is going away, so errors don't matter - anymore). Note that it's legal for the module to have NULL for - the finalize function. */ - - if (NULL != sm->rcache_module->rcache_finalize) { - sm->rcache_module->rcache_finalize(sm->rcache_module); - } - OBJ_RELEASE(sm); - } - - /* Close all remaining available components (may be one if this is a - OMPI RTE program, or [possibly] multiple if this is the ompi_info-tool) */ - - mca_base_components_close(mca_rcache_base_output, - &mca_rcache_base_components, NULL); - - /* Close the framework output */ - opal_output_close (mca_rcache_base_output); - mca_rcache_base_output = -1; - - /* All done */ - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/rcache/base/rcache_base_create.c b/ompi/mca/rcache/base/rcache_base_create.c index 4ed5748ed7..f87474dc21 100644 --- a/ompi/mca/rcache/base/rcache_base_create.c +++ b/ompi/mca/rcache/base/rcache_base_create.c @@ -37,8 +37,8 @@ mca_rcache_base_module_t* mca_rcache_base_module_create(const char* name) mca_rcache_base_selected_module_t *sm; bool found = false; - for (item = opal_list_get_first(&mca_rcache_base_components); - item != opal_list_get_end(&mca_rcache_base_components); + for (item = opal_list_get_first(&ompi_rcache_base_framework.framework_components); + item != opal_list_get_end(&ompi_rcache_base_framework.framework_components); item = opal_list_get_next(item)) { mca_base_component_list_item_t *cli = (mca_base_component_list_item_t *) item; diff --git a/ompi/mca/rcache/base/rcache_base_open.c b/ompi/mca/rcache/base/rcache_base_frame.c similarity index 54% rename from ompi/mca/rcache/base/rcache_base_open.c rename to ompi/mca/rcache/base/rcache_base_frame.c index 97ca174dae..2906ce13ed 100644 --- a/ompi/mca/rcache/base/rcache_base_open.c +++ b/ompi/mca/rcache/base/rcache_base_frame.c @@ -9,6 +9,8 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, LLC. + * All rights reserved * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,34 +40,54 @@ /* * Global variables */ -int mca_rcache_base_output = -1; -opal_list_t mca_rcache_base_components; opal_list_t mca_rcache_base_modules; OBJ_CLASS_INSTANCE(mca_rcache_base_selected_module_t, opal_list_item_t, NULL, NULL); +static int mca_rcache_base_close(void) +{ + opal_list_item_t *item; + mca_rcache_base_selected_module_t *sm; + + /* Finalize all the rcache components and free their list items */ + + for (item = opal_list_remove_first(&mca_rcache_base_modules); + NULL != item; + item = opal_list_remove_first(&mca_rcache_base_modules)) { + sm = (mca_rcache_base_selected_module_t *) item; + + /* Blatently ignore the return code (what would we do to recover, + anyway? This component is going away, so errors don't matter + anymore). Note that it's legal for the module to have NULL for + the finalize function. */ + + if (NULL != sm->rcache_module->rcache_finalize) { + sm->rcache_module->rcache_finalize(sm->rcache_module); + } + OBJ_RELEASE(sm); + } + + /* Close all remaining available components */ + return mca_base_framework_components_close(&ompi_rcache_base_framework, NULL); +} + /** * Function for finding and opening either all MCA components, or the one * that was specifically requested via a MCA parameter. */ -int mca_rcache_base_open(void) +static int mca_rcache_base_open(mca_base_open_flag_t flags) { - /* Open up all available components - and populate the - mca_rcache_base_components list */ - - if (OMPI_SUCCESS != - mca_base_components_open("rcache", 0, mca_rcache_base_static_components, - &mca_rcache_base_components, true)) { - return OMPI_ERROR; - } - /* Initialize the list so that in mca_rcache_base_close(), we can iterate over it (even if it's empty, as in the case of the ompi_info-tool) */ OBJ_CONSTRUCT(&mca_rcache_base_modules, opal_list_t); - /* All done */ - - return OMPI_SUCCESS; + /* Open up all available components */ + return mca_base_framework_components_open(&ompi_rcache_base_framework, flags); } + +MCA_BASE_FRAMEWORK_DECLARE(ompi, rcache, "OMPI Rcache", NULL, + mca_rcache_base_open, mca_rcache_base_close, + mca_rcache_base_static_components, 0); + diff --git a/ompi/mca/rte/base/Makefile.am b/ompi/mca/rte/base/Makefile.am index 8d4939983e..9561f768dd 100644 --- a/ompi/mca/rte/base/Makefile.am +++ b/ompi/mca/rte/base/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved. +# Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -11,6 +11,5 @@ headers += \ base/base.h libmca_rte_la_SOURCES += \ - base/rte_base_close.c \ - base/rte_base_open.c + base/rte_base_frame.c diff --git a/ompi/mca/rte/base/base.h b/ompi/mca/rte/base/base.h index 37f971a32c..b5e5b74821 100644 --- a/ompi/mca/rte/base/base.h +++ b/ompi/mca/rte/base/base.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2012 Los Alamos National Security, LLC. + * Copyright (c) 2012-2013 Los Alamos National Security, LLC. * All rights reserved. * $COPYRIGHT$ * @@ -24,28 +24,10 @@ BEGIN_C_DECLS -extern int ompi_rte_base_inited; - -/** - * Initialize the rte MCA framework - * - * @retval OMPI_SUCCESS Upon success - * @retval OMPI_ERROR Upon failure - * - * This must be the first function invoked in the rte MCA - * framework. It initializes the rte MCA framework, finds - * and opens rte components, etc. - * - * This function is invoked during ompi_init(). - * - * This function fills in the internal global variable - * ompi_rte_base_components_opened, which is a list of all - * rte components that were successfully opened. This - * variable should \em only be used by other rte base - * functions -- it is not considered a public interface member -- - * and is only mentioned here for completeness. +/* + * MCA Framework */ -OMPI_DECLSPEC int ompi_rte_base_open(void); +OMPI_DECLSPEC extern mca_base_framework_t ompi_rte_base_framework; /** * Select an available component. @@ -80,25 +62,6 @@ OMPI_DECLSPEC int ompi_rte_base_open(void); */ OMPI_DECLSPEC int ompi_rte_base_select(void); -/** - * Shut down the rte MCA framework. - * - * @retval OMPI_SUCCESS Always - * - * This function shuts down everything in the rte MCA - * framework, and is called during ompi_finalize(). - * - * It must be the last function invoked on the rte MCA - * framework. - */ -OMPI_DECLSPEC int ompi_rte_base_close(void); - -/** - * Debugging output stream - */ -OMPI_DECLSPEC extern int ompi_rte_base_output; -OMPI_DECLSPEC extern opal_list_t ompi_rte_components; - END_C_DECLS #endif /* OMPI_BASE_RTE_H */ diff --git a/ompi/mca/rte/base/rte_base_close.c b/ompi/mca/rte/base/rte_base_close.c deleted file mode 100644 index 7fc84b1fae..0000000000 --- a/ompi/mca/rte/base/rte_base_close.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2012 Los Alamos National Security, LLC. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" -#include "ompi/constants.h" - -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" - -#include "ompi/mca/rte/rte.h" -#include "ompi/mca/rte/base/base.h" - -int ompi_rte_base_close(void) -{ - opal_list_item_t *item; - - ompi_rte_base_inited--; - - /* no need to close the component as it was statically opened */ - - /* for support of tools such as ompi_info */ - for (item = opal_list_remove_first(&ompi_rte_components); - NULL != item; - item = opal_list_remove_first(&ompi_rte_components)) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&ompi_rte_components); - - /* Close the framework output */ - opal_output_close (ompi_rte_base_output); - ompi_rte_base_output = -1; - - /* All done */ - return OMPI_SUCCESS; -} diff --git a/ompi/mca/rte/base/rte_base_frame.c b/ompi/mca/rte/base/rte_base_frame.c new file mode 100644 index 0000000000..e9dde90951 --- /dev/null +++ b/ompi/mca/rte/base/rte_base_frame.c @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2012-2013 Los Alamos National Security, LLC. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + + +#include "ompi_config.h" +#include "ompi/constants.h" + +#include "opal/util/output.h" +#include "opal/mca/mca.h" +#include "opal/mca/base/base.h" + +#include "ompi/mca/rte/rte.h" +#include "ompi/mca/rte/base/base.h" + + +/* + * The following file was created by configure. It contains extern + * statements and the definition of an array of pointers to each + * component's public mca_base_component_t struct. + */ +#include "ompi/mca/rte/base/static-components.h" + + +static int ompi_rte_base_close(void) +{ + return mca_base_framework_components_close(&ompi_rte_base_framework, NULL); +} + +static int ompi_rte_base_open(mca_base_open_flag_t flags) +{ + /* Open up all available components */ + return mca_base_framework_components_open(&ompi_rte_base_framework, flags); +} + +MCA_BASE_FRAMEWORK_DECLARE(ompi, rte, "OMPI Run-Time Environment Interface", NULL, + ompi_rte_base_open, ompi_rte_base_close, + mca_rte_base_static_components, 0); + + +OBJ_CLASS_INSTANCE(ompi_namelist_t, + opal_list_item_t, + NULL, NULL); diff --git a/ompi/mca/rte/base/rte_base_open.c b/ompi/mca/rte/base/rte_base_open.c deleted file mode 100644 index c298b612ad..0000000000 --- a/ompi/mca/rte/base/rte_base_open.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2012 Los Alamos National Security, LLC. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "ompi_config.h" -#include "ompi/constants.h" - -#include "opal/util/output.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" - -#include "ompi/mca/rte/rte.h" -#include "ompi/mca/rte/base/base.h" - - -/* - * The following file was created by configure. It contains extern - * statements and the definition of an array of pointers to each - * component's public mca_base_component_t struct. - */ -#include "ompi/mca/rte/base/static-components.h" - - -/* - * Globals - */ -int ompi_rte_base_output = -1; -opal_list_t ompi_rte_components; -int ompi_rte_base_inited = 0; - -static int ompi_rte_base_verbose; - -static int ompi_rte_base_register(int flags) -{ - /* Debugging / verbose output */ - ompi_rte_base_verbose = 0; - (void) mca_base_var_register("ompi", "rte", "base", "verbose", - "Verbosity level of the rte framework", - MCA_BASE_VAR_TYPE_INT, NULL, 0, - MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_LOCAL, - &ompi_rte_base_verbose); - - return OMPI_SUCCESS; -} - -int ompi_rte_base_open(void) -{ - int rc = OMPI_SUCCESS; - - if( ompi_rte_base_inited++ < 0 ) { - return OMPI_SUCCESS; - } - - (void) ompi_rte_base_register(0); - - if (0 != ompi_rte_base_verbose) { - ompi_rte_base_output = opal_output_open(NULL); - } else { - ompi_rte_base_output = -1; - } - - /* to support tools such as ompi_info, add the components - * to a list - */ - OBJ_CONSTRUCT(&ompi_rte_components, opal_list_t); - if (OPAL_SUCCESS != - mca_base_components_open("rte", ompi_rte_base_output, - mca_rte_base_static_components, - &ompi_rte_components, true)) { - return OMPI_ERROR; - } - - return rc; -} - - -OBJ_CLASS_INSTANCE(ompi_namelist_t, - opal_list_item_t, - NULL, NULL); diff --git a/ompi/mca/rte/pmi/rte_pmi_db.c b/ompi/mca/rte/pmi/rte_pmi_db.c index 9512f191a7..d1b6949167 100644 --- a/ompi/mca/rte/pmi/rte_pmi_db.c +++ b/ompi/mca/rte/pmi/rte_pmi_db.c @@ -263,7 +263,7 @@ static char* fetch_string(const char *key) return NULL; } - opal_output_verbose(5, ompi_rte_base_output, + opal_output_verbose(5, ompi_rte_base_framework.framework_output, "%s db:pmi:fetch_string: received key %s DATA %s", OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), key, tmp_val); @@ -290,7 +290,7 @@ static char* fetch_string(const char *key) free(data); return NULL; } - opal_output_verbose(5, ompi_rte_base_output, + opal_output_verbose(5, ompi_rte_base_framework.framework_output, "%s db:pmi:fetch_string: received key %s DATA %s", OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), tmpkey, tmp_val); @@ -403,7 +403,7 @@ ompi_rte_db_store(const ompi_process_name_t *proc, char *pmikey, *tmpkey, *tmp, sav; char **strdata=NULL; - opal_output_verbose(5, ompi_rte_base_output, + opal_output_verbose(5, ompi_rte_base_framework.framework_output, "%s db:pmi:store: storing key %s[%s] for proc %s", OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), key, opal_dss.lookup_data_type(type), OMPI_NAME_PRINT(proc)); @@ -434,7 +434,7 @@ ompi_rte_db_store(const ompi_process_name_t *proc, * required to hold the entire string */ asprintf(&pmidata, "%d:%s", opal_argv_count(strdata), strdata[0]); - opal_output_verbose(5, ompi_rte_base_output, + opal_output_verbose(5, ompi_rte_base_framework.framework_output, "%s db:pmi:store: storing key %s data %s", OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), pmikey, pmidata); @@ -449,7 +449,7 @@ ompi_rte_db_store(const ompi_process_name_t *proc, /* for each remaining segment, augment the key with the index */ for (i=1; NULL != strdata[i]; i++) { asprintf(&tmpkey, "%s:%d", pmikey, i); - opal_output_verbose(5, ompi_rte_base_output, + opal_output_verbose(5, ompi_rte_base_framework.framework_output, "%s db:pmi:store: storing key %s data %s", OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), pmikey, strdata[i]); @@ -510,7 +510,7 @@ ompi_rte_db_store(const ompi_process_name_t *proc, return OMPI_ERR_NOT_SUPPORTED; } - opal_output_verbose(5, ompi_rte_base_output, + opal_output_verbose(5, ompi_rte_base_framework.framework_output, "%s PUTTING KEY %s DATA %s", OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), pmikey, pmidata); @@ -542,7 +542,7 @@ ompi_rte_db_fetch(const ompi_process_name_t *proc, opal_hwloc_locality_t locality; size_t sval; - opal_output_verbose(5, ompi_rte_base_output, + opal_output_verbose(5, ompi_rte_base_framework.framework_output, "%s db:pmi:fetch: searching for key %s[%s] on proc %s", OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), (NULL == key) ? "NULL" : key, @@ -597,7 +597,7 @@ ompi_rte_db_fetch(const ompi_process_name_t *proc, } memcpy(*data, &locality, sizeof(opal_hwloc_locality_t)); - opal_output_verbose(5, ompi_rte_base_output, + opal_output_verbose(5, ompi_rte_base_framework.framework_output, "%s db:pmi:fetch: done searching for key %s[%s] on proc %s", OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), (NULL == key) ? "NULL" : key, @@ -661,7 +661,7 @@ ompi_rte_db_fetch(const ompi_process_name_t *proc, return OMPI_ERR_NOT_SUPPORTED; } - opal_output_verbose(5, ompi_rte_base_output, + opal_output_verbose(5, ompi_rte_base_framework.framework_output, "%s db:pmi:fetch: done searching for key %s[%s] on proc %s", OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), (NULL == key) ? "NULL" : key, @@ -680,7 +680,7 @@ ompi_rte_db_fetch_pointer(const ompi_process_name_t *proc, { local_data_t *pdat; - opal_output_verbose(5, ompi_rte_base_output, + opal_output_verbose(5, ompi_rte_base_framework.framework_output, "%s db:pmi:fetch_pointer: searching for key %s on proc %s", OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), (NULL == key) ? "NULL" : key, OMPI_NAME_PRINT(proc)); diff --git a/ompi/mca/sbgp/base/Makefile.am b/ompi/mca/sbgp/base/Makefile.am index f490e8171e..c64efb7970 100644 --- a/ompi/mca/sbgp/base/Makefile.am +++ b/ompi/mca/sbgp/base/Makefile.am @@ -1,6 +1,7 @@ # # Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved. # Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved. +# Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -12,6 +13,5 @@ headers += \ base/base.h libmca_sbgp_la_SOURCES += \ - base/sbgp_base_close.c \ - base/sbgp_base_open.c \ + base/sbgp_base_frame.c \ base/sbgp_base_init.c diff --git a/ompi/mca/sbgp/base/base.h b/ompi/mca/sbgp/base/base.h index 6fe694baf6..4b251aac60 100644 --- a/ompi/mca/sbgp/base/base.h +++ b/ompi/mca/sbgp/base/base.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved. * Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -14,28 +15,26 @@ #include "ompi_config.h" #include "opal/mca/mca.h" - +#include "opal/mca/base/mca_base_framework.h" /* * Global functions for SBGP */ -/* components found */ -OMPI_MODULE_DECLSPEC extern opal_list_t mca_sbgp_base_components_opened; /* components in use */ OMPI_MODULE_DECLSPEC extern opal_list_t mca_sbgp_base_components_in_use; OMPI_MODULE_DECLSPEC extern int mca_sbgp_base_components_in_use_inited; OMPI_DECLSPEC extern char *ompi_sbgp_subgroups_string; -extern int mca_sbgp_base_output; - BEGIN_C_DECLS -OMPI_DECLSPEC int mca_sbgp_base_open(void); +/* + * MCA Framework + */ +OMPI_DECLSPEC extern mca_base_framework_t ompi_sbgp_base_framework; +/* select a component */ OMPI_DECLSPEC int mca_sbgp_base_init(bool, bool); -OMPI_DECLSPEC int mca_sbgp_base_close(void); - /* subgrouping component and key value */ struct sbgp_base_component_keyval_t { mca_base_component_list_item_t component; diff --git a/ompi/mca/sbgp/base/sbgp_base_close.c b/ompi/mca/sbgp/base/sbgp_base_close.c index 99c68fcaa3..43ef903011 100644 --- a/ompi/mca/sbgp/base/sbgp_base_close.c +++ b/ompi/mca/sbgp/base/sbgp_base_close.c @@ -26,12 +26,12 @@ int mca_sbgp_base_close(void) /* Close all remaining available modules */ - mca_base_components_close(mca_sbgp_base_output, + mca_base_components_close(ompi_sbgp_base_framework.framework_output, &mca_sbgp_base_components_opened, NULL); /* Close the framework output */ - opal_output_close (mca_sbgp_base_output); - mca_sbgp_base_output = -1; + opal_output_close (ompi_sbgp_base_framework.framework_output); + ompi_sbgp_base_framework.framework_output = -1; /* All done */ diff --git a/ompi/mca/sbgp/base/sbgp_base_open.c b/ompi/mca/sbgp/base/sbgp_base_frame.c similarity index 82% rename from ompi/mca/sbgp/base/sbgp_base_open.c rename to ompi/mca/sbgp/base/sbgp_base_frame.c index d56d45cf86..8147bd2df9 100644 --- a/ompi/mca/sbgp/base/sbgp_base_open.c +++ b/ompi/mca/sbgp/base/sbgp_base_frame.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved. * Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -33,14 +34,10 @@ /* ** * Global variables ** */ -int mca_sbgp_base_output = 0; -opal_list_t mca_sbgp_base_components_opened; opal_list_t mca_sbgp_base_components_in_use; int mca_sbgp_base_components_in_use_inited=0; OMPI_DECLSPEC char *ompi_sbgp_subgroups_string; -static int ompi_sbgp_base_verbose; - static void mca_sbgp_base_destruct (mca_sbgp_base_module_t *module) { /* free the list of ranks */ @@ -133,7 +130,7 @@ static int ompi_sbgp_set_components_to_use(opal_list_t *sbgp_components_avail, sbgp_component = sbgp_string[0]; break; default: - opal_output(mca_sbgp_base_output, + opal_output(ompi_sbgp_base_framework.framework_output, "Requested SBGP configuration is illegal %s", subgoups_requested[i]); RELEASE_LIST_OF_STRINGS(sbgp_string); @@ -200,18 +197,8 @@ error: return rc; } -static int mca_sbgp_base_register(int flags) +static int mca_sbgp_base_register(mca_base_register_flag_t flags) { - /* Debugging/Verbose output */ - ompi_sbgp_base_verbose = 0; - (void) mca_base_var_register("ompi", "sbgp", "base", "verbose", - "Verbosity level of SBGP framework", - MCA_BASE_VAR_TYPE_INT, NULL, 0, - MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_LOCAL, - &ompi_sbgp_base_verbose); - /* get list of sub-grouping functions to use */ ompi_sbgp_subgroups_string = "basesmsocket,basesmuma,ibnet,p2p"; (void) mca_base_var_register("ompi", "sbgp", "base", "subgroups_string", @@ -224,35 +211,30 @@ static int mca_sbgp_base_register(int flags) return OMPI_SUCCESS; } +static int mca_sbgp_base_close(void) +{ + return mca_base_framework_components_close(&ompi_sbgp_base_framework, NULL); +} + /** * Function for finding and opening either all MCA components, or the one * that was specifically requested via a MCA parameter. */ -int mca_sbgp_base_open(void) +static int mca_sbgp_base_open(mca_base_open_flag_t flags) { - int ret = OMPI_SUCCESS; + int ret; - /*_sbgp_base_components_available - * Register some MCA parameters - */ - - (void) mca_sbgp_base_register(0); - - /* get fraemwork id */ - mca_sbgp_base_output = opal_output_open(NULL); - opal_output_set_verbosity(mca_sbgp_base_output, ompi_sbgp_base_verbose); - - /* Open up all available components */ - ret = mca_base_components_open("sbgp", mca_sbgp_base_output, mca_sbgp_base_static_components, - &mca_sbgp_base_components_opened, - true); - if (OMPI_SUCCESS != ret) { - return OMPI_ERROR; + if (OMPI_SUCCESS != (ret = mca_base_framework_components_open(&ompi_sbgp_base_framework, flags))) { + return ret; } - ret = ompi_sbgp_set_components_to_use(&mca_sbgp_base_components_opened, + ret = ompi_sbgp_set_components_to_use(&ompi_sbgp_base_framework.framework_components, &mca_sbgp_base_components_in_use); return ret; } +MCA_BASE_FRAMEWORK_DECLARE(ompi, sbgp, "OMPI Subgroup Subsystem", mca_sbgp_base_register, + mca_sbgp_base_open, mca_sbgp_base_close, + mca_sbgp_base_static_components, 0); + diff --git a/ompi/mca/sharedfp/base/Makefile.am b/ompi/mca/sharedfp/base/Makefile.am index a3362bae86..84101ed385 100644 --- a/ompi/mca/sharedfp/base/Makefile.am +++ b/ompi/mca/sharedfp/base/Makefile.am @@ -10,6 +10,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2008-2011 University of Houston. All rights reserved. +# Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -21,8 +22,7 @@ headers += \ base/base.h libmca_sharedfp_la_SOURCES += \ - base/sharedfp_base_close.c \ base/sharedfp_base_file_select.c \ base/sharedfp_base_file_unselect.c \ base/sharedfp_base_find_available.c \ - base/sharedfp_base_open.c + base/sharedfp_base_frame.c diff --git a/ompi/mca/sharedfp/base/base.h b/ompi/mca/sharedfp/base/base.h index 15f053413b..19296eadfb 100644 --- a/ompi/mca/sharedfp/base/base.h +++ b/ompi/mca/sharedfp/base/base.h @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -37,17 +38,18 @@ BEGIN_C_DECLS -OMPI_DECLSPEC int mca_sharedfp_base_open(void); - -OMPI_DECLSPEC int mca_sharedfp_base_close(void); - +/* + * MCA Framework + */ +OMPI_DECLSPEC extern mca_base_framework_t ompi_sharedfp_base_framework; +/* select a component */ OMPI_DECLSPEC int mca_sharedfp_base_file_select(struct mca_io_ompio_file_t *file, - mca_base_component_t *preferred); + mca_base_component_t *preferred); OMPI_DECLSPEC int mca_sharedfp_base_file_unselect(struct mca_io_ompio_file_t *file); OMPI_DECLSPEC int mca_sharedfp_base_find_available(bool enable_progress_threads, - bool enable_mpi_threads); + bool enable_mpi_threads); OMPI_DECLSPEC int mca_sharedfp_base_init_file (struct mca_io_ompio_file_t *file); @@ -56,15 +58,6 @@ OMPI_DECLSPEC int mca_sharedfp_base_get_param (struct mca_io_ompio_file_t *file, * Globals */ -OMPI_DECLSPEC extern int mca_sharedfp_base_param; -OMPI_DECLSPEC extern int mca_sharedfp_base_output; - -OMPI_DECLSPEC extern bool mca_sharedfp_base_components_opened_valid; -OMPI_DECLSPEC extern bool mca_sharedfp_base_components_available_valid; - -OMPI_DECLSPEC extern opal_list_t mca_sharedfp_base_components_opened; -OMPI_DECLSPEC extern opal_list_t mca_sharedfp_base_components_available; - END_C_DECLS #endif /* MCA_BASE_SHAREDFP_H */ diff --git a/ompi/mca/sharedfp/base/sharedfp_base_close.c b/ompi/mca/sharedfp/base/sharedfp_base_close.c deleted file mode 100644 index 3459761093..0000000000 --- a/ompi/mca/sharedfp/base/sharedfp_base_close.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. - * $COPYRIGHTOB$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include - -#include "ompi/constants.h" -#include "opal/mca/mca.h" -#include "opal/mca/base/base.h" -#include "ompi/mca/sharedfp/sharedfp.h" -#include "ompi/mca/sharedfp/base/base.h" -#include "opal/util/output.h" - -int mca_sharedfp_base_close(void) -{ - /* - Close all components that are still open. This may be the opened - list (if we're in ompi_info), or it may be the available list (if - we're anywhere else). - */ - - if (mca_sharedfp_base_components_opened_valid) { - mca_base_components_close(mca_sharedfp_base_output, - &mca_sharedfp_base_components_opened, NULL); - OBJ_DESTRUCT(&mca_sharedfp_base_components_opened); - mca_sharedfp_base_components_opened_valid = false; - } else if (mca_sharedfp_base_components_available_valid) { - mca_base_components_close(mca_sharedfp_base_output, - &mca_sharedfp_base_components_available, NULL); - OBJ_DESTRUCT(&mca_sharedfp_base_components_available); - mca_sharedfp_base_components_available_valid = false; - } - - /* Close the framework output */ - opal_output_close (mca_sharedfp_base_output); - mca_sharedfp_base_output = -1; - - /* All done */ - - return OMPI_SUCCESS; -} diff --git a/ompi/mca/sharedfp/base/sharedfp_base_file_select.c b/ompi/mca/sharedfp/base/sharedfp_base_file_select.c index cde256a11a..c7d5da2441 100644 --- a/ompi/mca/sharedfp/base/sharedfp_base_file_select.c +++ b/ompi/mca/sharedfp/base/sharedfp_base_file_select.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -63,27 +64,19 @@ static OBJ_CLASS_INSTANCE(queried_module_t, opal_list_item_t, NULL, NULL); */ int mca_sharedfp_base_file_select (struct mca_io_ompio_file_t *file, - mca_base_component_t *preferred) + mca_base_component_t *preferred) { int priority; int best_priority; opal_list_item_t *item; - opal_list_item_t *next_item; - mca_base_component_priority_list_item_t *selectable_item; - char **name_array; - const char **names_value, *names; - int num_names; - mca_base_component_priority_list_item_t *cpli; + mca_base_component_list_item_t *cli; mca_sharedfp_base_component_t *component; mca_sharedfp_base_component_t *best_component; mca_sharedfp_base_module_t *module; opal_list_t queried; queried_module_t *om; - opal_list_t *selectable; char *str; int err = MPI_SUCCESS; - int i; - bool was_selectable_constructed = false; /* Check and see if a preferred component was provided. If it was provided then it should be used (if possible) */ @@ -95,7 +88,7 @@ int mca_sharedfp_base_file_select (struct mca_io_ompio_file_t *file, str = &(preferred->mca_component_name[0]); - opal_output_verbose(10, mca_sharedfp_base_output, + opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output, "sharedfp:base:file_select: Checking preferred component: %s", str); @@ -136,83 +129,13 @@ int mca_sharedfp_base_file_select (struct mca_io_ompio_file_t *file, * use that for this file */ - /* Check if anything was requested by means on the name parameters */ - names_value = NULL; - mca_base_var_get_value(mca_sharedfp_base_param, &names_value, NULL, NULL); - names = names_value ? names_value[0] : NULL; - - if (NULL != names && 0 < strlen(names)) { - name_array = opal_argv_split (names, ','); - num_names = opal_argv_count (name_array); - - opal_output_verbose(10, mca_sharedfp_base_output, - "sharedfp:base:file_Select: Checking all available module"); - - /* since there are somethings which the mca requested through the - if the intersection is NULL, then we barf saying that the requested - modules are not being available */ - - selectable = OBJ_NEW(opal_list_t); - was_selectable_constructed = true; - - /* go through the compoents_available list and check against the names - * to see whether this can be added or not */ - - for (item = opal_list_get_first(&mca_sharedfp_base_components_available); - item != opal_list_get_end(&mca_sharedfp_base_components_available); - item = opal_list_get_next(item)) { - /* convert the opal_list_item_t returned into the proper type */ - cpli = (mca_base_component_priority_list_item_t *) item; - component = (mca_sharedfp_base_component_t *) cpli->super.cli_component; - opal_output_verbose(10, mca_sharedfp_base_output, - "select: initialising %s component %s", - component->sharedfpm_version.mca_type_name, - component->sharedfpm_version.mca_component_name); - - /* check if this name is present in the mca_base_var */ - for (i=0; i < num_names; i++) { - if (0 == strcmp(name_array[i], component->sharedfpm_version.mca_component_name)) { - /* this is present, and should be added o the selectable list */ - - /* We need to create a seperate object to initialise this list with - * since we cannot have the same item in 2 lists */ - - selectable_item = OBJ_NEW (mca_base_component_priority_list_item_t); - *selectable_item = *cpli; - opal_list_append (selectable, (opal_list_item_t *)selectable_item); - break; - } - } - } - - /* check for a NULL intersection between the available list and the - * list which was asked for */ - - if (0 == opal_list_get_size(selectable)) { - was_selectable_constructed = true; - OBJ_RELEASE (selectable); - opal_output_verbose (10, mca_sharedfp_base_output, - "sharedfp:base:file_select: preferred modules were not available"); - return OMPI_ERROR; - } - } else { /* if there was no name_array, then we need to simply initialize - selectable to mca_sharedfp_base_components_available */ - selectable = &mca_sharedfp_base_components_available; - } - best_component = NULL; best_priority = -1; OBJ_CONSTRUCT(&queried, opal_list_t); - for (item = opal_list_get_first(selectable); - item != opal_list_get_end(selectable); - item = opal_list_get_next(item)) { - /* - * convert the opal_list_item_t returned into the proper type - */ - cpli = (mca_base_component_priority_list_item_t *) item; - component = (mca_sharedfp_base_component_t *) cpli->super.cli_component; - opal_output_verbose(10, mca_sharedfp_base_output, + OPAL_LIST_FOREACH(cli, &ompi_sharedfp_base_framework.framework_components, mca_base_component_list_item_t) { + component = (mca_sharedfp_base_component_t *) cli->cli_component; + opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output, "select: initialising %s component %s", component->sharedfpm_version.mca_type_name, component->sharedfpm_version.mca_component_name); @@ -221,7 +144,7 @@ int mca_sharedfp_base_file_select (struct mca_io_ompio_file_t *file, * we can call the query function only if there is a function :-) */ if (NULL == component->sharedfpm_file_query) { - opal_output_verbose(10, mca_sharedfp_base_output, + opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output, "select: no query, ignoring the component"); } else { /* @@ -234,10 +157,10 @@ int mca_sharedfp_base_file_select (struct mca_io_ompio_file_t *file, /* * query did not return any action which can be used */ - opal_output_verbose(10, mca_sharedfp_base_output, + opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output, "select: query returned failure"); } else { - opal_output_verbose(10, mca_sharedfp_base_output, + opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output, "select: query returned priority %d", priority); /* @@ -263,26 +186,7 @@ int mca_sharedfp_base_file_select (struct mca_io_ompio_file_t *file, } /* end else of if (NULL == component->sharedfpm_init) */ } /* end for ... end of traversal */ - /* We have to remove empty out the selectable list if the selectable - * list was constructed as a duplicate and not as a pointer to the - * mca_base_components_available list. So, check and destroy */ - - if (was_selectable_constructed) { - - /* remove all the items first */ - for (item = opal_list_get_first(&mca_sharedfp_base_components_available); - item != opal_list_get_end(&mca_sharedfp_base_components_available); - item = next_item) { - next_item = opal_list_get_next(item); - OBJ_RELEASE (item); - } - - /* release the list itself */ - OBJ_RELEASE (selectable); - was_selectable_constructed = false; - } - - /* + /* * Now we have alist of components which successfully returned * their module struct. One of these components has the best * priority. The rest have to be comm_unqueried to counter the @@ -340,7 +244,7 @@ int mca_sharedfp_base_file_select (struct mca_io_ompio_file_t *file, * unquery. Hence this check is necessary */ (void) om->om_component->sharedfpm_file_unquery(file); - opal_output_verbose(10, mca_sharedfp_base_output, + opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output, "select: component %s is not selected", om->om_component->sharedfpm_version.mca_component_name); } /* end if */ @@ -348,7 +252,7 @@ int mca_sharedfp_base_file_select (struct mca_io_ompio_file_t *file, OBJ_RELEASE(om); } /* traversing through the entire list */ - opal_output_verbose(10, mca_sharedfp_base_output, + opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output, "select: component %s selected", best_component->sharedfpm_version.mca_component_name); diff --git a/ompi/mca/sharedfp/base/sharedfp_base_find_available.c b/ompi/mca/sharedfp/base/sharedfp_base_find_available.c index 8dcd26d36a..2770efe539 100644 --- a/ompi/mca/sharedfp/base/sharedfp_base_find_available.c +++ b/ompi/mca/sharedfp/base/sharedfp_base_find_available.c @@ -32,77 +32,48 @@ #include "ompi/mca/sharedfp/sharedfp.h" #include "ompi/mca/sharedfp/base/base.h" -opal_list_t mca_sharedfp_base_modules_available; -bool mca_sharedfp_base_modules_available_valid = false; - static int init_query(const mca_base_component_t *m, - mca_base_component_priority_list_item_t *entry, + mca_base_component_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads); static int init_query_2_0_0(const mca_base_component_t *component, - mca_base_component_priority_list_item_t *entry, + mca_base_component_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads); int mca_sharedfp_base_find_available(bool enable_progress_threads, - bool enable_mpi_threads) + bool enable_mpi_threads) { - bool found = false; - mca_base_component_priority_list_item_t *entry; - opal_list_item_t *p; - - /* Initialize the list */ - - OBJ_CONSTRUCT(&mca_sharedfp_base_components_available, opal_list_t); - mca_sharedfp_base_components_available_valid = true; + opal_list_item_t *item, *next; + mca_base_component_list_item_t *cli; /* The list of components which we should check is already present - in mca_sharedfp_base_components_opened, which was established in + in ompi_sharedfp_base_framework.framework_components, which was established in mca_sharedfp_base_open */ - for (found = false, - p = opal_list_remove_first (&mca_sharedfp_base_components_opened); - NULL != p; - p = opal_list_remove_first (&mca_sharedfp_base_components_opened)) { - entry = OBJ_NEW(mca_base_component_priority_list_item_t); - entry->super.cli_component = - ((mca_base_component_list_item_t *)p)->cli_component; + item = opal_list_get_first(&ompi_sharedfp_base_framework.framework_components); + while (item != opal_list_get_end(&ompi_sharedfp_base_framework.framework_components)) { + next = opal_list_get_next(item); + cli = (mca_base_component_list_item_t*)item; /* Now for this entry, we have to determine the thread level. Call a subroutine to do the job for us */ - if (OMPI_SUCCESS == init_query(entry->super.cli_component, entry, + if (OMPI_SUCCESS != init_query(cli->cli_component, cli, enable_progress_threads, enable_mpi_threads)) { - /* Save the results in the list. The priority is not relvant at - this point in time. But we save the thread arguments so that - the initial selection algorithm can negotiate overall thread - level for this process */ - entry->cpli_priority = 0; - opal_list_append (&mca_sharedfp_base_components_available, - (opal_list_item_t *) entry); - found = true; - } else { /* The component does not want to run, so close it. Its close() has already been invoked. Close it out of the DSO repository (if it is there in the repository) */ - mca_base_component_repository_release(entry->super.cli_component); - OBJ_RELEASE(entry); + mca_base_component_repository_release(cli->cli_component); + OBJ_RELEASE(item); } - /* Free entry from the "opened" list */ - OBJ_RELEASE(p); + item = next; } - /* The opened list is no longer necessary, so we can free it */ - OBJ_DESTRUCT (&mca_sharedfp_base_components_opened); - mca_sharedfp_base_components_opened_valid = false; - - /* There should atleast be one sharedfp component which was available */ - if (false == found) { - /* Need to free all items in the list */ - OBJ_DESTRUCT(&mca_sharedfp_base_components_available); - mca_sharedfp_base_components_available_valid = false; - opal_output_verbose (10, mca_sharedfp_base_output, + /* There should at least be one sharedfp component which was available */ + if (0 == opal_list_get_size(&ompi_sharedfp_base_framework.framework_components)) { + opal_output_verbose (10, ompi_sharedfp_base_framework.framework_output, "sharedfp:find_available: no sharedfp components available!"); return OMPI_ERROR; } @@ -113,13 +84,13 @@ int mca_sharedfp_base_find_available(bool enable_progress_threads, static int init_query(const mca_base_component_t *m, - mca_base_component_priority_list_item_t *entry, + mca_base_component_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads) { int ret; - opal_output_verbose(10, mca_sharedfp_base_output, + opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output, "sharedfp:find_available: querying sharedfp component %s", m->mca_component_name); @@ -131,7 +102,7 @@ static int init_query(const mca_base_component_t *m, enable_mpi_threads); } else { /* unrecognised API version */ - opal_output_verbose(10, mca_sharedfp_base_output, + opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output, "sharedfp:find_available:unrecognised sharedfp API version (%d.%d.%d)", m->mca_type_major_version, m->mca_type_minor_version, @@ -141,14 +112,14 @@ static int init_query(const mca_base_component_t *m, /* Query done -- look at return value to see what happened */ if (OMPI_SUCCESS != ret) { - opal_output_verbose(10, mca_sharedfp_base_output, + opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output, "sharedfp:find_available sharedfp component %s is not available", m->mca_component_name); if (NULL != m->mca_close_component) { m->mca_close_component(); } } else { - opal_output_verbose(10, mca_sharedfp_base_output, + opal_output_verbose(10, ompi_sharedfp_base_framework.framework_output, "sharedfp:find_avalable: sharedfp component %s is available", m->mca_component_name); @@ -159,7 +130,7 @@ static int init_query(const mca_base_component_t *m, static int init_query_2_0_0(const mca_base_component_t *component, - mca_base_component_priority_list_item_t *entry, + mca_base_component_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads) { diff --git a/ompi/mca/sharedfp/base/sharedfp_base_open.c b/ompi/mca/sharedfp/base/sharedfp_base_frame.c similarity index 56% rename from ompi/mca/sharedfp/base/sharedfp_base_open.c rename to ompi/mca/sharedfp/base/sharedfp_base_frame.c index 1668593e65..33a25cac9c 100644 --- a/ompi/mca/sharedfp/base/sharedfp_base_open.c +++ b/ompi/mca/sharedfp/base/sharedfp_base_frame.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,6 +25,7 @@ #include "ompi/class/ompi_free_list.h" #include "opal/mca/mca.h" #include "opal/mca/base/base.h" +#include "opal/mca/base/mca_base_framework.h" #include "ompi/mca/sharedfp/sharedfp.h" #include "ompi/mca/sharedfp/base/base.h" @@ -37,44 +39,26 @@ #include "ompi/mca/sharedfp/base/static-components.h" /* - * Global variables; most of which are loaded by back-ends of MCA - * variables + * Global variables */ -int mca_sharedfp_base_param = -1; -int mca_sharedfp_base_output = -1; - -opal_list_t mca_sharedfp_base_components_opened; -opal_list_t mca_sharedfp_base_components_available; - -bool mca_sharedfp_base_components_available_valid = false; -bool mca_sharedfp_base_components_opened_valid = false; - -mca_sharedfp_base_component_t mca_sharedfp_base_selected_component; mca_sharedfp_base_module_t mca_sharedfp; +static int mca_sharedfp_base_close(void) +{ + return mca_base_framework_components_close(&ompi_sharedfp_base_framework, NULL); +} + /* * Function for finding and opening either all MCA components, or the one * that was specifically requested via a MCA parameter. */ -int mca_sharedfp_base_open(void) +static int mca_sharedfp_base_open(mca_base_open_flag_t flags) { - /* Open an output stream for this framework */ - - mca_sharedfp_base_output = opal_output_open(NULL); - - /* Open up all available components */ - - if (OMPI_SUCCESS != - mca_base_components_open("sharedfp", mca_sharedfp_base_output, - mca_sharedfp_base_static_components, - &mca_sharedfp_base_components_opened, true)) { - return OMPI_ERROR; - } - mca_sharedfp_base_components_opened_valid = true; - - /* Find the index of the MCA "sharedfp" param for selection */ - - mca_sharedfp_base_param = mca_base_var_find("ompi", "sharedfp", NULL, NULL); - - return OMPI_SUCCESS; + /* Open up all available components */ + return mca_base_framework_components_open(&ompi_sharedfp_base_framework, flags); } + +MCA_BASE_FRAMEWORK_DECLARE(ompi, sharedfp, "OMPI Shared Files", NULL, + mca_sharedfp_base_open, mca_sharedfp_base_close, + mca_sharedfp_base_static_components, 0); + diff --git a/ompi/mca/topo/base/Makefile.am b/ompi/mca/topo/base/Makefile.am index 7c54c5a9d7..ba70b3b96f 100644 --- a/ompi/mca/topo/base/Makefile.am +++ b/ompi/mca/topo/base/Makefile.am @@ -33,7 +33,6 @@ libmca_topo_la_SOURCES += \ base/topo_base_graph_get.c \ base/topo_base_graph_neighbors.c \ base/topo_base_graph_neighbors_count.c \ - base/topo_base_open.c \ - base/topo_base_close.c \ + base/topo_base_frame.c \ base/topo_base_comm_select.c \ base/topo_base_comm_unselect.c diff --git a/ompi/mca/topo/base/base.h b/ompi/mca/topo/base/base.h index 33193c44c5..858bd9f2b2 100644 --- a/ompi/mca/topo/base/base.h +++ b/ompi/mca/topo/base/base.h @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -36,10 +37,11 @@ BEGIN_C_DECLS -OMPI_DECLSPEC int mca_topo_base_open(void); - -OMPI_DECLSPEC int mca_topo_base_close(void); - +/* + * MCA Framework + */ +OMPI_DECLSPEC extern mca_base_framework_t ompi_topo_base_framework; +/* select a component */ int mca_topo_base_comm_select(ompi_communicator_t *comm, mca_base_component_t *preferred); @@ -126,18 +128,6 @@ OMPI_DECLSPEC int mca_topo_base_graph_neighbors_count (ompi_communicator_t *c int *nneighbors); -/* - * Globals - */ -OMPI_DECLSPEC extern int mca_topo_base_output; -extern int mca_topo_base_param; - -OMPI_DECLSPEC extern opal_list_t mca_topo_base_components_available; -OMPI_DECLSPEC extern opal_list_t mca_topo_base_components_opened; - -extern bool mca_topo_base_components_opened_valid; -extern bool mca_topo_base_components_available_valid; - END_C_DECLS #endif /* MCA_BASE_TOPO_H */ diff --git a/ompi/mca/topo/base/topo_base_close.c b/ompi/mca/topo/base/topo_base_close.c deleted file mode 100644 index c5a23b6723..0000000000 --- a/ompi/mca/topo/base/topo_base_close.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -#include "ompi_config.h" - -#include - -#include "ompi/constants.h" -#include "opal/mca/mca.h" -#include "opal/util/output.h" -#include "opal/mca/base/base.h" -#include "ompi/mca/topo/base/base.h" - - -int mca_topo_base_close(void) -{ - /* We have to close all the components which are open. This might either - be the list of opened components or the list of available components. - Note that the components which are opened but are not available are - already closed */ - - if (mca_topo_base_components_opened_valid) { - mca_base_components_close (mca_topo_base_output, - &mca_topo_base_components_opened, NULL); - mca_topo_base_components_opened_valid = false; - } else if (mca_topo_base_components_available_valid) { - mca_base_components_close (mca_topo_base_output, - &mca_topo_base_components_available, NULL); - mca_topo_base_components_available_valid = false; - } - - /* Close the framework output */ - opal_output_close (mca_topo_base_output); - mca_topo_base_output = -1; - - /* - * All done - */ - return OMPI_SUCCESS; -} diff --git a/ompi/mca/topo/base/topo_base_comm_select.c b/ompi/mca/topo/base/topo_base_comm_select.c index 14b3651c59..30cccf4e0b 100644 --- a/ompi/mca/topo/base/topo_base_comm_select.c +++ b/ompi/mca/topo/base/topo_base_comm_select.c @@ -77,22 +77,14 @@ int mca_topo_base_comm_select (struct ompi_communicator_t *comm, int best_priority; char name[MPI_MAX_OBJECT_NAME+32]; opal_list_item_t *item; - opal_list_item_t *next_item; - mca_base_component_priority_list_item_t *selectable_item; - char **name_array; - const char **names_value, *names; - int num_names; - mca_base_component_priority_list_item_t *cpli; + mca_base_component_list_item_t *cli; mca_topo_base_component_t *component; mca_topo_base_component_t *best_component; mca_topo_base_module_t *module; opal_list_t queried; queried_module_t *om; - opal_list_t *selectable; char *str; int err = MPI_SUCCESS; - int i; - bool was_selectable_constructed = false; /* Announce */ @@ -102,7 +94,7 @@ int mca_topo_base_comm_select (struct ompi_communicator_t *comm, snprintf(name, sizeof(name), "%s (cid %d)", comm->c_name, comm->c_contextid); name[sizeof(name) - 1] = '\0'; - opal_output_verbose(10, mca_topo_base_output, + opal_output_verbose(10, ompi_topo_base_framework.framework_output, "topo:base:comm_select: new communicator: %s", name); @@ -117,7 +109,7 @@ int mca_topo_base_comm_select (struct ompi_communicator_t *comm, str = &(preferred->mca_component_name[0]); - opal_output_verbose(10, mca_topo_base_output, + opal_output_verbose(10, ompi_topo_base_framework.framework_output, "topo:base:comm_select: Checking preferred component: %s", str); @@ -160,84 +152,13 @@ int mca_topo_base_comm_select (struct ompi_communicator_t *comm, * use that for this communicator */ - /* Check if anything was requested by means on the name parameters */ - names_value = NULL; - mca_base_var_get_value(mca_topo_base_param, &names_value, NULL, NULL); - names = names_value ? names_value[0] : NULL; - - - if (NULL != names && 0 < strlen(names)) { - name_array = opal_argv_split (names, ','); - num_names = opal_argv_count (name_array); - - opal_output_verbose(10, mca_topo_base_output, - "topo:base:comm_Select: Checking all available module"); - - /* since there are somethings which the mca requested through the - if the intersection is NULL, then we barf saying that the requested - modules are not being available */ - - selectable = OBJ_NEW(opal_list_t); - was_selectable_constructed = true; - - /* go through the compoents_available list and check against the names - * to see whether this can be added or not */ - - for (item = opal_list_get_first(&mca_topo_base_components_available); - item != opal_list_get_end(&mca_topo_base_components_available); - item = opal_list_get_next(item)) { - /* convert the opal_list_item_t returned into the proper type */ - cpli = (mca_base_component_priority_list_item_t *) item; - component = (mca_topo_base_component_t *) cpli->super.cli_component; - opal_output_verbose(10, mca_topo_base_output, - "select: initialising %s component %s", - component->topom_version.mca_type_name, - component->topom_version.mca_component_name); - - /* check if this name is present in the mca_base_var */ - for (i=0; i < num_names; i++) { - if (0 == strcmp(name_array[i], component->topom_version.mca_component_name)) { - /* this is present, and should be added o the selectable list */ - - /* We need to create a seperate object to initialise this list with - * since we cannot have the same item in 2 lists */ - - selectable_item = OBJ_NEW (mca_base_component_priority_list_item_t); - *selectable_item = *cpli; - opal_list_append (selectable, (opal_list_item_t *)selectable_item); - break; - } - } - } - - /* check for a NULL intersection between the available list and the - * list which was asked for */ - - if (0 == opal_list_get_size(selectable)) { - was_selectable_constructed = true; - OBJ_RELEASE (selectable); - opal_output_verbose (10, mca_topo_base_output, - "topo:base:comm_select: preferred modules were not available"); - return OMPI_ERROR; - } - } else { /* if there was no name_array, then we need to simply initialize - selectable to mca_topo_base_components_available */ - selectable = &mca_topo_base_components_available; - } - best_component = NULL; best_priority = -1; OBJ_CONSTRUCT(&queried, opal_list_t); - for (item = opal_list_get_first(selectable); - item != opal_list_get_end(selectable); - item = opal_list_get_next(item)) { - /* - * convert the opal_list_item_t returned into the proper type - */ - cpli = (mca_base_component_priority_list_item_t *) item; - component = (mca_topo_base_component_t *) cpli->super.cli_component; - opal_output_verbose(10, mca_topo_base_output, + OPAL_LIST_FOREACH(cli, &ompi_topo_base_framework.framework_components, mca_base_component_list_item_t) { + component = (mca_topo_base_component_t *) cli->cli_component; + opal_output_verbose(10, ompi_topo_base_framework.framework_output, "select: initialising %s component %s", component->topom_version.mca_type_name, component->topom_version.mca_component_name); @@ -246,7 +167,7 @@ int mca_topo_base_comm_select (struct ompi_communicator_t *comm, * we can call the query function only if there is a function :-) */ if (NULL == component->topom_comm_query) { - opal_output_verbose(10, mca_topo_base_output, + opal_output_verbose(10, ompi_topo_base_framework.framework_output, "select: no query, ignoring the component"); } else { /* @@ -261,10 +182,10 @@ int mca_topo_base_comm_select (struct ompi_communicator_t *comm, /* * query did not return any action which can be used */ - opal_output_verbose(10, mca_topo_base_output, + opal_output_verbose(10, ompi_topo_base_framework.framework_output, "select: query returned failure"); } else { - opal_output_verbose(10, mca_topo_base_output, + opal_output_verbose(10, ompi_topo_base_framework.framework_output, "select: query returned priority %d", priority); /* @@ -290,25 +211,6 @@ int mca_topo_base_comm_select (struct ompi_communicator_t *comm, } /* end else of if (NULL == component->topom_init) */ } /* end for ... end of traversal */ - /* We have to remove empty out the selectable list if the selectable - * list was constructed as a duplicate and not as a pointer to the - * mca_base_components_available list. So, check and destroy */ - - if (was_selectable_constructed) { - - /* remove all the items first */ - for (item = opal_list_get_first(&mca_topo_base_components_available); - item != opal_list_get_end(&mca_topo_base_components_available); - item = next_item) { - next_item = opal_list_get_next(item); - OBJ_RELEASE (item); - } - - /* release the list itself */ - OBJ_RELEASE (selectable); - was_selectable_constructed = false; - } - /* * Now we have alist of components which successfully returned * their module struct. One of these components has the best @@ -368,7 +270,7 @@ int mca_topo_base_comm_select (struct ompi_communicator_t *comm, * unquery. Hence this check is necessary */ (void) om->om_component->topom_comm_unquery(comm); - opal_output_verbose(10, mca_topo_base_output, + opal_output_verbose(10, ompi_topo_base_framework.framework_output, "select: component %s is not selected", om->om_component->topom_version.mca_component_name); } /* end if */ @@ -376,7 +278,7 @@ int mca_topo_base_comm_select (struct ompi_communicator_t *comm, OBJ_RELEASE(om); } /* traversing through the entire list */ - opal_output_verbose(10, mca_topo_base_output, + opal_output_verbose(10, ompi_topo_base_framework.framework_output, "select: component %s selected", best_component->topom_version.mca_component_name); diff --git a/ompi/mca/topo/base/topo_base_find_available.c b/ompi/mca/topo/base/topo_base_find_available.c index 99f8d6117d..c336ca2807 100644 --- a/ompi/mca/topo/base/topo_base_find_available.c +++ b/ompi/mca/topo/base/topo_base_find_available.c @@ -30,77 +30,48 @@ #include "ompi/mca/topo/base/base.h" #include "ompi/constants.h" -opal_list_t mca_topo_base_modules_available; -bool mca_topo_base_modules_available_valid = false; - static int init_query(const mca_base_component_t *m, - mca_base_component_priority_list_item_t *entry, + mca_base_component_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads); static int init_query_2_0_0(const mca_base_component_t *component, - mca_base_component_priority_list_item_t *entry, + mca_base_component_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads); int mca_topo_base_find_available(bool enable_progress_threads, bool enable_mpi_threads) { - bool found = false; - mca_base_component_priority_list_item_t *entry; - opal_list_item_t *p; - - /* Initialize the list */ - - OBJ_CONSTRUCT(&mca_topo_base_components_available, opal_list_t); - mca_topo_base_components_available_valid = true; + opal_list_item_t *item, *next; + mca_base_component_list_item_t *cli; /* The list of components which we should check is already present - in mca_topo_base_components_opened, which was established in + in ompi_topo_base_framework.framework_components, which was established in mca_topo_base_open */ - for (found = false, - p = opal_list_remove_first (&mca_topo_base_components_opened); - NULL != p; - p = opal_list_remove_first (&mca_topo_base_components_opened)) { - entry = OBJ_NEW(mca_base_component_priority_list_item_t); - entry->super.cli_component = - ((mca_base_component_list_item_t *)p)->cli_component; + item = opal_list_get_first(&ompi_topo_base_framework.framework_components); + while (item != opal_list_get_end(&ompi_topo_base_framework.framework_components)) { + next = opal_list_get_next(item); + cli = (mca_base_component_list_item_t*)item; /* Now for this entry, we have to determine the thread level. Call a subroutine to do the job for us */ - if (OMPI_SUCCESS == init_query(entry->super.cli_component, entry, + if (OMPI_SUCCESS != init_query(cli->cli_component, cli, enable_progress_threads, enable_mpi_threads)) { - /* Save the results in the list. The priority is not relvant at - this point in time. But we save the thread arguments so that - the initial selection algorithm can negotiate overall thread - level for this process */ - entry->cpli_priority = 0; - opal_list_append (&mca_topo_base_components_available, - (opal_list_item_t *) entry); - found = true; - } else { /* The component does not want to run, so close it. Its close() has already been invoked. Close it out of the DSO repository (if it is there in the repository) */ - mca_base_component_repository_release(entry->super.cli_component); - OBJ_RELEASE(entry); + mca_base_component_repository_release(cli->cli_component); + OBJ_RELEASE(item); } - /* Free entry from the "opened" list */ - OBJ_RELEASE(p); + item = next; } - /* The opened list is no longer necessary, so we can free it */ - OBJ_DESTRUCT (&mca_topo_base_components_opened); - mca_topo_base_components_opened_valid = false; - - /* There should atleast be one topo component which was available */ - if (false == found) { - /* Need to free all items in the list */ - OBJ_DESTRUCT(&mca_topo_base_components_available); - mca_topo_base_components_available_valid = false; - opal_output_verbose (10, mca_topo_base_output, + /* There should at least be one sharedfp component which was available */ + if (0 == opal_list_get_size(&ompi_topo_base_framework.framework_components)) { + opal_output_verbose (10, ompi_topo_base_framework.framework_output, "topo:find_available: no topo components available!"); return OMPI_ERROR; } @@ -111,13 +82,13 @@ int mca_topo_base_find_available(bool enable_progress_threads, static int init_query(const mca_base_component_t *m, - mca_base_component_priority_list_item_t *entry, + mca_base_component_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads) { int ret; - opal_output_verbose(10, mca_topo_base_output, + opal_output_verbose(10, ompi_topo_base_framework.framework_output, "topo:find_available: querying topo component %s", m->mca_component_name); @@ -129,7 +100,7 @@ static int init_query(const mca_base_component_t *m, enable_mpi_threads); } else { /* unrecognised API version */ - opal_output_verbose(10, mca_topo_base_output, + opal_output_verbose(10, ompi_topo_base_framework.framework_output, "topo:find_available:unrecognised topo API version (%d.%d.%d)", m->mca_type_major_version, m->mca_type_minor_version, @@ -139,14 +110,14 @@ static int init_query(const mca_base_component_t *m, /* Query done -- look at return value to see what happened */ if (OMPI_SUCCESS != ret) { - opal_output_verbose(10, mca_topo_base_output, + opal_output_verbose(10, ompi_topo_base_framework.framework_output, "topo:find_available topo component %s is not available", m->mca_component_name); if (NULL != m->mca_close_component) { m->mca_close_component(); } } else { - opal_output_verbose(10, mca_topo_base_output, + opal_output_verbose(10, ompi_topo_base_framework.framework_output, "topo:find_avalable: topo component %s is available", m->mca_component_name); @@ -157,7 +128,7 @@ static int init_query(const mca_base_component_t *m, static int init_query_2_0_0(const mca_base_component_t *component, - mca_base_component_priority_list_item_t *entry, + mca_base_component_list_item_t *entry, bool enable_progress_threads, bool enable_mpi_threads) { diff --git a/ompi/mca/topo/base/topo_base_open.c b/ompi/mca/topo/base/topo_base_frame.c similarity index 61% rename from ompi/mca/topo/base/topo_base_open.c rename to ompi/mca/topo/base/topo_base_frame.c index 599b79c375..e8c0c3348d 100644 --- a/ompi/mca/topo/base/topo_base_open.c +++ b/ompi/mca/topo/base/topo_base_frame.c @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -39,42 +40,25 @@ /* * Global variables */ -int mca_topo_base_output = -1; -int mca_topo_base_param = -1; - -opal_list_t mca_topo_base_components_available; -opal_list_t mca_topo_base_components_opened; - mca_topo_base_component_t mca_topo_base_selected_component; mca_topo_base_module_t mca_topo; -bool mca_topo_base_components_available_valid = false; -bool mca_topo_base_components_opened_valid = false; +static int mca_topo_base_close(void) +{ + return mca_base_framework_components_close(&ompi_topo_base_framework, NULL); +} /** * Function for finding and opening either all the MCA topo components, or * the one that specifically requested via a MCA parameter. */ -int mca_topo_base_open(void) +static int mca_topo_base_open(mca_base_open_flag_t flags) { - /* Open the topo framework output stream */ - mca_topo_base_output = opal_output_open(NULL); - - /* Open up all available components */ - if (OMPI_SUCCESS != - mca_base_components_open("topo", mca_topo_base_output, - mca_topo_base_static_components, - &mca_topo_base_components_opened, true)) { - return OMPI_ERROR; - } - - mca_topo_base_components_opened_valid = true; - - /* Find selection variable */ - mca_topo_base_param = mca_base_var_find("ompi", "topo", NULL, NULL); - - /* All done */ - - return OMPI_SUCCESS; + return mca_base_framework_components_open(&ompi_topo_base_framework, flags); } + +MCA_BASE_FRAMEWORK_DECLARE(ompi, topo, "OMPI Topo", NULL, + mca_topo_base_open, mca_topo_base_close, + mca_topo_base_static_components, 0); + diff --git a/ompi/mca/vprotocol/base/base.h b/ompi/mca/vprotocol/base/base.h index aac17a4b43..9f43450285 100644 --- a/ompi/mca/vprotocol/base/base.h +++ b/ompi/mca/vprotocol/base/base.h @@ -2,6 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of the University of Tennessee. * All rights reserved. * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,14 +32,22 @@ typedef struct mca_pml_v_t mca_pml_v_t; OMPI_DECLSPEC extern mca_pml_v_t mca_pml_v; -OMPI_DECLSPEC int mca_vprotocol_base_open(char *vprotocol_include_list); +/* + * MCA Framework + */ +OMPI_DECLSPEC extern mca_base_framework_t ompi_vprotocol_base_framework; + +/* this needs to be called before vprotocol is opened. this replaces the + need for a unique open function */ +void mca_vprotocol_base_set_include_list(char *vprotocol_include_list); + +/* select a component */ OMPI_DECLSPEC int mca_vprotocol_base_select(bool enable_progress_threads, bool enable_mpi_threads); + OMPI_DECLSPEC int mca_vprotocol_base_parasite(void); -OMPI_DECLSPEC int mca_vprotocol_base_close(void); OMPI_DECLSPEC extern char *mca_vprotocol_base_include_list; -OMPI_DECLSPEC extern opal_list_t mca_vprotocol_base_components_available; OMPI_DECLSPEC extern mca_vprotocol_base_component_t mca_vprotocol_component; OMPI_DECLSPEC extern mca_vprotocol_base_module_t mca_vprotocol; diff --git a/ompi/mca/vprotocol/base/vprotocol_base.c b/ompi/mca/vprotocol/base/vprotocol_base.c index dbf513c9a5..5c1a3d0c19 100644 --- a/ompi/mca/vprotocol/base/vprotocol_base.c +++ b/ompi/mca/vprotocol/base/vprotocol_base.c @@ -2,6 +2,7 @@ * Copyright (c) 2004-2007 The Trustees of the University of Tennessee. * All rights reserved. * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -15,7 +16,6 @@ #include "opal/mca/base/base.h" #include "ompi/mca/vprotocol/base/static-components.h" -opal_list_t mca_vprotocol_base_components_available; char *mca_vprotocol_base_include_list; mca_pml_v_t mca_pml_v = {-1, 0, 0}; @@ -24,36 +24,37 @@ mca_pml_v_t mca_pml_v = {-1, 0, 0}; * * Also fill the mca_vprotocol_base_include_list with components that exists */ -int mca_vprotocol_base_open(char *vprotocol_include_list) + +static int mca_vprotocol_base_open(mca_base_open_flag_t flags) { - OBJ_CONSTRUCT(&mca_vprotocol_base_components_available, opal_list_t); - if (NULL == vprotocol_include_list || - vprotocol_include_list[0] == 0) { + if (NULL == mca_vprotocol_base_include_list) { return OMPI_SUCCESS; } - if (NULL != vprotocol_include_list) { - mca_vprotocol_base_include_list = strdup (vprotocol_include_list); - } else { - mca_vprotocol_base_include_list = NULL; - } - return mca_base_components_open("vprotocol", 0, - mca_vprotocol_base_static_components, - &mca_vprotocol_base_components_available, - true); + return mca_base_framework_components_open(&ompi_vprotocol_base_framework, 0); +} + +void mca_vprotocol_base_set_include_list(char *vprotocol_include_list) +{ + mca_vprotocol_base_include_list = NULL; + + if (NULL != vprotocol_include_list && vprotocol_include_list[0] != '\0') { + mca_vprotocol_base_include_list = strdup (vprotocol_include_list); + } } /* Close and unload any vprotocol MCA component loaded. */ -int mca_vprotocol_base_close(void) +static int mca_vprotocol_base_close(void) { - int ret; - ret = mca_base_components_close(mca_pml_v.output, - &mca_vprotocol_base_components_available, - NULL); if (NULL != mca_vprotocol_base_include_list) { free(mca_vprotocol_base_include_list); } - OBJ_DESTRUCT(&mca_vprotocol_base_components_available); - return ret; + + return mca_base_framework_components_close(&ompi_vprotocol_base_framework, NULL);; } + +MCA_BASE_FRAMEWORK_DECLARE(ompi, vprotocol, "OMPI Vprotocol", NULL, + mca_vprotocol_base_open, mca_vprotocol_base_close, + mca_vprotocol_base_static_components, 0); + diff --git a/ompi/mca/vprotocol/base/vprotocol_base_select.c b/ompi/mca/vprotocol/base/vprotocol_base_select.c index 221ff1ab23..17a2eebf53 100644 --- a/ompi/mca/vprotocol/base/vprotocol_base_select.c +++ b/ompi/mca/vprotocol/base/vprotocol_base_select.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2004-2007 The Trustees of the University of Tennessee. * All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -54,13 +55,14 @@ int mca_vprotocol_base_select(bool enable_progress_threads, /* Traverse the list of available components; call their init functions. */ OBJ_CONSTRUCT(&opened, opal_list_t); - for(item = opal_list_get_first(&mca_vprotocol_base_components_available); - opal_list_get_end(&mca_vprotocol_base_components_available) != item; - item = opal_list_get_next(item)) + OPAL_LIST_FOREACH(cli, &ompi_vprotocol_base_framework.framework_components, mca_base_component_list_item_t) { - cli = (mca_base_component_list_item_t *) item; component = (mca_vprotocol_base_component_t *) cli->cli_component; - + + if (NULL == mca_vprotocol_base_include_list) { + continue; + } + V_OUTPUT_VERBOSE(500, "vprotocol select: initializing %s component %s", component->pmlm_version.mca_type_name, component->pmlm_version.mca_component_name); if(strcmp(component->pmlm_version.mca_component_name, mca_vprotocol_base_include_list)) { @@ -123,7 +125,7 @@ int mca_vprotocol_base_select(bool enable_progress_threads, } mca_base_components_close(mca_pml_v.output, - &mca_vprotocol_base_components_available, + &ompi_vprotocol_base_framework.framework_components, (mca_base_component_t *) best_component); /* All done */ diff --git a/ompi/mpi/c/cart_create.c b/ompi/mpi/c/cart_create.c index b2dd9c4a38..d6415dedc1 100644 --- a/ompi/mpi/c/cart_create.c +++ b/ompi/mpi/c/cart_create.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2012 Los Alamos National Security, LLC. All rights + * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. * $COPYRIGHT$ * @@ -93,18 +93,15 @@ int MPI_Cart_create(MPI_Comm old_comm, int ndims, int dims[], * removed from initialization since most of the MPI calls do not use * this module */ - if (!(mca_topo_base_components_opened_valid || - mca_topo_base_components_available_valid)) { - if (OMPI_SUCCESS != (err = mca_topo_base_open())) { - return OMPI_ERRHANDLER_INVOKE(old_comm, err, FUNC_NAME); - } - if (OMPI_SUCCESS != - (err = mca_topo_base_find_available(OMPI_ENABLE_PROGRESS_THREADS, - OMPI_ENABLE_THREAD_MULTIPLE))) { - return OMPI_ERRHANDLER_INVOKE(old_comm, err, FUNC_NAME); - } + if (OMPI_SUCCESS != (err = mca_base_framework_open(&ompi_topo_base_framework, 0))) { + return OMPI_ERRHANDLER_INVOKE(old_comm, err, FUNC_NAME); } - + if (OMPI_SUCCESS != + (err = mca_topo_base_find_available(OMPI_ENABLE_PROGRESS_THREADS, + OMPI_ENABLE_THREAD_MULTIPLE))) { + return OMPI_ERRHANDLER_INVOKE(old_comm, err, FUNC_NAME); + } + OPAL_CR_ENTER_LIBRARY(); /* everything seems to be alright with the communicator, we can go diff --git a/ompi/mpi/c/file_delete.c b/ompi/mpi/c/file_delete.c index 36f0afdf5e..4e5c9a07fb 100644 --- a/ompi/mpi/c/file_delete.c +++ b/ompi/mpi/c/file_delete.c @@ -62,18 +62,11 @@ int MPI_File_delete(char *filename, MPI_Info info) /* The io framework is only initialized lazily. If it hasn't already been initialized, do so now (note that MPI_FILE_OPEN and MPI_FILE_DELETE are the only two places that it will be - initialized). */ + initialized). We might want to add a check to see if the + framework is open instead of just incrementing the open count. */ - if (!(mca_io_base_components_opened_valid || - mca_io_base_components_available_valid)) { - if (OMPI_SUCCESS != (rc = mca_io_base_open())) { - return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME); - } - if (OMPI_SUCCESS != - (rc = mca_io_base_find_available(OMPI_ENABLE_PROGRESS_THREADS, - OMPI_ENABLE_THREAD_MULTIPLE))) { - return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME); - } + if (OMPI_SUCCESS != (mca_base_framework_open(&ompi_io_base_framework, 0))) { + return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME); } OPAL_CR_ENTER_LIBRARY(); diff --git a/ompi/mpi/c/file_open.c b/ompi/mpi/c/file_open.c index 848ff26e66..7daa3a584c 100644 --- a/ompi/mpi/c/file_open.c +++ b/ompi/mpi/c/file_open.c @@ -76,16 +76,8 @@ int MPI_File_open(MPI_Comm comm, char *filename, int amode, and MPI_FILE_DELETE are the only two places that it will be initialized). */ - if (!(mca_io_base_components_opened_valid || - mca_io_base_components_available_valid)) { - if (OMPI_SUCCESS != (rc = mca_io_base_open())) { - return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME); - } - if (OMPI_SUCCESS != - (rc = mca_io_base_find_available(OMPI_ENABLE_PROGRESS_THREADS, - OMPI_ENABLE_THREAD_MULTIPLE))) { - return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME); - } + if (OMPI_SUCCESS != (mca_base_framework_open(&ompi_io_base_framework, 0))) { + return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME); } OPAL_CR_ENTER_LIBRARY(); diff --git a/ompi/mpi/c/graph_create.c b/ompi/mpi/c/graph_create.c index 12e23d4b45..fc40ddb4d6 100644 --- a/ompi/mpi/c/graph_create.c +++ b/ompi/mpi/c/graph_create.c @@ -87,16 +87,13 @@ int MPI_Graph_create(MPI_Comm old_comm, int nnodes, int indx[], * removed from initialization since most of the MPI calls do not use * this module */ - if (!(mca_topo_base_components_opened_valid || - mca_topo_base_components_available_valid)) { - if (OMPI_SUCCESS != (err = mca_topo_base_open())) { - return OMPI_ERRHANDLER_INVOKE(old_comm, err, FUNC_NAME); - } - if (OMPI_SUCCESS != - (err = mca_topo_base_find_available(OMPI_ENABLE_PROGRESS_THREADS, - OMPI_ENABLE_THREAD_MULTIPLE))) { - return OMPI_ERRHANDLER_INVOKE(old_comm, err, FUNC_NAME); - } + if (OMPI_SUCCESS != (err = mca_base_framework_open(&ompi_topo_base_framework, 0))) { + return OMPI_ERRHANDLER_INVOKE(old_comm, err, FUNC_NAME); + } + if (OMPI_SUCCESS != + (err = mca_topo_base_find_available(OMPI_ENABLE_PROGRESS_THREADS, + OMPI_ENABLE_THREAD_MULTIPLE))) { + return OMPI_ERRHANDLER_INVOKE(old_comm, err, FUNC_NAME); } OPAL_CR_ENTER_LIBRARY(); diff --git a/ompi/mpi/c/register_datarep.c b/ompi/mpi/c/register_datarep.c index e582afdd71..00f618850d 100644 --- a/ompi/mpi/c/register_datarep.c +++ b/ompi/mpi/c/register_datarep.c @@ -58,16 +58,8 @@ int MPI_Register_datarep(char *datarep, and MPI_FILE_DELETE are the only two places that it will be initialized). */ - if (!(mca_io_base_components_opened_valid || - mca_io_base_components_available_valid)) { - if (OMPI_SUCCESS != (rc = mca_io_base_open())) { - return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME); - } - if (OMPI_SUCCESS != - (rc = mca_io_base_find_available(OMPI_ENABLE_PROGRESS_THREADS, - OMPI_ENABLE_THREAD_MULTIPLE))) { - return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME); - } + if (OMPI_SUCCESS != (mca_base_framework_open(&ompi_io_base_framework, 0))) { + return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME); } OPAL_CR_ENTER_LIBRARY(); diff --git a/ompi/runtime/ompi_mpi_finalize.c b/ompi/runtime/ompi_mpi_finalize.c index 3c1139cf6e..d7f718d346 100644 --- a/ompi/runtime/ompi_mpi_finalize.c +++ b/ompi/runtime/ompi_mpi_finalize.c @@ -85,7 +85,7 @@ extern bool ompi_enable_timing; int ompi_mpi_finalize(void) { - int ret, value; + int ret; static int32_t finalize_has_already_started = 0; opal_list_item_t *item; struct timeval ompistart, ompistop; @@ -296,7 +296,8 @@ int ompi_mpi_finalize(void) /* Now that all MPI objects dealing with communications are gone, shut down MCA types having to do with communications */ - if (OMPI_SUCCESS != (ret = mca_pml_base_close())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_close(&ompi_pml_base_framework) ) ) { + OMPI_ERROR_LOG(ret); return ret; } @@ -307,7 +308,7 @@ int ompi_mpi_finalize(void) /* * Shutdown the CRCP Framework, must happen after PML shutdown */ - if (OMPI_SUCCESS != (ret = ompi_crcp_base_close() ) ) { + if (OMPI_SUCCESS != (ret = mca_base_framework_close(&ompi_crcp_base_framework) ) ) { OMPI_ERROR_LOG(ret); return ret; } @@ -331,12 +332,12 @@ int ompi_mpi_finalize(void) } /* finalize the pubsub functions */ - if ( OMPI_SUCCESS != (ret = ompi_pubsub_base_close())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_close(&ompi_pubsub_base_framework) ) ) { return ret; } /* finalize the DPM framework */ - if ( OMPI_SUCCESS != (ret = ompi_dpm_base_close())) { + if ( OMPI_SUCCESS != (ret = mca_base_framework_close(&ompi_dpm_base_framework))) { return ret; } @@ -376,26 +377,25 @@ int ompi_mpi_finalize(void) /* io is opened lazily, so it's only necessary to close it if it was actually opened */ + if (0 < ompi_io_base_framework.framework_refcnt) { + /* May have been "opened" multiple times. We want it closed now */ + ompi_io_base_framework.framework_refcnt = 1; - if (mca_io_base_components_opened_valid || - mca_io_base_components_available_valid) { - if (OMPI_SUCCESS != (ret = mca_io_base_close())) { + if (OMPI_SUCCESS != mca_base_framework_close(&ompi_io_base_framework)) { return ret; } } - if (OMPI_SUCCESS != (ret = mca_topo_base_close())) { + (void) mca_base_framework_close(&ompi_topo_base_framework); + if (OMPI_SUCCESS != (ret = mca_base_framework_close(&ompi_osc_base_framework))) { return ret; } - if (OMPI_SUCCESS != (ret = ompi_osc_base_close())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_close(&ompi_coll_base_framework))) { return ret; } - if (OMPI_SUCCESS != (ret = mca_coll_base_close())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_close(&ompi_mpool_base_framework))) { return ret; } - if (OMPI_SUCCESS != (ret = mca_mpool_base_close())) { - return ret; - } - if (OMPI_SUCCESS != (ret = mca_rcache_base_close())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_close(&ompi_rcache_base_framework))) { return ret; } diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index 86c00bae4f..7b27dc2e9b 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2006-2012 Los Alamos National Security, LLC. All rights + * Copyright (c) 2006-2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2006-2009 University of Houston. All rights reserved. * Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. @@ -522,7 +522,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) ddt_init, but befor mca_coll_base_open, since some collective modules (e.g., the hierarchical coll component) may need ops in their query function. */ - if (OMPI_SUCCESS != (ret = ompi_op_base_open())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_op_base_framework, 0))) { error = "ompi_op_base_open() failed"; goto error; } @@ -539,34 +539,34 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) /* Open up MPI-related MCA components */ - if (OMPI_SUCCESS != (ret = mca_allocator_base_open())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_allocator_base_framework, 0))) { error = "mca_allocator_base_open() failed"; goto error; } - if (OMPI_SUCCESS != (ret = mca_rcache_base_open())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_rcache_base_framework, 0))) { error = "mca_rcache_base_open() failed"; goto error; } - if (OMPI_SUCCESS != (ret = mca_mpool_base_open())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_mpool_base_framework, 0))) { error = "mca_mpool_base_open() failed"; goto error; } - if (OMPI_SUCCESS != (ret = mca_pml_base_open())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_pml_base_framework, 0))) { error = "mca_pml_base_open() failed"; goto error; } - if (OMPI_SUCCESS != (ret = mca_coll_base_open())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_coll_base_framework, 0))) { error = "mca_coll_base_open() failed"; goto error; } - if (OMPI_SUCCESS != (ret = ompi_osc_base_open())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_osc_base_framework, 0))) { error = "ompi_osc_base_open() failed"; goto error; } #if OPAL_ENABLE_FT_CR == 1 - if (OMPI_SUCCESS != (ret = ompi_crcp_base_open())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_crcp_base_framework, 0))) { error = "ompi_crcp_base_open() failed"; goto error; } @@ -840,8 +840,8 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) } /* Setup the publish/subscribe (PUBSUB) framework */ - if (OMPI_SUCCESS != (ret = ompi_pubsub_base_open())) { - error = "ompi_pubsub_base_open() failed"; + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_pubsub_base_framework, 0))) { + error = "mca_pubsub_base_open() failed"; goto error; } if (OMPI_SUCCESS != (ret = ompi_pubsub_base_select())) { @@ -850,7 +850,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) } /* Setup the dynamic process management (DPM) framework */ - if (OMPI_SUCCESS != (ret = ompi_dpm_base_open())) { + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_dpm_base_framework, 0))) { error = "ompi_dpm_base_open() failed"; goto error; } diff --git a/ompi/tools/ompi_info/components.c b/ompi/tools/ompi_info/components.c index 517e08472a..7c1120ba86 100644 --- a/ompi/tools/ompi_info/components.c +++ b/ompi/tools/ompi_info/components.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2010-2012 Los Alamos National Security, LLC. + * Copyright (c) 2010-2013 Los Alamos National Security, LLC. * All rights reserved. * Copyright (c) 2011-2012 University of Houston. All rights reserved. * $COPYRIGHT$ @@ -65,7 +65,7 @@ #include "ompi/mca/crcp/crcp.h" #include "ompi/mca/crcp/base/base.h" #endif - +#include "ompi/include/ompi/frameworks.h" #include "ompi/tools/ompi_info/ompi_info.h" @@ -74,48 +74,27 @@ * Private variables */ -static bool opened_components = false; +static int info_register_framework (mca_base_framework_t *framework, opal_pointer_array_t *component_map) { + opal_info_component_map_t *map; + int rc; + rc = mca_base_framework_register(framework, MCA_BASE_REGISTER_ALL); + if (OPAL_SUCCESS != rc && OPAL_ERR_BAD_PARAM != rc) { + return rc; + } -/* - * Open all MCA components so that they can register their MCA - * parameters. Take a shotgun approach here and indiscriminately open - * all components -- don't be selective. To this end, we need to clear - * out the environment of all OMPI_MCA_ variables to ensure - * that the open algorithms don't try to only open one component. - */ -int ompi_info_register_components(opal_pointer_array_t *mca_types, - opal_pointer_array_t *component_map) + map = OBJ_NEW(opal_info_component_map_t); + map->type = strdup(framework->framework_name); + map->components = &framework->framework_components; + opal_pointer_array_add(component_map, map); + + return rc; +} + +int ompi_info_register_framework_params(opal_pointer_array_t *component_map) { int i, rc; - char *env, *str; - char *target, *save, *type; - char **env_save=NULL; - bool need_close_components = false; - opal_info_component_map_t *map; - - /* Clear out the environment. Use strdup() to orphan the resulting - * strings because items are placed in the environment by reference, - * not by value. - */ - - for (i = 0; i < mca_types->size; ++i) { - if (NULL == (type = (char*)opal_pointer_array_get_item(mca_types, i))) { - continue; - } - (void)asprintf(&env, "OMPI_MCA_%s", type); - if (NULL != (save = getenv(env))) { - /* save this param so it can later be restored */ - (void)asprintf(&str, "%s=%s", env, save); - opal_argv_append_nosize(&env_save, str); - free(str); - /* can't manipulate it directly, so make a copy first */ - (void)asprintf(&target, "%s=", env); - putenv(target); - free(target); - } - free(env); - } + char *str; /* Register the MPI layer's MCA parameters */ if (OMPI_SUCCESS != (rc = ompi_mpi_register_params())) { @@ -126,281 +105,20 @@ int ompi_info_register_components(opal_pointer_array_t *mca_types, goto error; } - /* Find / open all components */ - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("base"); - opal_pointer_array_add(component_map, map); - /* MPI frameworks */ - if (OMPI_SUCCESS != (rc = mca_allocator_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "allocator open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("allocator"); - map->components = &mca_allocator_base_components; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "allocator"; - goto breakout; - } - - if (OMPI_SUCCESS != (rc = mca_btl_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "btl open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("btl"); - map->components = &mca_btl_base_components_opened; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "btl"; - goto breakout; - } - - if (OMPI_SUCCESS != (rc = mca_coll_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "coll open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("coll"); - map->components = &mca_coll_base_components_opened; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "coll"; - goto breakout; - } - -#if OPAL_ENABLE_FT_CR == 1 - if (OMPI_SUCCESS != (rc = ompi_crcp_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "crcp open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("crcp"); - map->components = &ompi_crcp_base_components_available; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "crcp"; - goto breakout; - } -#endif - - if (OMPI_SUCCESS != (rc = mca_fbtl_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "fbtl open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("fbtl"); - map->components = &mca_fbtl_base_components_opened; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "fbtl"; - goto breakout; - } - - if (OMPI_SUCCESS != (rc = mca_fcoll_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "fcoll open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("fcoll"); - map->components = &mca_fcoll_base_components_opened; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "fcoll"; - goto breakout; - } - - if (OMPI_SUCCESS != (rc = mca_fs_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "fs open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("fs"); - map->components = &mca_fs_base_components_opened; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "fs"; - goto breakout; - } - - if (OMPI_SUCCESS != (rc = mca_io_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "io open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("io"); - map->components = &mca_io_base_components_opened; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "io"; - goto breakout; - } - - if (OMPI_SUCCESS != (rc = mca_mpool_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "mpool open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("mpool"); - map->components = &mca_mpool_base_components; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "mpool"; - goto breakout; - } - - if (OMPI_SUCCESS != (rc = ompi_mtl_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "mtl open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("mtl"); - map->components = &ompi_mtl_base_components_opened; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "mtl"; - goto breakout; - } - - if (OMPI_SUCCESS != (rc = ompi_op_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "op open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("op"); - map->components = &ompi_op_base_components_opened; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "op"; - goto breakout; - } - - if (OMPI_SUCCESS != (rc = ompi_osc_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "osc open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("osc"); - map->components = &ompi_osc_base_open_components; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "osc"; - goto breakout; - } - - if (OMPI_SUCCESS != (rc = mca_pml_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "pml open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("pml"); - map->components = &mca_pml_base_components_available; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "pml"; - goto breakout; - } - - /* No need to call the bml_base_open() because the ob1 pml calls it. - * mca_bml_base_open(); - */ - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("bml"); - map->components = &mca_bml_base_components_available; - opal_pointer_array_add(component_map, map); - - if (OMPI_SUCCESS != (rc = mca_rcache_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "rcache open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("rcache"); - map->components = &mca_rcache_base_components; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "rcache"; - goto breakout; - } - - if (OMPI_SUCCESS != (rc = mca_sharedfp_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "sharedfp open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("sharedfp"); - map->components = &mca_sharedfp_base_components_opened; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "sharedfp"; - goto breakout; - } - - if (OMPI_SUCCESS != (rc = mca_topo_base_open()) && - OMPI_ERR_BAD_PARAM != rc) { - str = "topo open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("topo"); - map->components = &mca_topo_base_components_opened; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "topo"; - goto breakout; - } - - if (OMPI_SUCCESS != (rc = mca_vprotocol_base_open(NULL)) && - OMPI_ERR_BAD_PARAM != rc) { - str = "vprotocol open"; - goto error; - } - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup("vprotocol"); - map->components = &mca_vprotocol_base_components_available; - opal_pointer_array_add(component_map, map); - if (OMPI_ERR_BAD_PARAM == rc) { - str = "vprotocol"; - goto breakout; - } - - /* flag that we need to close components */ - need_close_components = true; - - breakout: - /* Restore the environment to what it was before we started so that - * if users setenv OMPI_MCA_ to some value, they'll - * see that value when it is shown via --param output. - */ - - if (NULL != env_save) { - for (i = 0; i < opal_argv_count(env_save); ++i) { - putenv(env_save[i]); + for (i=0; NULL != ompi_frameworks[i]; i++) { + if (OPAL_SUCCESS != (rc = info_register_framework(ompi_frameworks[i], component_map))) { + fprintf (stderr, "rc = %d\n", rc); + str = ompi_frameworks[i]->framework_name; + break; } } - + + breakout: if (OPAL_ERR_BAD_PARAM == rc) { fprintf(stderr, "\nA \"bad parameter\" error was encountered when opening the OMPI %s framework\n", str); fprintf(stderr, "The output received from that framework includes the following parameters:\n\n"); } - - opened_components = true; return rc; error: @@ -412,6 +130,8 @@ int ompi_info_register_components(opal_pointer_array_t *mca_types, void ompi_info_close_components() { + int i; + /* Note that the order of shutdown here doesn't matter because * we aren't *using* any components -- none were selected, so * there are no dependencies between the frameworks. We list @@ -421,25 +141,9 @@ void ompi_info_close_components() * close() functions -- what would we do if there was an * error? */ - -#if OPAL_ENABLE_FT_CR == 1 - (void) ompi_crcp_base_close(); -#endif - (void) ompi_op_base_close(); - (void) mca_topo_base_close(); - (void) mca_btl_base_close(); - (void) ompi_mtl_base_close(); - (void) mca_pml_base_close(); - (void) mca_mpool_base_close(); - (void) mca_rcache_base_close(); - (void) mca_io_base_close(); - (void) mca_fbtl_base_close(); - (void) mca_fcoll_base_close(); - (void) mca_fs_base_close(); - (void) mca_sharedfp_base_close(); - (void) mca_coll_base_close(); - (void) mca_allocator_base_close(); - (void) ompi_osc_base_close(); + for (i=0; NULL != ompi_frameworks[i]; i++) { + (void) mca_base_framework_close(ompi_frameworks[i]); + } #if OMPI_RTE_ORTE /* close the ORTE components */ diff --git a/ompi/tools/ompi_info/ompi_info.c b/ompi/tools/ompi_info/ompi_info.c index 409df6e16d..8a27639f96 100644 --- a/ompi/tools/ompi_info/ompi_info.c +++ b/ompi/tools/ompi_info/ompi_info.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2012 University of Houston. All rights reserved. - * Copyright (c) 2010-2012 Los Alamos National Security, LLC. + * Copyright (c) 2010-2013 Los Alamos National Security, LLC. * All rights reserved. * $COPYRIGHT$ * @@ -51,6 +51,7 @@ #include "orte/runtime/orte_info_support.h" #endif +#include "ompi/include/ompi/frameworks.h" #include "ompi/communicator/communicator.h" #include "ompi/tools/ompi_info/ompi_info.h" @@ -109,38 +110,20 @@ int main(int argc, char *argv[]) orte_info_register_types(&mca_types); #endif - /* add in the ompi frameworks */ - opal_pointer_array_add(&mca_types, "allocator"); - opal_pointer_array_add(&mca_types, "bml"); - opal_pointer_array_add(&mca_types, "btl"); - opal_pointer_array_add(&mca_types, "coll"); - opal_pointer_array_add(&mca_types, "common"); -#if OPAL_ENABLE_FT_CR == 1 - opal_pointer_array_add(&mca_types, "crcp"); -#endif - opal_pointer_array_add(&mca_types, "dpm"); - opal_pointer_array_add(&mca_types, "fbtl"); - opal_pointer_array_add(&mca_types, "fcoll"); - opal_pointer_array_add(&mca_types, "fs"); - opal_pointer_array_add(&mca_types, "io"); - opal_pointer_array_add(&mca_types, "mpi"); - opal_pointer_array_add(&mca_types, "mpool"); - opal_pointer_array_add(&mca_types, "mtl"); + /* add the top-level type */ opal_pointer_array_add(&mca_types, "ompi"); - opal_pointer_array_add(&mca_types, "op"); - opal_pointer_array_add(&mca_types, "osc"); - opal_pointer_array_add(&mca_types, "pml"); - opal_pointer_array_add(&mca_types, "pubsub"); - opal_pointer_array_add(&mca_types, "rcache"); - opal_pointer_array_add(&mca_types, "sharedfp"); - opal_pointer_array_add(&mca_types, "topo"); + + /* push all the types found by autogen */ + for (i=0; NULL != ompi_frameworks[i]; i++) { + opal_pointer_array_add(&mca_types, ompi_frameworks[i]->framework_name); + } /* init the component map */ OBJ_CONSTRUCT(&component_map, opal_pointer_array_t); opal_pointer_array_init(&component_map, 256, INT_MAX, 128); /* Register OPAL's params */ - if (OPAL_SUCCESS != (ret = opal_info_register_components(&mca_types, &component_map))) { + if (OPAL_SUCCESS != (ret = opal_info_register_framework_params(&component_map))) { if (OPAL_ERR_BAD_PARAM == ret) { /* output where the error occurred */ opal_info_err_params(&component_map); @@ -150,7 +133,7 @@ int main(int argc, char *argv[]) #if OMPI_RTE_ORTE /* Register ORTE's params */ - if (OMPI_SUCCESS != (ret = orte_info_register_components(&mca_types, &component_map))) { + if (OMPI_SUCCESS != (ret = orte_info_register_framework_params(&component_map))) { if (OPAL_ERR_BAD_PARAM == ret) { /* output what we got */ opal_info_do_params(true, opal_cmd_line_is_taken(ompi_info_cmd_line, "internal"), @@ -161,7 +144,7 @@ int main(int argc, char *argv[]) #endif /* Register OMPI's params */ - if (OMPI_SUCCESS != (ret = ompi_info_register_components(&mca_types, &component_map))) { + if (OMPI_SUCCESS != (ret = ompi_info_register_framework_params(&component_map))) { if (OMPI_ERR_BAD_PARAM == ret) { /* output what we got */ opal_info_do_params(true, opal_cmd_line_is_taken(ompi_info_cmd_line, "internal"), diff --git a/ompi/tools/ompi_info/ompi_info.h b/ompi/tools/ompi_info/ompi_info.h index 7fe5b20fe1..78e6aec3f0 100644 --- a/ompi/tools/ompi_info/ompi_info.h +++ b/ompi/tools/ompi_info/ompi_info.h @@ -10,6 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2013 Los Alamos National Security, LLC. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -41,8 +43,7 @@ void ompi_info_do_version(bool want_all, opal_cmd_line_t *cmd_line, void ompi_info_show_ompi_version(const char *scope); -int ompi_info_register_components(opal_pointer_array_t *mca_types, - opal_pointer_array_t *component_map); +int ompi_info_register_framework_params(opal_pointer_array_t *component_map); void ompi_info_close_components(void); void ompi_info_do_config(bool want_all); diff --git a/ompi/tools/ompi_info/version.c b/ompi/tools/ompi_info/version.c index 40c7daac9c..c3c1ea4482 100644 --- a/ompi/tools/ompi_info/version.c +++ b/ompi/tools/ompi_info/version.c @@ -51,7 +51,6 @@ * Private functions */ - /* * do_version * diff --git a/opal/runtime/opal_info_support.c b/opal/runtime/opal_info_support.c index b0f04a4eb6..cbe15e0ded 100644 --- a/opal/runtime/opal_info_support.c +++ b/opal/runtime/opal_info_support.c @@ -218,8 +218,8 @@ static int info_register_framework (mca_base_framework_t *framework, opal_pointe opal_info_component_map_t *map; int rc; - if ((OPAL_SUCCESS != (rc = mca_base_framework_register(framework, MCA_BASE_REGISTER_ALL))) || - OPAL_ERR_BAD_PARAM != rc) { + rc = mca_base_framework_register(framework, MCA_BASE_REGISTER_ALL); + if (OPAL_SUCCESS != rc && OPAL_ERR_BAD_PARAM != rc) { return rc; } @@ -233,178 +233,40 @@ static int info_register_framework (mca_base_framework_t *framework, opal_pointe void opal_info_register_types(opal_pointer_array_t *mca_types) { - opal_pointer_array_add(mca_types, "backtrace"); - opal_pointer_array_add(mca_types, "db"); -#if OPAL_ENABLE_FT_CR == 1 - opal_cr_set_enabled(true); - opal_pointer_array_add(mca_types, "compress"); - opal_pointer_array_add(mca_types, "crs"); -#endif - opal_pointer_array_add(mca_types, "event"); - opal_pointer_array_add(mca_types, "filter"); - opal_pointer_array_add(mca_types, "hwloc"); - opal_pointer_array_add(mca_types, "if"); - opal_pointer_array_add(mca_types, "installdirs"); - opal_pointer_array_add(mca_types, "mca"); - opal_pointer_array_add(mca_types, "memchecker"); - opal_pointer_array_add(mca_types, "memory"); - opal_pointer_array_add(mca_types, "memcpy"); - opal_pointer_array_add(mca_types, "opal"); - opal_pointer_array_add(mca_types, "shmem"); - opal_pointer_array_add(mca_types, "timer"); + int i; + /* add the top-level types */ + opal_pointer_array_add(mca_types, "mca"); + opal_pointer_array_add(mca_types, "opal"); + + /* push all the types found by autogen */ + for (i=0; NULL != opal_frameworks[i]; i++) { + opal_pointer_array_add(mca_types, opal_frameworks[i]->framework_name); + } } -int opal_info_register_components(opal_pointer_array_t *mca_types, - opal_pointer_array_t *component_map) +int opal_info_register_framework_params(opal_pointer_array_t *component_map) { - opal_info_component_map_t *map; - char *env, *str; int i, rc; - char *target, *save, *type; - char **env_save=NULL; + char *str; - /* Clear out the environment. Use strdup() to orphan the resulting - * strings because items are placed in the environment by reference, - * not by value. - */ - for (i = 0; i < mca_types->size; ++i) { - if (NULL == (type = (char*)opal_pointer_array_get_item(mca_types, i))) { - continue; - } - asprintf(&env, "OMPI_MCA_%s", type); - if (NULL != (save = getenv(env))) { - /* save this param so it can later be restored */ - asprintf(&str, "%s=%s", env, save); - opal_argv_append_nosize(&env_save, str); - free(str); - /* can't manipulate it directly, so make a copy first */ - asprintf(&target, "%s=", env); - putenv(target); - } - free(env); - } - - /* some components require the event library be active, so activate it */ - if (OPAL_SUCCESS != (rc = mca_base_framework_open(&opal_event_base_framework, 0))) { - str = "event open"; - goto breakout; - } - - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup(opal_event_base_framework.framework_name); - map->components = &opal_event_base_framework.framework_components; - opal_pointer_array_add(component_map, map); - - /* Open the DSS */ - if (OPAL_SUCCESS != (rc = opal_dss_open())) { - if (OPAL_ERR_BAD_PARAM == rc) { - str = "opal_dss"; - goto breakout; - } - str = "dss_open"; - goto error; - } - /* Register the OPAL layer's MCA parameters */ if (OPAL_SUCCESS != (rc = opal_register_params())) { str = "opal_register_params"; - if (OPAL_ERR_BAD_PARAM == rc) { - goto breakout; - } goto error; } /* OPAL frameworks */ - - if (OPAL_SUCCESS != (rc = info_register_framework (&opal_backtrace_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "backtrace register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework (&opal_db_base_framework, component_map))) { - str = "db open"; - goto breakout; - } - -#if OPAL_ENABLE_FT_CR == 1 - if (OPAL_SUCCESS != (rc = info_register_framework (&opal_compress_base_framework, component_map))) { - str = "compress register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework (&opal_crs_base_framework, component_map))) { - str = "crs open"; - goto breakout; - } -#endif - -#if OPAL_HAVE_HWLOC - if (OPAL_SUCCESS != (rc = info_register_framework (&opal_hwloc_base_framework, component_map))) { - str = "hwloc open"; - goto breakout; - } -#endif - - if (OPAL_SUCCESS != (rc = info_register_framework (&opal_if_base_framework, component_map))) { - str = "if open"; - goto breakout; - } - - /* OPAL's installdirs base open has already been called as part of - * opal_init_util() back in main(). - */ - map = OBJ_NEW(opal_info_component_map_t); - map->type = strdup(opal_installdirs_base_framework.framework_name); - map->components = &opal_installdirs_base_framework.framework_components; - opal_pointer_array_add(component_map, map); - - if (OPAL_SUCCESS != (rc = info_register_framework (&opal_memory_base_framework, component_map))) { - str = "memory"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework (&opal_memcpy_base_framework, component_map))) { - str = "memcpy"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework (&opal_memchecker_base_framework, component_map))) { - str = "memchecker open"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework (&opal_shmem_base_framework, component_map))) { - str = "shmem"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework (&opal_timer_base_framework, component_map))) { - str = "timer"; - } - - breakout: - if (OPAL_ERR_BAD_PARAM == rc || OPAL_SUCCESS == rc) { - /* Restore the environment to what it was before we started so that - * if users setenv OMPI_MCA_ to some value, they'll - * see that value when it is shown via --param output. - */ - - if (NULL != env_save) { - for (i = 0; i < opal_argv_count(env_save); ++i) { - putenv(env_save[i]); - } + for (i=0; NULL != opal_frameworks[i]; i++) { + if (OPAL_SUCCESS != (rc = info_register_framework(opal_frameworks[i], component_map))) { + fprintf (stderr, "rc = %d\n", rc); + str = opal_frameworks[i]->framework_name; + goto error; } - - if (OPAL_ERR_BAD_PARAM == rc) { - fprintf(stderr, "\nA \"bad parameter\" error was encountered when opening the OPAL %s framework.\n", str); - fprintf(stderr, "The output received from that framework includes the following parameters:\n\n"); - } - - return rc; } + return OPAL_SUCCESS; + error: fprintf(stderr, "opal_info_register: %s failed\n", str); return OPAL_ERROR; @@ -413,23 +275,11 @@ int opal_info_register_components(opal_pointer_array_t *mca_types, void opal_info_close_components(void) { - (void) mca_base_framework_close(&opal_backtrace_base_framework); - (void) mca_base_framework_close(&opal_memcpy_base_framework); - (void) mca_base_framework_close(&opal_memory_base_framework); - (void) mca_base_framework_close(&opal_memchecker_base_framework); - (void) mca_base_framework_close(&opal_timer_base_framework); -#if OPAL_HAVE_HWLOC - (void) mca_base_framework_close(&opal_hwloc_base_framework); -#endif -#if OPAL_ENABLE_FT_CR == 1 - (void) mca_base_framework_close(&opal_crs_base_framework); -#endif - (void) opal_dss_close(); - (void) mca_base_framework_close(&opal_event_base_framework); - - /* Do not call OPAL's installdirs close; it will be handled in - * opal_finalize_util(). Ditto for opal_if. - */ + int i; + + for (i=0; NULL != opal_frameworks[i]; i++) { + (void) mca_base_framework_close(opal_frameworks[i]); + } } diff --git a/opal/runtime/opal_info_support.h b/opal/runtime/opal_info_support.h index ad82d08b5e..efa8897458 100644 --- a/opal/runtime/opal_info_support.h +++ b/opal/runtime/opal_info_support.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Los Alamos National Security, LLC. + * Copyright (c) 2012-2013 Los Alamos National Security, LLC. * All rights reserved. * $COPYRIGHT$ * @@ -60,8 +60,7 @@ OPAL_DECLSPEC void opal_info_finalize(void); OPAL_DECLSPEC void opal_info_register_types(opal_pointer_array_t *mca_types); -OPAL_DECLSPEC int opal_info_register_components(opal_pointer_array_t *mca_types, - opal_pointer_array_t *component_map); +OPAL_DECLSPEC int opal_info_register_framework_params(opal_pointer_array_t *component_map); OPAL_DECLSPEC void opal_info_close_components(void); OPAL_DECLSPEC void opal_info_err_params(opal_pointer_array_t *component_map); diff --git a/orte/runtime/orte_info_support.c b/orte/runtime/orte_info_support.c index efac971e88..7ad1f49e6c 100644 --- a/orte/runtime/orte_info_support.c +++ b/orte/runtime/orte_info_support.c @@ -25,31 +25,13 @@ #include "orte/types.h" #include "opal/class/opal_pointer_array.h" +#include "opal/util/argv.h" #include "opal/runtime/opal_info_support.h" -#include "orte/mca/dfs/base/base.h" -#include "orte/mca/errmgr/base/base.h" -#include "orte/mca/ess/base/base.h" -#include "orte/mca/grpcomm/base/base.h" -#include "orte/mca/iof/base/base.h" -#include "orte/mca/odls/base/base.h" -#include "orte/mca/oob/base/base.h" -#include "orte/mca/plm/base/base.h" -#include "orte/mca/ras/base/ras_private.h" -#include "orte/mca/rmaps/base/base.h" -#include "orte/mca/rml/base/base.h" -#include "orte/mca/routed/base/base.h" -#if OPAL_ENABLE_FT_CR == 1 -#include "orte/mca/snapc/base/base.h" -#include "orte/mca/sstore/base/base.h" -#endif -#if ORTE_ENABLE_SENSORS -#include "orte/mca/sensor/base/base.h" -#endif -#include "orte/mca/filem/base/base.h" -#include "orte/mca/state/base/base.h" +#include "orte/include/orte/frameworks.h" #include "orte/util/proc_info.h" #include "orte/runtime/runtime.h" +#include "orte/runtime/orte_globals.h" #include "orte/runtime/orte_info_support.h" @@ -57,37 +39,23 @@ const char *orte_info_type_orte = "orte"; void orte_info_register_types(opal_pointer_array_t *mca_types) { - /* frameworks */ - opal_pointer_array_add(mca_types, "dfs"); - opal_pointer_array_add(mca_types, "errmgr"); - opal_pointer_array_add(mca_types, "ess"); - opal_pointer_array_add(mca_types, "filem"); - opal_pointer_array_add(mca_types, "grpcomm"); - opal_pointer_array_add(mca_types, "iof"); - opal_pointer_array_add(mca_types, "odls"); - opal_pointer_array_add(mca_types, "oob"); + int i; + + /* add the top-level type */ opal_pointer_array_add(mca_types, "orte"); - opal_pointer_array_add(mca_types, "plm"); - opal_pointer_array_add(mca_types, "ras"); - opal_pointer_array_add(mca_types, "rmaps"); - opal_pointer_array_add(mca_types, "rml"); - opal_pointer_array_add(mca_types, "routed"); -#if ORTE_ENABLE_SENSORS - opal_pointer_array_add(mca_types, "sensor"); -#endif -#if OPAL_ENABLE_FT_CR == 1 - opal_pointer_array_add(mca_types, "snapc"); - opal_pointer_array_add(mca_types, "sstore"); -#endif - opal_pointer_array_add(mca_types, "state"); + + /* push all the types found by autogen */ + for (i=0; NULL != orte_frameworks[i]; i++) { + opal_pointer_array_add(mca_types, orte_frameworks[i]->framework_name); + } } static int info_register_framework (mca_base_framework_t *framework, opal_pointer_array_t *component_map) { opal_info_component_map_t *map; int rc; - if ((OPAL_SUCCESS != (rc = mca_base_framework_register(framework, MCA_BASE_REGISTER_ALL))) || - OPAL_ERR_BAD_PARAM != rc) { + rc = mca_base_framework_register(framework, MCA_BASE_REGISTER_ALL); + if (OPAL_SUCCESS != rc && OPAL_ERR_BAD_PARAM != rc) { return rc; } @@ -99,43 +67,10 @@ static int info_register_framework (mca_base_framework_t *framework, opal_pointe return rc; } -int orte_info_register_components(opal_pointer_array_t *mca_types, - opal_pointer_array_t *component_map) +int orte_info_register_framework_params(opal_pointer_array_t *component_map) { - char *env, *str; + char *str; int i, rc; - char *target, *save, *type; - char **env_save=NULL; - - /* Clear out the environment. Use strdup() to orphan the resulting - * strings because items are placed in the environment by reference, - * not by value. - */ - for (i = 0; i < mca_types->size; ++i) { - if (NULL == (type = (char*)opal_pointer_array_get_item(mca_types, i))) { - continue; - } - asprintf(&env, "OMPI_MCA_%s", type); - if (NULL != (save = getenv(env))) { - /* save this param so it can later be restored */ - asprintf(&str, "%s=%s", env, save); - opal_argv_append_nosize(&env_save, str); - free(str); - /* can't manipulate it directly, so make a copy first */ - asprintf(&target, "%s=", env); - putenv(target); - } - free(env); - } - - /* Set orte_process_info.proc_type to HNP to force all frameworks to - * open components - */ - orte_process_info.proc_type = ORTE_PROC_HNP; - /* set the event base to be the opal event base as we - * aren't attempting to do anything with progress threads here - */ - orte_event_base = opal_event_base; /* Register the ORTE layer's MCA parameters */ @@ -145,121 +80,11 @@ int orte_info_register_components(opal_pointer_array_t *mca_types, goto error; } - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_dfs_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "dfs register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_errmgr_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "errmgr register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_ess_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "ess register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_filem_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "filem register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_grpcomm_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "grpcomm register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_iof_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "iof register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_odls_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "odls register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_oob_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "oob register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_plm_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "plm register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_ras_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "ras register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_rmaps_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "rmaps register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_rml_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "rml register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_routed_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "routed register"; - goto breakout; - } - -#if ORTE_ENABLE_SENSORS - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_sensor_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "sensor register"; - goto breakout; - } -#endif - -#if OPAL_ENABLE_FT_CR == 1 - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_snapc_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "snapc register"; - goto breakout; - } - - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_sstore_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "sstore register"; - goto breakout; - } -#endif - - if (OPAL_SUCCESS != (rc = info_register_framework(&orte_state_base_framework, component_map))) { - fprintf (stderr, "rc = %d\n", rc); - str = "state register"; - goto breakout; - } - - breakout: - /* Restore the environment to what it was before we started so that - * if users setenv OMPI_MCA_ to some value, they'll - * see that value when it is shown via --param output. - */ - - if (NULL != env_save) { - for (i = 0; i < opal_argv_count(env_save); ++i) { - putenv(env_save[i]); + for (i=0; NULL != orte_frameworks[i]; i++) { + if (OPAL_SUCCESS != (rc = info_register_framework(orte_frameworks[i], component_map))) { + fprintf (stderr, "rc = %d\n", rc); + str = orte_frameworks[i]->framework_name; + goto error; } } @@ -277,27 +102,11 @@ int orte_info_register_components(opal_pointer_array_t *mca_types, void orte_info_close_components(void) { - (void) mca_base_framework_close(&orte_dfs_base_framework); - (void) mca_base_framework_close(&orte_errmgr_base_framework); - (void) mca_base_framework_close(&orte_ess_base_framework); - (void) mca_base_framework_close(&orte_filem_base_framework); - (void) mca_base_framework_close(&orte_grpcomm_base_framework); - (void) mca_base_framework_close(&orte_iof_base_framework); - (void) mca_base_framework_close(&orte_odls_base_framework); - (void) mca_base_framework_close(&orte_oob_base_framework); - (void) mca_base_framework_close(&orte_plm_base_framework); - (void) mca_base_framework_close(&orte_ras_base_framework); - (void) mca_base_framework_close(&orte_rmaps_base_framework); - (void) mca_base_framework_close(&orte_rml_base_framework); - (void) mca_base_framework_close(&orte_routed_base_framework); -#if ORTE_ENABLE_SENSORS - (void) mca_base_framework_close(&orte_sensor_base_framework); -#endif -#if OPAL_ENABLE_FT_CR == 1 - (void) mca_base_framework_close(&orte_snapc_base_framework); - (void) mca_base_framework_close(&orte_sstore_base_framework); -#endif - (void) mca_base_framework_close(&orte_state_base_framework); + int i; + + for (i=0; NULL != orte_frameworks[i]; i++) { + (void) mca_base_framework_close(orte_frameworks[i]); + } } void orte_info_show_orte_version(const char *scope) diff --git a/orte/runtime/orte_info_support.h b/orte/runtime/orte_info_support.h index e138461302..b43e9ef412 100644 --- a/orte/runtime/orte_info_support.h +++ b/orte/runtime/orte_info_support.h @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2010-2012 Los Alamos National Security, LLC. + * Copyright (c) 2010-2013 Los Alamos National Security, LLC. * All rights reserved. * Copyright (c) 2011-2012 University of Houston. All rights reserved. * $COPYRIGHT$ @@ -33,8 +33,7 @@ ORTE_DECLSPEC extern const char *orte_info_type_orte; ORTE_DECLSPEC void orte_info_register_types(opal_pointer_array_t *mca_types); -ORTE_DECLSPEC int orte_info_register_components(opal_pointer_array_t *mca_types, - opal_pointer_array_t *component_map); +ORTE_DECLSPEC int orte_info_register_framework_params(opal_pointer_array_t *component_map); ORTE_DECLSPEC void orte_info_close_components(void); diff --git a/orte/tools/orte-info/components.c b/orte/tools/orte-info/components.c index a66f9a6ce5..69132c5788 100644 --- a/orte/tools/orte-info/components.c +++ b/orte/tools/orte-info/components.c @@ -65,13 +65,6 @@ opal_pointer_array_t component_map; static bool opened_components = false; -/* - * Open all MCA components so that they can register their MCA - * parameters. Take a shotgun approach here and indiscriminately open - * all components -- don't be selective. To this end, we need to clear - * out the environment of all OMPI_MCA_ variables to ensure - * that the open algorithms don't try to only open one component. - */ void orte_info_components_open(void) { if (opened_components) { @@ -84,8 +77,8 @@ void orte_info_components_open(void) OBJ_CONSTRUCT(&component_map, opal_pointer_array_t); opal_pointer_array_init(&component_map, 256, INT_MAX, 128); - opal_info_register_components (&mca_types, &component_map); - orte_info_register_components (&mca_types, &component_map); + opal_info_register_framework_params(&component_map); + orte_info_register_framework_params(&component_map); } /* diff --git a/orte/tools/orte-info/orte-info.c b/orte/tools/orte-info/orte-info.c index 1afa85c68c..7b12cb14f6 100644 --- a/orte/tools/orte-info/orte-info.c +++ b/orte/tools/orte-info/orte-info.c @@ -39,6 +39,7 @@ #include "opal/class/opal_object.h" #include "opal/class/opal_pointer_array.h" #include "opal/runtime/opal.h" +#include "opal/runtime/opal_info_support.h" #include "opal/util/cmd_line.h" #include "opal/util/error.h" #include "opal/util/argv.h" @@ -195,48 +196,9 @@ int main(int argc, char *argv[]) /* setup the mca_types array */ OBJ_CONSTRUCT(&mca_types, opal_pointer_array_t); opal_pointer_array_init(&mca_types, 256, INT_MAX, 128); - - opal_pointer_array_add(&mca_types, "mca"); - opal_pointer_array_add(&mca_types, "orte"); - opal_pointer_array_add(&mca_types, "opal"); - - opal_pointer_array_add(&mca_types, "filter"); - opal_pointer_array_add(&mca_types, "backtrace"); - opal_pointer_array_add(&mca_types, "memchecker"); - opal_pointer_array_add(&mca_types, "memory"); - opal_pointer_array_add(&mca_types, "paffinity"); - opal_pointer_array_add(&mca_types, "carto"); - opal_pointer_array_add(&mca_types, "shmem"); - opal_pointer_array_add(&mca_types, "maffinity"); - opal_pointer_array_add(&mca_types, "timer"); - opal_pointer_array_add(&mca_types, "installdirs"); -#if OPAL_HAVE_HWLOC - opal_pointer_array_add(&mca_types, "hwloc"); -#endif -#if OPAL_ENABLE_FT_CR == 1 - opal_pointer_array_add(&mca_types, "crs"); -#endif - opal_pointer_array_add(&mca_types, "if"); - opal_pointer_array_add(&mca_types, "event"); - - opal_pointer_array_add(&mca_types, "iof"); - opal_pointer_array_add(&mca_types, "oob"); - opal_pointer_array_add(&mca_types, "odls"); - opal_pointer_array_add(&mca_types, "ras"); - opal_pointer_array_add(&mca_types, "rmaps"); - opal_pointer_array_add(&mca_types, "rml"); - opal_pointer_array_add(&mca_types, "routed"); - opal_pointer_array_add(&mca_types, "plm"); -#if OPAL_ENABLE_FT_CR == 1 - opal_pointer_array_add(&mca_types, "snapc"); -#endif - opal_pointer_array_add(&mca_types, "sensor"); - opal_pointer_array_add(&mca_types, "filem"); - opal_pointer_array_add(&mca_types, "state"); - opal_pointer_array_add(&mca_types, "errmgr"); - opal_pointer_array_add(&mca_types, "ess"); - opal_pointer_array_add(&mca_types, "grpcomm"); - opal_pointer_array_add(&mca_types, "db"); + + opal_info_register_types(&mca_types); + orte_info_register_types(&mca_types); /* Execute the desired action(s) */ diff --git a/orte/tools/orte-info/version.c b/orte/tools/orte-info/version.c index 68a616e0b5..08501df566 100644 --- a/orte/tools/orte-info/version.c +++ b/orte/tools/orte-info/version.c @@ -148,7 +148,6 @@ void orte_info_show_component_version(const char *type_name, } /* Check to see if the type is valid */ - for (found = false, j = 0; j < mca_types.size; ++j) { if (NULL == (pos = (char*)opal_pointer_array_get_item(&mca_types, j))) { continue;