First cut of lam_init(), lam_finalize(), and lam_abort()
This commit was SVN r407.
Этот коммит содержится в:
родитель
f933e32c1d
Коммит
bf4ae8b8a6
6
src/lam/runtime/.cvsignore
Обычный файл
6
src/lam/runtime/.cvsignore
Обычный файл
@ -0,0 +1,6 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
.deps
|
||||
.libs
|
||||
*.lo
|
||||
*.la
|
28
src/lam/runtime/Makefile.am
Обычный файл
28
src/lam/runtime/Makefile.am
Обычный файл
@ -0,0 +1,28 @@
|
||||
# -*- makefile -*-
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
include $(top_srcdir)/config/Makefile.options
|
||||
|
||||
noinst_LTLIBRARIES = libruntime.la
|
||||
|
||||
# Source code files
|
||||
|
||||
headers = \
|
||||
runtime.h
|
||||
|
||||
libruntime_la_SOURCES = \
|
||||
$(headers) \
|
||||
lam_abort.c \
|
||||
lam_init.c \
|
||||
lam_finalize.c
|
||||
|
||||
# Conditionally install the header files
|
||||
|
||||
if WANT_INSTALL_HEADERS
|
||||
lamdir = $(includedir)/lam/lam/runtime
|
||||
lam_HEADERS = $(headers)
|
||||
else
|
||||
lamdir = $(includedir)
|
||||
endif
|
24
src/lam/runtime/lam_abort.c
Обычный файл
24
src/lam/runtime/lam_abort.c
Обычный файл
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lam/constants.h"
|
||||
#include "lam/runtime/runtime.h"
|
||||
#include "lam/util/output.h"
|
||||
|
||||
|
||||
int lam_abort(int status, char *message)
|
||||
{
|
||||
if (NULL != message) {
|
||||
lam_output(0, message);
|
||||
}
|
||||
|
||||
lam_finalize();
|
||||
|
||||
exit(status);
|
||||
}
|
19
src/lam/runtime/lam_finalize.c
Обычный файл
19
src/lam/runtime/lam_finalize.c
Обычный файл
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include "lam/constants.h"
|
||||
#include "lam/runtime/runtime.h"
|
||||
#include "lam/util/output.h"
|
||||
|
||||
|
||||
int lam_finalize(void)
|
||||
{
|
||||
/* Shut down the output streams */
|
||||
|
||||
lam_output_finalize();
|
||||
|
||||
return LAM_SUCCESS;
|
||||
}
|
108
src/lam/runtime/lam_init.c
Обычный файл
108
src/lam/runtime/lam_init.c
Обычный файл
@ -0,0 +1,108 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
/** @file **/
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include "lam/constants.h"
|
||||
#include "lam/runtime/runtime.h"
|
||||
#include "lam/util/output.h"
|
||||
#include "lam/threads/mutex.h"
|
||||
|
||||
/**
|
||||
* First function that must be called in a LAM process.
|
||||
*
|
||||
* @param argc Passed in from main()
|
||||
* @param argv Passed in from main()
|
||||
*
|
||||
* @retval LAM_SUCCESS Upon success.
|
||||
* @retval LAM_ERROR Upon failure.
|
||||
*
|
||||
* This is the first function that must be called for a LAM process.
|
||||
* It sets up the following:
|
||||
*
|
||||
* - calls lam_output_init()
|
||||
* - calls lam_set_using_threads() (sets value to false)
|
||||
*
|
||||
* More will likely be filled in here in the future.
|
||||
*/
|
||||
int lam_init(int argc, char *argv[])
|
||||
{
|
||||
/* Open up the output streams */
|
||||
|
||||
if (!lam_output_init())
|
||||
return LAM_ERROR;
|
||||
|
||||
/* For the moment, the LAM library is not multi-threaded. MPI_INIT
|
||||
may reset this value later, but for now, we say that we are not
|
||||
using threads. */
|
||||
|
||||
lam_set_using_threads(false);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* BWB - this comment should be removed at some point in the very
|
||||
* near future
|
||||
*
|
||||
* JMS - will need more #include files to make this work. Not
|
||||
* filling them in at the moment. :-)
|
||||
*
|
||||
* This #if 0'ed out block of code is a rough approximation of what
|
||||
* should happen to get this parallel job bootstrapped and ready to
|
||||
* run. There are probably some bugs in the OOB and PCM interfaces
|
||||
* that are going to make this really interesting (sorry :( ), but I
|
||||
* think it should work once the MPI modules are written...
|
||||
*/
|
||||
|
||||
/* Do the "right" MCA query and init functions to fire up the
|
||||
* run-time environment interfaces. I'm not exactly sure what these
|
||||
* calls will be (since they are in the base functions, right?), but
|
||||
* do them here
|
||||
*
|
||||
* Order is:
|
||||
* 1) PCM
|
||||
* 2) OOB
|
||||
* 3) Registery
|
||||
*
|
||||
* Don't forget to close down in the reverse order at end of the day
|
||||
* - even the silly COFS implementations are going to leak resources
|
||||
* like crazy if you don't.
|
||||
*
|
||||
* The OOB system may not actually be usable until the end of
|
||||
* pcm_proc_startup, but must be initialized here.
|
||||
*/
|
||||
|
||||
/* Do the client side of the rendezvous with our launcher (or
|
||||
* whatever is needed for our RTE to figure out how to talk with our
|
||||
* peers and all that.
|
||||
*/
|
||||
ret = mca_pcm.pcm_proc_startup();
|
||||
if (ret != MPI_SUCCESS) printf("oops!\n");
|
||||
|
||||
/* at this point, we can use the OOB interface directly if we really
|
||||
need to, but is a bit tricky since we don't have a peers list
|
||||
yet. */
|
||||
mca_pcm.get_peers(&procs, &nprocs);
|
||||
|
||||
/* get a pointer to me */
|
||||
my_proc = mca_pcm.get_me();
|
||||
|
||||
/* get my parents. need to think about how to do this - i don't
|
||||
* think this is what we want at all... We can probably ignore
|
||||
* this for a little while since we don't have a run time
|
||||
* environment tha supports spawn just yet, but something to
|
||||
* remember...
|
||||
*/
|
||||
mca_pcm.get_parent(&pprocs, &npprocs);
|
||||
|
||||
/* we should have enough information by now to start running the PML
|
||||
* and PTL interfaces, right?
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* All done */
|
||||
|
||||
return LAM_SUCCESS;
|
||||
}
|
19
src/lam/runtime/runtime.h
Обычный файл
19
src/lam/runtime/runtime.h
Обычный файл
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef LAM_RUNTIME_H
|
||||
#define LAM_RUNTIME_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int lam_init(int argc, char* argv[]);
|
||||
int lam_finalize(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LAM_RUNTIME_H */
|
Загрузка…
Ссылка в новой задаче
Block a user