add globalexit API support.
it is not fully functional yet, but initial version is good enough. developed by Igor, reviewed by miked This commit was SVN r29430.
Этот коммит содержится в:
родитель
2141e9e6b4
Коммит
14304c299d
@ -141,6 +141,21 @@ esac
|
|||||||
|
|
||||||
AC_SUBST([OSHMEM_CFLAGS])
|
AC_SUBST([OSHMEM_CFLAGS])
|
||||||
|
|
||||||
|
OPAL_CHECK_PMI([pmi_oshmem], [pmi_oshmem_happy="yes"], [pmi_oshmem_happy="no"])
|
||||||
|
|
||||||
|
AC_SUBST([pmi_oshmem_CPPFLAGS])
|
||||||
|
AC_SUBST([pmi_oshmem_LDFLAGS])
|
||||||
|
AC_SUBST([pmi_oshmem_LIBS])
|
||||||
|
|
||||||
|
AS_IF(
|
||||||
|
[test "$pmi_oshmem_happy" = "yes"],
|
||||||
|
[
|
||||||
|
OSHMEM_CFLAGS="$OSHMEM_CFLAGS $pmi_oshmem_CPPFLAGS"
|
||||||
|
OSHMEM_LDFLAGS="$OSHMEM_LDFLAGS $pmi_oshmem_LDFLAGS $pmi_oshmem_LIBS"
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_SUBST([OSHMEM_CFLAGS])
|
||||||
|
AC_SUBST([OSHMEM_LDFLAGS])
|
||||||
|
|
||||||
|
|
||||||
OMPI_CHECK_OPENFABRICS([oshmem_verbs],
|
OMPI_CHECK_OPENFABRICS([oshmem_verbs],
|
||||||
|
@ -380,6 +380,7 @@ OSHMEM_DECLSPEC int shmem_my_pe(void);
|
|||||||
|
|
||||||
OSHMEM_DECLSPEC void shmem_put(void *target, const void *source, size_t len, int pe);
|
OSHMEM_DECLSPEC void shmem_put(void *target, const void *source, size_t len, int pe);
|
||||||
OSHMEM_DECLSPEC void shmem_get(void *target, const void *source, size_t len, int pe);
|
OSHMEM_DECLSPEC void shmem_get(void *target, const void *source, size_t len, int pe);
|
||||||
|
OSHMEM_DECLSPEC void globalexit(int status);
|
||||||
|
|
||||||
|
|
||||||
#if defined(c_plusplus) || defined(__cplusplus)
|
#if defined(c_plusplus) || defined(__cplusplus)
|
||||||
|
@ -196,6 +196,21 @@ static void* shmem_opal_thread(void* argc)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int inGlobalExit;
|
||||||
|
|
||||||
|
static void sighandler__SIGUSR1(int signum)
|
||||||
|
{
|
||||||
|
if (0 != inGlobalExit)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_exit(0);
|
||||||
|
}
|
||||||
|
static void sighandler__SIGTERM(int signum)
|
||||||
|
{
|
||||||
|
/* Do nothing. Just replace other unpredictalbe handlers with this one (e.g. mxm handler). */
|
||||||
|
}
|
||||||
|
|
||||||
int oshmem_shmem_init(int argc, char **argv, int requested, int *provided)
|
int oshmem_shmem_init(int argc, char **argv, int requested, int *provided)
|
||||||
{
|
{
|
||||||
int ret = OSHMEM_SUCCESS;
|
int ret = OSHMEM_SUCCESS;
|
||||||
@ -225,7 +240,10 @@ int oshmem_shmem_init(int argc, char **argv, int requested, int *provided)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef SIGUSR1
|
||||||
|
signal(SIGUSR1,sighandler__SIGUSR1);
|
||||||
|
signal(SIGTERM,sighandler__SIGTERM);
|
||||||
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,8 @@ SHMEM_API_SOURCES = \
|
|||||||
shmem_clear_lock.c \
|
shmem_clear_lock.c \
|
||||||
shmem_set_lock.c \
|
shmem_set_lock.c \
|
||||||
shmem_test_lock.c \
|
shmem_test_lock.c \
|
||||||
shmem_lock.c
|
shmem_lock.c \
|
||||||
|
globalexit.c
|
||||||
|
|
||||||
|
|
||||||
AM_CFLAGS = $(OSHMEM_CFLAGS)
|
AM_CFLAGS = $(OSHMEM_CFLAGS)
|
||||||
|
45
oshmem/shmem/c/globalexit.c
Обычный файл
45
oshmem/shmem/c/globalexit.c
Обычный файл
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2012 Mellanox Technologies, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
* $COPYRIGHT$
|
||||||
|
*
|
||||||
|
* Additional copyrights may follow
|
||||||
|
*
|
||||||
|
* $HEADER$
|
||||||
|
*/
|
||||||
|
#include "oshmem_config.h"
|
||||||
|
|
||||||
|
#include "oshmem/include/shmem.h"
|
||||||
|
#include "oshmem/runtime/runtime.h"
|
||||||
|
|
||||||
|
#include "orte/mca/odls/odls_types.h"
|
||||||
|
#include "orte/mca/errmgr/errmgr.h"
|
||||||
|
#include "opal/dss/dss.h"
|
||||||
|
#include "orte/mca/rml/rml.h"
|
||||||
|
|
||||||
|
#if WANT_PMI_SUPPORT
|
||||||
|
#include <pmi.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern int inGlobalExit;
|
||||||
|
|
||||||
|
void globalexit(int status)
|
||||||
|
{
|
||||||
|
inGlobalExit++;
|
||||||
|
|
||||||
|
if ((ORTE_JOBID_INVALID != ORTE_PROC_MY_DAEMON->jobid) &&
|
||||||
|
(0 != ORTE_PROC_MY_DAEMON->jobid) )
|
||||||
|
{
|
||||||
|
orte_errmgr.abort(status, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if WANT_PMI_SUPPORT
|
||||||
|
PMI_Abort(status, NULL);
|
||||||
|
#endif /* WANT_PMI_SUPPORT */
|
||||||
|
_exit(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
oshmem_shmem_aborted = true;
|
||||||
|
exit(status);
|
||||||
|
}
|
Загрузка…
x
Ссылка в новой задаче
Block a user