diff --git a/ompi/mca/pml/base/pml_base_frame.c b/ompi/mca/pml/base/pml_base_frame.c index 8468c5c4f17..2ab970b5324 100644 --- a/ompi/mca/pml/base/pml_base_frame.c +++ b/ompi/mca/pml/base/pml_base_frame.c @@ -192,6 +192,9 @@ static int mca_pml_base_close(void) OBJ_DESTRUCT(&mca_pml_base_send_requests); OBJ_DESTRUCT(&mca_pml_base_recv_requests); + OBJ_DESTRUCT(&mca_pml_ob1_send_requests); + OBJ_DESTRUCT(&mca_pml_ob1_recv_requests); + mca_pml.pml_progress = mca_pml_base_progress; /* Free all the strings in the array */ @@ -223,6 +226,9 @@ static int mca_pml_base_open(mca_base_open_flag_t flags) OBJ_CONSTRUCT(&mca_pml_base_send_requests, opal_free_list_t); OBJ_CONSTRUCT(&mca_pml_base_recv_requests, opal_free_list_t); + OBJ_CONSTRUCT(&mca_pml_ob1_send_requests, opal_free_list_t); + OBJ_CONSTRUCT(&mca_pml_ob1_recv_requests, opal_free_list_t); + OBJ_CONSTRUCT(&mca_pml_base_pml, opal_pointer_array_t); /* Open up all available components */ @@ -261,6 +267,7 @@ static int mca_pml_base_open(mca_base_open_flag_t flags) opal_pointer_array_add(&mca_pml_base_pml, strdup("ob1")); opal_pointer_array_add(&mca_pml_base_pml, strdup("ucx")); opal_pointer_array_add(&mca_pml_base_pml, strdup("cm")); + opal_pointer_array_add(&mca_pml_base_pml, strdup("topo")); } else { #if OPAL_ENABLE_DEBUG char **req_pml = opal_argv_split(default_pml[0], ','); diff --git a/ompi/mca/pml/base/pml_base_request.c b/ompi/mca/pml/base/pml_base_request.c index 791e6838ab5..7a25bfc952a 100644 --- a/ompi/mca/pml/base/pml_base_request.c +++ b/ompi/mca/pml/base/pml_base_request.c @@ -30,6 +30,9 @@ opal_free_list_t mca_pml_base_send_requests = {{{0}}}; opal_free_list_t mca_pml_base_recv_requests = {{{0}}}; +opal_free_list_t mca_pml_ob1_send_requests = {{{0}}}; +opal_free_list_t mca_pml_ob1_recv_requests = {{{0}}}; + static void mca_pml_base_request_construct(mca_pml_base_request_t* req) { req->req_ompi.req_type = OMPI_REQUEST_PML; diff --git a/ompi/mca/pml/base/pml_base_request.h b/ompi/mca/pml/base/pml_base_request.h index 90a86505e07..0e2619d99ed 100644 --- a/ompi/mca/pml/base/pml_base_request.h +++ b/ompi/mca/pml/base/pml_base_request.h @@ -44,6 +44,9 @@ BEGIN_C_DECLS OMPI_DECLSPEC extern opal_free_list_t mca_pml_base_send_requests; OMPI_DECLSPEC extern opal_free_list_t mca_pml_base_recv_requests; +OMPI_DECLSPEC extern opal_free_list_t mca_pml_ob1_send_requests; +OMPI_DECLSPEC extern opal_free_list_t mca_pml_ob1_recv_requests; + /** * Type of request. */ diff --git a/ompi/mca/pml/base/pml_base_select.c b/ompi/mca/pml/base/pml_base_select.c index e66ec02b5e4..ff1cb508d4b 100644 --- a/ompi/mca/pml/base/pml_base_select.c +++ b/ompi/mca/pml/base/pml_base_select.c @@ -189,7 +189,11 @@ int mca_pml_base_select(bool enable_progress_threads, item = opal_list_remove_first(&opened)) { om = (opened_component_t *) item; - if (om->om_component != best_component ) { + if (om->om_component != best_component + && strncmp(om->om_component->pmlm_version.mca_component_name, "ob1", + strlen(om->om_component->pmlm_version.mca_component_name)) + && strncmp(om->om_component->pmlm_version.mca_component_name, "cm", + strlen(om->om_component->pmlm_version.mca_component_name))) { /* Finalize */ if (NULL != om->om_component->pmlm_finalize) { @@ -213,9 +217,20 @@ 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(ompi_pml_base_framework.framework_output, - &ompi_pml_base_framework.framework_components, - (mca_base_component_t *) best_component); + // mca_base_components_close(ompi_pml_base_framework.framework_output, + // &ompi_pml_base_framework.framework_components, + // (mca_base_component_t *) best_component); + + 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 != best_component + && strncmp(om->om_component->pmlm_version.mca_component_name, "ob1", + strlen(om->om_component->pmlm_version.mca_component_name)) + && strncmp(om->om_component->pmlm_version.mca_component_name, "cm", + strlen(om->om_component->pmlm_version.mca_component_name))) { + mca_base_component_close(component, ompi_pml_base_framework.framework_output); + } + } /* register the winner's callback */ if( NULL != mca_pml.pml_progress ) { diff --git a/ompi/mca/pml/cm/pml_cm.c b/ompi/mca/pml/cm/pml_cm.c index 51a63fdba4c..575e5e6fca0 100644 --- a/ompi/mca/pml/cm/pml_cm.c +++ b/ompi/mca/pml/cm/pml_cm.c @@ -127,11 +127,11 @@ mca_pml_cm_add_procs(struct ompi_proc_t** procs, size_t nprocs) #endif /* make sure remote procs are using the same PML as us */ - if (OMPI_SUCCESS != (ret = mca_pml_base_pml_check_selected("cm", - procs, - nprocs))) { - return ret; - } + // if (OMPI_SUCCESS != (ret = mca_pml_base_pml_check_selected("cm", + // procs, + // nprocs))) { + // return ret; + // } ret = OMPI_MTL_CALL(add_procs(ompi_mtl, nprocs, procs)); return ret; diff --git a/ompi/mca/pml/ob1/pml_ob1.c b/ompi/mca/pml/ob1/pml_ob1.c index c8d0df3e24a..1995f51425d 100644 --- a/ompi/mca/pml/ob1/pml_ob1.c +++ b/ompi/mca/pml/ob1/pml_ob1.c @@ -175,7 +175,7 @@ int mca_pml_ob1_enable(bool enable) * should get ownership for the send and receive requests list, and * initialize them with the size of our own requests. */ - opal_free_list_init ( &mca_pml_base_send_requests, + opal_free_list_init ( &mca_pml_ob1_send_requests, sizeof(mca_pml_ob1_send_request_t) + sizeof(mca_pml_ob1_com_btl_t[mca_pml_ob1.max_rdma_per_request]), opal_cache_line_size, @@ -186,7 +186,7 @@ int mca_pml_ob1_enable(bool enable) mca_pml_ob1.free_list_inc, NULL, 0, NULL, NULL, NULL); - opal_free_list_init ( &mca_pml_base_recv_requests, + opal_free_list_init ( &mca_pml_ob1_recv_requests, sizeof(mca_pml_ob1_recv_request_t) + sizeof(mca_pml_ob1_com_btl_t[mca_pml_ob1.max_rdma_per_request]), opal_cache_line_size, @@ -388,11 +388,11 @@ int mca_pml_ob1_add_procs(ompi_proc_t** procs, size_t nprocs) return rc; /* make sure remote procs are using the same PML as us */ - if (OMPI_SUCCESS != (rc = mca_pml_base_pml_check_selected("ob1", - procs, - nprocs))) { - return rc; - } + // if (OMPI_SUCCESS != (rc = mca_pml_base_pml_check_selected("ob1", + // procs, + // nprocs))) { + // return rc; + // } OBJ_CONSTRUCT(&reachable, opal_bitmap_t); rc = opal_bitmap_init(&reachable, (int)nprocs); diff --git a/ompi/mca/pml/ob1/pml_ob1.h b/ompi/mca/pml/ob1/pml_ob1.h index ddfd4693c13..7371d2ebb24 100644 --- a/ompi/mca/pml/ob1/pml_ob1.h +++ b/ompi/mca/pml/ob1/pml_ob1.h @@ -94,6 +94,8 @@ typedef struct mca_pml_ob1_t mca_pml_ob1_t; extern mca_pml_ob1_t mca_pml_ob1; extern int mca_pml_ob1_output; extern bool mca_pml_ob1_matching_protection; +OMPI_DECLSPEC extern opal_free_list_t mca_pml_ob1_send_requests; +OMPI_DECLSPEC extern opal_free_list_t mca_pml_ob1_recv_requests; /* * PML interface functions. */ diff --git a/ompi/mca/pml/ob1/pml_ob1_component.c b/ompi/mca/pml/ob1/pml_ob1_component.c index a9a36413202..dc8fbea05a6 100644 --- a/ompi/mca/pml/ob1/pml_ob1_component.c +++ b/ompi/mca/pml/ob1/pml_ob1_component.c @@ -344,12 +344,12 @@ int mca_pml_ob1_component_fini(void) /* return the static receive/send requests to the respective free list and * let the free list handle destruction. */ if( NULL != mca_pml_ob1_recvreq ) { - opal_free_list_return (&mca_pml_base_recv_requests, (opal_free_list_item_t *) mca_pml_ob1_recvreq); + opal_free_list_return (&mca_pml_ob1_recv_requests, (opal_free_list_item_t *) mca_pml_ob1_recvreq); mca_pml_ob1_recvreq = NULL; } if( NULL != mca_pml_ob1_sendreq ) { - opal_free_list_return (&mca_pml_base_send_requests, (opal_free_list_item_t *) mca_pml_ob1_sendreq); + opal_free_list_return (&mca_pml_ob1_send_requests, (opal_free_list_item_t *) mca_pml_ob1_sendreq); mca_pml_ob1_sendreq = NULL; } @@ -375,17 +375,17 @@ int mca_pml_ob1_component_fini(void) } #if 0 - if (mca_pml_base_send_requests.fl_num_allocated != - mca_pml_base_send_requests.super.opal_list_length) { + if (mca_pml_ob1_send_requests.fl_num_allocated != + mca_pml_ob1_send_requests.super.opal_list_length) { opal_output(0, "ob1 send requests: %d allocated %d returned\n", - mca_pml_base_send_requests.fl_num_allocated, - mca_pml_base_send_requests.super.opal_list_length); + mca_pml_ob1_send_requests.fl_num_allocated, + mca_pml_ob1_send_requests.super.opal_list_length); } - if (mca_pml_base_recv_requests.fl_num_allocated != - mca_pml_base_recv_requests.super.opal_list_length) { + if (mca_pml_ob1_recv_requests.fl_num_allocated != + mca_pml_ob1_recv_requests.super.opal_list_length) { opal_output(0, "ob1 recv requests: %d allocated %d returned\n", - mca_pml_base_recv_requests.fl_num_allocated, - mca_pml_base_recv_requests.super.opal_list_length); + mca_pml_ob1_recv_requests.fl_num_allocated, + mca_pml_ob1_recv_requests.super.opal_list_length); } #endif diff --git a/ompi/mca/pml/ob1/pml_ob1_recvreq.h b/ompi/mca/pml/ob1/pml_ob1_recvreq.h index 402d3f4dcec..b261b931ceb 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvreq.h +++ b/ompi/mca/pml/ob1/pml_ob1_recvreq.h @@ -82,7 +82,7 @@ static inline bool unlock_recv_request(mca_pml_ob1_recv_request_t *recvreq) #define MCA_PML_OB1_RECV_REQUEST_ALLOC(recvreq) \ do { \ recvreq = (mca_pml_ob1_recv_request_t *) \ - opal_free_list_get (&mca_pml_base_recv_requests); \ + opal_free_list_get (&mca_pml_ob1_recv_requests); \ } while(0) @@ -115,6 +115,9 @@ do { \ tag, \ comm, \ persistent); \ + (request)->req_rdma_cnt = 0; \ + (request)->rdma_bml = 0; \ + (request)->local_handle = NULL; \ } while(0) /** @@ -144,7 +147,7 @@ static inline void mca_pml_ob1_recv_request_fini (mca_pml_ob1_recv_request_t *re #define MCA_PML_OB1_RECV_REQUEST_RETURN(recvreq) \ { \ mca_pml_ob1_recv_request_fini (recvreq); \ - opal_free_list_return (&mca_pml_base_recv_requests, \ + opal_free_list_return (&mca_pml_ob1_recv_requests, \ (opal_free_list_item_t*)(recvreq)); \ } diff --git a/ompi/mca/pml/ob1/pml_ob1_sendreq.h b/ompi/mca/pml/ob1/pml_ob1_sendreq.h index 1d50ecc033d..508ebd1b580 100644 --- a/ompi/mca/pml/ob1/pml_ob1_sendreq.h +++ b/ompi/mca/pml/ob1/pml_ob1_sendreq.h @@ -130,7 +130,7 @@ get_request_from_send_pending(mca_pml_ob1_send_pending_t *type) \ if( OPAL_LIKELY(NULL != proc) ) { \ sendreq = (mca_pml_ob1_send_request_t*) \ - opal_free_list_wait (&mca_pml_base_send_requests); \ + opal_free_list_wait (&mca_pml_ob1_send_requests); \ sendreq->req_send.req_base.req_proc = proc; \ } \ } @@ -159,6 +159,7 @@ get_request_from_send_pending(mca_pml_ob1_send_pending_t *type) 0); /* convertor_flags */ \ (sendreq)->req_recv.pval = NULL; \ (sendreq)->ob1_proc = ob1_proc; \ + (sendreq)->req_rdma_cnt = 0; \ } #define MCA_PML_OB1_SEND_REQUEST_RESET(sendreq) \ @@ -241,7 +242,7 @@ static inline void mca_pml_ob1_send_request_fini (mca_pml_ob1_send_request_t *se #define MCA_PML_OB1_SEND_REQUEST_RETURN(sendreq) \ do { \ mca_pml_ob1_send_request_fini (sendreq); \ - opal_free_list_return ( &mca_pml_base_send_requests, \ + opal_free_list_return ( &mca_pml_ob1_send_requests, \ (opal_free_list_item_t*)sendreq); \ sendreq = NULL; /* for safety */ \ } while(0) diff --git a/ompi/mca/pml/topo/Makefile.am b/ompi/mca/pml/topo/Makefile.am new file mode 100644 index 00000000000..602da03b8fa --- /dev/null +++ b/ompi/mca/pml/topo/Makefile.am @@ -0,0 +1,40 @@ +# +# Copyright (c) Amazon.com, Inc. or its affiliates. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +EXTRA_DIST = post_configure.sh + +if MCA_BUILD_ompi_pml_topo_DSO +component_noinst = +component_install = mca_pml_topo.la +else +component_noinst = libmca_pml_topo.la +component_install = +endif + +local_sources = \ + pml_topo.c \ + pml_topo.h \ + pml_topo_component.c \ + pml_topo_component.h + +mcacomponentdir = $(ompilibdir) +mcacomponent_LTLIBRARIES = $(component_install) +mca_pml_topo_la_SOURCES = $(local_sources) +mca_pml_topo_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ + $(pml_topo_LIBS) +mca_pml_topo_la_LDFLAGS = -module -avoid-version $(pml_topo_LDFLAGS) + +noinst_LTLIBRARIES = $(component_noinst) +libmca_pml_topo_la_SOURCES = $(local_sources) +libmca_pml_topo_la_LIBADD = $(pml_topo_LIBS) +libmca_pml_topo_la_LDFLAGS = -module -avoid-version $(pml_topo_LDFLAGS) diff --git a/ompi/mca/pml/topo/pml_topo.c b/ompi/mca/pml/topo/pml_topo.c new file mode 100644 index 00000000000..600ec4f4220 --- /dev/null +++ b/ompi/mca/pml/topo/pml_topo.c @@ -0,0 +1,208 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) Amazon.com, Inc. or its affiliates. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/communicator/communicator.h" +#include "ompi/mca/pml/base/base.h" +#include "ompi/mca/pml/base/pml_base_bsend.h" +#include "ompi/mca/pml/base/pml_base_request.h" + +#include "ompi/mca/pml/cm/pml_cm.h" +#include "ompi/mca/pml/ob1/pml_ob1.h" +#include "pml_topo.h" +#include "pml_topo_component.h" + +static int pml_topo_enable(bool enable) +{ + int ret; + + ret = ompi_pml_cm.super.pml_enable(enable); + ret = mca_pml_ob1.super.pml_enable(enable); + + return ret; +} + +static int pml_topo_add_comm(ompi_communicator_t *comm) +{ + int ret; + + ret = ompi_pml_cm.super.pml_add_comm(comm); + ret = mca_pml_ob1.super.pml_add_comm(comm); + + return ret; +} + +static int pml_topo_del_comm(ompi_communicator_t *comm) +{ + /* notify the MTL about the deleted communicator */ + int ret; + + ret = ompi_pml_cm.super.pml_del_comm(comm); + ret = mca_pml_ob1.super.pml_del_comm(comm); + + return ret; +} + +static int pml_topo_add_procs(struct ompi_proc_t **procs, size_t nprocs) +{ + int ret; + + ret = ompi_pml_cm.super.pml_add_procs(procs, nprocs); + ret = mca_pml_ob1.super.pml_add_procs(procs, nprocs); + + return ret; +} + +static int pml_topo_del_procs(struct ompi_proc_t **procs, size_t nprocs) +{ + int ret; + + ret = ompi_pml_cm.super.pml_del_procs(procs, nprocs); + ret = mca_pml_ob1.super.pml_del_procs(procs, nprocs); + + return ret; +} + +/* print any available useful information from this communicator */ +static int pml_topo_dump(struct ompi_communicator_t *comm, int verbose) +{ + return OMPI_ERR_NOT_IMPLEMENTED; +} + +static inline bool is_local_peer(struct ompi_communicator_t *comm, int peer_id) +{ + ompi_proc_t *proc = ompi_comm_peer_lookup(comm, peer_id); + if (!proc) { + return false; + } + + return OPAL_PROC_ON_LOCAL_NODE(proc->super.proc_flags); +} + +static inline mca_pml_base_module_t *get_module(struct ompi_communicator_t *comm, int peer_id) +{ + if (is_local_peer(comm, peer_id)) { + return &mca_pml_ob1.super; + } + + return &ompi_pml_cm.super; +} + +static int pml_topo_irecv_init(void *addr, size_t count, ompi_datatype_t *datatype, int src, + int tag, struct ompi_communicator_t *comm, + struct ompi_request_t **request) +{ + return get_module(comm, src)->pml_irecv_init(addr, count, datatype, src, tag, comm, request); +} + +static int pml_topo_irecv(void *addr, size_t count, ompi_datatype_t *datatype, int src, int tag, + struct ompi_communicator_t *comm, struct ompi_request_t **request) +{ + return get_module(comm, src)->pml_irecv(addr, count, datatype, src, tag, comm, request); +} + +static int pml_topo_imrecv(void *buf, size_t count, ompi_datatype_t *datatype, + struct ompi_message_t **message, struct ompi_request_t **request) +{ + return get_module((*message)->comm, (*message)->peer) + ->pml_imrecv(buf, count, datatype, message, request); +} + +static int pml_topo_mrecv(void *buf, size_t count, ompi_datatype_t *datatype, + struct ompi_message_t **message, ompi_status_public_t *status) +{ + return get_module((*message)->comm, (*message)->peer) + ->pml_mrecv(buf, count, datatype, message, status); +} + +static int pml_topo_recv(void *addr, size_t count, ompi_datatype_t *datatype, int src, int tag, + struct ompi_communicator_t *comm, ompi_status_public_t *status) +{ + return get_module(comm, src)->pml_recv(addr, count, datatype, src, tag, comm, status); +} + +static int pml_topo_isend_init(const void *buf, size_t count, ompi_datatype_t *datatype, int dst, + int tag, mca_pml_base_send_mode_t sendmode, + ompi_communicator_t *comm, ompi_request_t **request) +{ + return get_module(comm, dst)->pml_isend_init(buf, count, datatype, dst, tag, sendmode, comm, + request); +} + +static int pml_topo_isend(const void *buf, size_t count, ompi_datatype_t *datatype, int dst, + int tag, mca_pml_base_send_mode_t sendmode, ompi_communicator_t *comm, + ompi_request_t **request) +{ + return get_module(comm, dst)->pml_isend(buf, count, datatype, dst, tag, sendmode, comm, + request); +} + +static int pml_topo_send(const void *buf, size_t count, ompi_datatype_t *datatype, int dst, int tag, + mca_pml_base_send_mode_t sendmode, ompi_communicator_t *comm) +{ + return get_module(comm, dst)->pml_send(buf, count, datatype, dst, tag, sendmode, comm); +} + +static int pml_topo_iprobe(int src, int tag, struct ompi_communicator_t *comm, int *matched, + ompi_status_public_t *status) +{ + return get_module(comm, src)->pml_iprobe(src, tag, comm, matched, status); +} + +static int pml_topo_probe(int src, int tag, struct ompi_communicator_t *comm, + ompi_status_public_t *status) +{ + return get_module(comm, src)->pml_probe(src, tag, comm, status); +} + +static int pml_topo_start(size_t count, ompi_request_t **requests) +{ + /* TODO */ + return OMPI_ERR_NOT_IMPLEMENTED; +} + +static int pml_topo_improbe(int src, int tag, struct ompi_communicator_t *comm, int *matched, + struct ompi_message_t **message, ompi_status_public_t *status) +{ + return get_module(comm, src)->pml_improbe(src, tag, comm, matched, message, status); +} + +static int pml_topo_mprobe(int src, int tag, struct ompi_communicator_t *comm, + struct ompi_message_t **message, ompi_status_public_t *status) +{ + return get_module(comm, src)->pml_mprobe(src, tag, comm, message, status); +} + +ompi_pml_topo_t ompi_pml_topo = {{ + .pml_add_procs = pml_topo_add_procs, + .pml_del_procs = pml_topo_del_procs, + .pml_enable = pml_topo_enable, + .pml_progress = NULL, /* No progress function. The MTL register their own */ + .pml_add_comm = pml_topo_add_comm, + .pml_del_comm = pml_topo_del_comm, + .pml_irecv_init = pml_topo_irecv_init, + .pml_irecv = pml_topo_irecv, + .pml_recv = pml_topo_recv, + .pml_isend_init = pml_topo_isend_init, + .pml_isend = pml_topo_isend, + .pml_send = pml_topo_send, + .pml_iprobe = pml_topo_iprobe, + .pml_probe = pml_topo_probe, + .pml_start = pml_topo_start, + .pml_improbe = pml_topo_improbe, + .pml_mprobe = pml_topo_mprobe, + .pml_imrecv = pml_topo_imrecv, + .pml_mrecv = pml_topo_mrecv, + .pml_dump = pml_topo_dump, + .pml_max_contextid = 65535, + .pml_max_tag = INT_MAX, + .pml_flags = 0 /* flags */ +}}; diff --git a/ompi/mca/pml/topo/pml_topo.h b/ompi/mca/pml/topo/pml_topo.h new file mode 100644 index 00000000000..ba3d65d6bb5 --- /dev/null +++ b/ompi/mca/pml/topo/pml_topo.h @@ -0,0 +1,34 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) Amazon.com, Inc. or its affiliates. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef PML_TOPO_H +#define PML_TOPO_H + +#include "ompi_config.h" +#include "ompi/communicator/communicator.h" +#include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/pml/base/base.h" +#include "ompi/mca/pml/pml.h" +#include "ompi/request/request.h" + +#include "ompi/mca/pml/base/pml_base_recvreq.h" +#include "ompi/message/message.h" + +BEGIN_C_DECLS + +struct ompi_pml_topo_t { + mca_pml_base_module_t super; +}; +typedef struct ompi_pml_topo_t ompi_pml_topo_t; +extern ompi_pml_topo_t ompi_pml_topo; + +END_C_DECLS + +#endif /* PML_topo_H_HAS_BEEN_INCLUDED */ diff --git a/ompi/mca/pml/topo/pml_topo_component.c b/ompi/mca/pml/topo/pml_topo_component.c new file mode 100644 index 00000000000..bcebb577873 --- /dev/null +++ b/ompi/mca/pml/topo/pml_topo_component.c @@ -0,0 +1,92 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) Amazon.com, Inc. or its affiliates. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "opal/util/event.h" +#include "pml_topo.h" + +#include "ompi/mca/pml/cm/pml_cm_component.h" +#include "ompi/mca/pml/ob1/pml_ob1_component.h" +#include "pml_topo_component.h" + +static int mca_pml_topo_component_register(void); +static int mca_pml_topo_component_open(void); +static int mca_pml_topo_component_close(void); +static mca_pml_base_module_t* mca_pml_topo_component_init( int* priority, + bool enable_progress_threads, bool enable_mpi_threads); +static int mca_pml_topo_component_fini(void); + +mca_pml_base_component_2_1_0_t mca_pml_topo_component = { + /* First, the mca_base_component_t struct containing meta + * information about the component itself */ + + .pmlm_version = { + MCA_PML_BASE_VERSION_2_1_0, + + .mca_component_name = "topo", + MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, + OMPI_RELEASE_VERSION), + .mca_open_component = mca_pml_topo_component_open, + .mca_close_component = mca_pml_topo_component_close, + .mca_register_component_params = mca_pml_topo_component_register, + }, + .pmlm_data = { + /* This component is not checkpoint ready */ + MCA_BASE_METADATA_PARAM_NONE + }, + + .pmlm_init = mca_pml_topo_component_init, + .pmlm_finalize = mca_pml_topo_component_fini, +}; + +static int +mca_pml_topo_component_register(void) +{ + return OMPI_SUCCESS; +} + +static int +mca_pml_topo_component_open(void) +{ + return OMPI_SUCCESS; +} + + +static int +mca_pml_topo_component_close(void) +{ + int ret; + + ret = mca_pml_cm_component.pmlm_version.mca_close_component(); + ret = mca_pml_ob1_component.pmlm_version.mca_close_component(); + + return ret; +} + + +static mca_pml_base_module_t* +mca_pml_topo_component_init(int* priority, + bool enable_progress_threads, + bool enable_mpi_threads) +{ + *priority = 100; + + return &ompi_pml_topo.super; +} + + +static int +mca_pml_topo_component_fini(void) +{ + mca_pml_cm_component.pmlm_finalize(); + mca_pml_ob1_component.pmlm_finalize(); + return OMPI_SUCCESS; +} diff --git a/ompi/mca/pml/topo/pml_topo_component.h b/ompi/mca/pml/topo/pml_topo_component.h new file mode 100644 index 00000000000..7c11403beb3 --- /dev/null +++ b/ompi/mca/pml/topo/pml_topo_component.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) Amazon.com, Inc. or its affiliates. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +/** + * @file + */ + +#ifndef MCA_PML_TOPO_COMPONENT_H +#define MCA_PML_TOPO_COMPONENT_H + +#include "ompi/mca/pml/pml.h" + +BEGIN_C_DECLS + +/* + * PML module functions. + */ +OMPI_DECLSPEC extern mca_pml_base_component_2_1_0_t mca_pml_topo_component; + +END_C_DECLS + +#endif diff --git a/ompi/mca/pml/topo/post_configure.sh b/ompi/mca/pml/topo/post_configure.sh new file mode 100644 index 00000000000..78ac62343ab --- /dev/null +++ b/ompi/mca/pml/topo/post_configure.sh @@ -0,0 +1 @@ +DIRECT_CALL_HEADER="ompi/mca/pml/topo/pml_topo.h"