2011-10-18 00:51:22 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
|
2011-12-02 18:10:08 +04:00
|
|
|
* Copyright (c) 2011 Los Alamos National Security, LLC.
|
|
|
|
* All rights reserved.
|
2011-10-18 00:51:22 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
#include "ompi/constants.h"
|
|
|
|
|
|
|
|
|
2013-07-24 08:05:41 +04:00
|
|
|
#include "opal/mca/common/pmi/common_pmi.h"
|
|
|
|
|
2011-10-18 00:51:22 +04:00
|
|
|
#include "ompi/info/info.h"
|
2013-01-28 03:25:10 +04:00
|
|
|
#include "ompi/mca/rte/rte.h"
|
2011-10-18 00:51:22 +04:00
|
|
|
#include "ompi/mca/pubsub/base/base.h"
|
|
|
|
#include "pubsub_pmi.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Init the module
|
|
|
|
*/
|
|
|
|
static int init(void)
|
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* publish the port_name for the specified service_name.
|
|
|
|
*/
|
2013-09-27 01:56:20 +04:00
|
|
|
static int publish ( const char *service_name, ompi_info_t *info, const char *port_name )
|
2011-10-18 00:51:22 +04:00
|
|
|
{
|
2014-06-01 08:28:17 +04:00
|
|
|
return mca_common_pmi_publish(service_name,port_name);
|
2011-10-18 00:51:22 +04:00
|
|
|
}
|
|
|
|
|
2013-09-27 01:56:20 +04:00
|
|
|
static char* lookup ( const char *service_name, ompi_info_t *info )
|
2011-10-18 00:51:22 +04:00
|
|
|
{
|
|
|
|
char *port=NULL;
|
2014-06-01 08:28:17 +04:00
|
|
|
int rc = mca_common_pmi_lookup(service_name, &port);
|
|
|
|
/* in error case port will be set to NULL
|
|
|
|
* this is what our callers expect to see
|
|
|
|
* In future maybe som error handling need?
|
|
|
|
*/
|
|
|
|
if( rc != OPAL_SUCCESS ){
|
|
|
|
// improove error processing
|
|
|
|
return port; // NULL ?
|
2011-10-21 08:54:38 +04:00
|
|
|
}
|
2011-10-18 00:51:22 +04:00
|
|
|
return port;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* delete the entry */
|
2013-09-27 01:56:20 +04:00
|
|
|
static int unpublish ( const char *service_name, ompi_info_t *info )
|
2011-10-18 00:51:22 +04:00
|
|
|
{
|
2014-06-01 08:28:17 +04:00
|
|
|
return mca_common_pmi_unpublish( service_name );
|
2011-10-18 00:51:22 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* finalize the module
|
|
|
|
*/
|
|
|
|
static int finalize(void)
|
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* instantiate the module
|
|
|
|
*/
|
|
|
|
ompi_pubsub_base_module_t ompi_pubsub_pmi_module = {
|
|
|
|
init,
|
|
|
|
publish,
|
|
|
|
unpublish,
|
|
|
|
lookup,
|
|
|
|
finalize
|
|
|
|
};
|