Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ompi/dpm/dpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ static int construct_peers(ompi_group_t *group, opal_list_t *peers)
} else {
proc_name = proct->super.proc_name;
}

/* add to the list of peers */
nm = OBJ_NEW(opal_namelist_t);
nm->name = proc_name;
Expand Down Expand Up @@ -1203,7 +1203,7 @@ static bool ompi_dpm_group_is_dyn (ompi_group_t *group, ompi_jobid_t thisjobid)
{
int size = group ? ompi_group_size (group) : 0;

for (int i = 1 ; i < size ; ++i) {
for (int i = 0 ; i < size ; ++i) {
opal_process_name_t name = ompi_group_get_proc_name (group, i);

if (thisjobid != ((ompi_process_name_t *) &name)->jobid) {
Expand Down
1 change: 1 addition & 0 deletions opal/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ nobase_opal_HEADERS = $(headers)
endif

include class/Makefile.am
include errhandler/Makefile.am
include memoryhooks/Makefile.am
include runtime/Makefile.am
include threads/Makefile.am
Expand Down
17 changes: 17 additions & 0 deletions opal/errhandler/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- makefile -*-
#
# Copyright (c) 2015 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#

# This makefile.am does not stand on its own - it is included from opal/Makefile.am

headers += \
errhandler/opal_errhandler.h

lib@OPAL_LIB_PREFIX@open_pal_la_SOURCES += \
errhandler/opal_errhandler.c
34 changes: 34 additions & 0 deletions opal/errhandler/opal_errhandler.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/

#include "opal_config.h"

#include "opal/errhandler/opal_errhandler.h"

opal_errhandler_fn_t errhandler = NULL;
void *cbdata = NULL;

void opal_register_errhandler(opal_errhandler_fn_t newerr, void *cbd)
{
errhandler = newerr;
cbdata = cbd;
}

void opal_deregister_errhandler(void)
{
errhandler = NULL;
cbdata = NULL;
}

void opal_invoke_errhandler(int status, opal_proc_t *proc)
{
if (NULL != errhandler) {
errhandler(status, proc, cbdata);
}
}
25 changes: 25 additions & 0 deletions opal/errhandler/opal_errhandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/

#ifndef OPAL_ERRHANDLER_H
#define OPAL_ERRHANDLER_H

#include "opal_config.h"

#include "opal/util/proc.h"

typedef void (*opal_errhandler_fn_t)(int status, opal_proc_t *proc, void *cbdata);

OPAL_DECLSPEC void opal_register_errhandler(opal_errhandler_fn_t errhandler, void *cbdata);

OPAL_DECLSPEC void opal_deregister_errhandler(void);

OPAL_DECLSPEC void opal_invoke_errhandler(int status, opal_proc_t *proc);

#endif
12 changes: 9 additions & 3 deletions opal/mca/pmix/base/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,17 @@ OPAL_DECLSPEC int opal_pmix_base_select(void);

OPAL_DECLSPEC extern bool opal_pmix_base_allow_delayed_server;

OPAL_DECLSPEC void opal_pmix_base_register_handler(opal_pmix_errhandler_fn_t err);
OPAL_DECLSPEC void opal_pmix_base_deregister_handler(void);
OPAL_DECLSPEC void opal_pmix_base_register_handler(opal_list_t *info,
opal_pmix_notification_fn_t errhandler,
opal_pmix_errhandler_reg_cbfunc_t cbfunc,
void *cbdata);
OPAL_DECLSPEC void opal_pmix_base_deregister_handler(int errhandler,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata);
OPAL_DECLSPEC void opal_pmix_base_errhandler(int status,
opal_list_t *procs,
opal_list_t *info);
opal_list_t *info,
opal_pmix_release_cbfunc_t cbfunc, void *cbdata);
OPAL_DECLSPEC int opal_pmix_base_exchange(opal_value_t *info,
opal_pmix_pdata_t *pdat,
int timeout);
Expand Down
28 changes: 21 additions & 7 deletions opal/mca/pmix/base/pmix_base_fns.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,40 @@

#define OPAL_PMI_PAD 10

/******** ERRHANDLER SUPPORT ********/
static opal_pmix_errhandler_fn_t errhandler = NULL;

void opal_pmix_base_register_handler(opal_pmix_errhandler_fn_t err)
/******** ERRHANDLER SUPPORT FOR COMPONENTS THAT
******** DO NOT NATIVELY SUPPORT IT
********/
static opal_pmix_notification_fn_t errhandler = NULL;

void opal_pmix_base_register_handler(opal_list_t *info,
opal_pmix_notification_fn_t err,
opal_pmix_errhandler_reg_cbfunc_t cbfunc,
void *cbdata)
{
errhandler = err;
if (NULL != cbfunc) {
cbfunc(OPAL_SUCCESS, 0, cbdata);
}
}

void opal_pmix_base_errhandler(int status,
opal_list_t *procs,
opal_list_t *info)
opal_list_t *info,
opal_pmix_release_cbfunc_t cbfunc, void *cbdata)
{
if (NULL != errhandler) {
errhandler(status);
errhandler(status, procs, info, cbfunc, cbdata);
}
}

void opal_pmix_base_deregister_handler(void)
void opal_pmix_base_deregister_handler(int errid,
opal_pmix_op_cbfunc_t cbfunc,
void *cbdata)
{
errhandler = NULL;
if (NULL != cbfunc) {
cbfunc(OPAL_SUCCESS, cbdata);
}
}

struct lookup_caddy_t {
Expand Down
6 changes: 2 additions & 4 deletions opal/mca/pmix/external/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,5 @@ noinst_LTLIBRARIES = $(component_noinst)
libmca_pmix_external_la_SOURCES =$(sources)
libmca_pmix_external_la_CFLAGS =
libmca_pmix_external_la_CPPFLAGS = $(opal_pmix_ext_CPPFLAGS)
libmca_pmix_external_la_LDFLAGS = -module -avoid-version -L$(opal_pmix_ext_LDFLAGS)
libmca_pmix_external_la_LIBADD = $(opal_pmix_ext_LIBS) \
$(OPAL_TOP_BUILDDIR)/opal/mca/event/lib@OPAL_LIB_PREFIX@mca_event.la \
$(OPAL_TOP_BUILDDIR)/opal/mca/hwloc/lib@OPAL_LIB_PREFIX@mca_hwloc.la
libmca_pmix_external_la_LDFLAGS = -module -avoid-version $(opal_pmix_ext_LDFLAGS)
libmca_pmix_external_la_LIBADD = $(opal_pmix_ext_LIBS)
19 changes: 17 additions & 2 deletions opal/mca/pmix/external/pmix_ext_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ static pmix_proc_t my_proc;
static char *dbgvalue=NULL;
static int errhdler_ref = 0;

static void completion_handler (void * cbdata) {
int * cond = (int *)cbdata;
*cond = 0;
}

#define PMIX_WAIT_FOR_COMPLETION(a) \
do { \
while ((a)) { \
usleep(10); \
} \
} while (0);

static void myerr(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo)
Expand All @@ -45,6 +57,7 @@ static void myerr(pmix_status_t status,
opal_namelist_t *nm;
opal_value_t *iptr;
size_t n;
volatile int cond = 1;

/* convert the incoming status */
rc = pmix1_convert_rc(status);
Expand All @@ -64,11 +77,13 @@ static void myerr(pmix_status_t status,
iptr = OBJ_NEW(opal_value_t);
iptr->key = strdup(info[n].key);
pmix1_value_unload(iptr, &info[n].value);
opal_list_append(&plist, &nm->super);
opal_list_append(&plist, &iptr->super);
}

/* call the base errhandler */
opal_pmix_base_errhandler(rc, &plist, &ilist);
opal_pmix_base_errhandler(rc, &plist, &ilist, completion_handler, (void *)&cond);
PMIX_WAIT_FOR_COMPLETION(cond);

OPAL_LIST_DESTRUCT(&plist);
OPAL_LIST_DESTRUCT(&ilist);
}
Expand Down
19 changes: 17 additions & 2 deletions opal/mca/pmix/external/pmix_ext_server_south.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ extern opal_pmix_server_module_t *host_module;
static char *dbgvalue=NULL;
static int errhdler_ref = 0;

static void completion_handler (void * cbdata) {
int * cond = (int *)cbdata;
*cond = 0;
}

#define PMIX_WAIT_FOR_COMPLETION(a) \
do { \
while ((a)) { \
usleep(10); \
} \
} while (0);

static void myerr(pmix_status_t status,
pmix_proc_t procs[], size_t nprocs,
pmix_info_t info[], size_t ninfo)
Expand All @@ -58,6 +70,7 @@ static void myerr(pmix_status_t status,
opal_list_t plist, ilist;
opal_namelist_t *nm;
opal_value_t *iptr;
volatile int cond = 1;
size_t n;

/* convert the incoming status */
Expand All @@ -78,11 +91,13 @@ static void myerr(pmix_status_t status,
iptr = OBJ_NEW(opal_value_t);
iptr->key = strdup(info[n].key);
pmix1_value_unload(iptr, &info[n].value);
opal_list_append(&plist, &nm->super);
opal_list_append(&plist, &iptr->super);
}

/* call the base errhandler */
opal_pmix_base_errhandler(rc, &plist, &ilist);
opal_pmix_base_errhandler(rc, &plist, &ilist, completion_handler, (void *)&cond);
PMIX_WAIT_FOR_COMPLETION(cond);

OPAL_LIST_DESTRUCT(&plist);
OPAL_LIST_DESTRUCT(&ilist);
}
Expand Down
Loading