2013-09-10 15:34:09 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Mellanox Technologies, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
2015-06-23 20:59:57 -07:00
|
|
|
*
|
2013-09-10 15:34:09 +00:00
|
|
|
* Additional copyrights may follow
|
2015-06-23 20:59:57 -07:00
|
|
|
*
|
2013-09-10 15:34:09 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "oshmem_config.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "orte/util/show_help.h"
|
|
|
|
|
|
|
|
#include "opal/runtime/opal_cr.h"
|
|
|
|
#include "opal/util/output.h"
|
|
|
|
|
2015-06-23 20:59:57 -07:00
|
|
|
#include "oshmem/constants.h"
|
2013-09-10 15:34:09 +00:00
|
|
|
#include "oshmem/include/shmem.h"
|
|
|
|
#include "oshmem/runtime/params.h"
|
|
|
|
#include "oshmem/runtime/runtime.h"
|
|
|
|
#include "oshmem/shmem/shmem_api_logger.h"
|
|
|
|
|
2014-04-07 22:55:21 +00:00
|
|
|
#if OSHMEM_PROFILING
|
2014-04-22 16:49:20 +00:00
|
|
|
#include "oshmem/include/pshmem.h"
|
2014-04-07 22:55:21 +00:00
|
|
|
#pragma weak start_pes = pstart_pes
|
|
|
|
#include "oshmem/shmem/c/profile/defines.h"
|
|
|
|
#endif
|
|
|
|
|
2014-10-15 20:30:37 +03:00
|
|
|
extern int oshmem_shmem_globalexit_status;
|
2014-09-27 02:07:02 +03:00
|
|
|
|
2013-09-10 15:34:09 +00:00
|
|
|
void start_pes(int npes)
|
|
|
|
{
|
|
|
|
/* spec says that npes are ignored for now */
|
|
|
|
shmem_init();
|
|
|
|
}
|
|
|
|
|
2014-09-27 02:07:02 +03:00
|
|
|
static void shmem_onexit(int exitcode, void *arg)
|
|
|
|
{
|
2014-10-15 20:30:37 +03:00
|
|
|
oshmem_shmem_globalexit_status = exitcode;
|
2014-09-27 02:07:02 +03:00
|
|
|
}
|
|
|
|
|
2013-09-10 15:34:09 +00:00
|
|
|
void shmem_init(void)
|
|
|
|
{
|
|
|
|
int err = OSHMEM_SUCCESS;
|
|
|
|
int provided;
|
|
|
|
int required = SHMEM_THREAD_SINGLE;
|
|
|
|
|
|
|
|
if (oshmem_shmem_initialized) {
|
|
|
|
/*
|
|
|
|
* SPEC: If start_pes() is called multiple times, subsequent calls have no effect.
|
|
|
|
*/
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = oshmem_shmem_init(0, NULL, required, &provided);
|
|
|
|
if (OSHMEM_SUCCESS != err) {
|
|
|
|
/* since spec does not propagete error to user we can only abort */
|
|
|
|
SHMEM_API_ERROR("SHMEM failed to initialize - aborting");
|
|
|
|
oshmem_shmem_abort(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
OPAL_CR_INIT_LIBRARY();
|
2014-09-27 02:07:02 +03:00
|
|
|
#if HAVE_ON_EXIT
|
|
|
|
on_exit(shmem_onexit, NULL);
|
|
|
|
#endif
|
2013-09-10 15:34:09 +00:00
|
|
|
}
|
|
|
|
|