diff --git a/src/mca/pcm/bproc/.ompi_ignore b/src/mca/pcm/bproc/.ompi_ignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mca/pcm/bproc/Makefile.am b/src/mca/pcm/bproc/Makefile.am new file mode 100644 index 0000000000..42b2b78853 --- /dev/null +++ b/src/mca/pcm/bproc/Makefile.am @@ -0,0 +1,32 @@ +# +# $HEADER$ +# + +# Use the top-level Makefile.options + +include $(top_ompi_srcdir)/config/Makefile.options + +SUBDIRS = src + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +if OMPI_BUILD_pcm_bproc_DSO +component_noinst = +component_install = mca_pcm_bproc.la +else +component_noinst = libmca_pcm_bproc.la +component_install = +endif + +mcacomponentdir = $(libdir)/openmpi +mcacomponent_LTLIBRARIES = $(component_install) +mca_pcm_bproc_la_SOURCES = +mca_pcm_bproc_la_LIBADD = src/libmca_pcm_bproc.la +mca_pcm_bproc_la_LDFLAGS = -module -avoid-version + +noinst_LTLIBRARIES = $(component_noinst) +libmca_pcm_bproc_la_SOURCES = +libmca_pcm_bproc_la_LIBADD = src/libmca_pcm_bproc.la +libmca_pcm_bproc_la_LDFLAGS = -module -avoid-version diff --git a/src/mca/pcm/bproc/configure.params b/src/mca/pcm/bproc/configure.params new file mode 100644 index 0000000000..e52563764d --- /dev/null +++ b/src/mca/pcm/bproc/configure.params @@ -0,0 +1,10 @@ +# -*- shell-script -*- +# +# $HEADER$ +# + +# Specific to this module + +PARAM_INIT_FILE=src/pcm_bproc.c +PARAM_CONFIG_HEADER_FILE="bproc_config.h" +PARAM_CONFIG_FILES="Makefile src/Makefile" diff --git a/src/mca/pcm/bproc/configure.stub b/src/mca/pcm/bproc/configure.stub new file mode 100644 index 0000000000..c024761f17 --- /dev/null +++ b/src/mca/pcm/bproc/configure.stub @@ -0,0 +1,102 @@ +# -*- shell-script -*- +# +# $HEADER$ +# + +# +# Main function. This will be invoked in the middle of the templated +# configure script. +# +AC_DEFUN([MCA_CONFIGURE_STUB],[ +# +# Make a best effort to see if we are on a BPROC system. Also allow +# user to specify location to the bproc prefix, which will work just as +# well :). +# + +OMPI_HAVE_BPROC=0 +BPROC_LDFLAGS="" + +# +AC_ARG_WITH(bproc, + AC_HELP_STRING([--with-bproc=DIR], + [directory where the bproc software was installed])) + + +# +# Case 1: --without-bproc specified - overrides autodetect +# +if test "$with_bproc" = "no"; then + OMPI_HAVE_BPROC=0 + +# +# Case 2: --with-bproc specified - look in generic places for bproc libs +# +elif test "$with_bproc" = "yes"; then + # See if we can find the bproc libraries... + LIBS_save="$LIBS" + AC_CHECK_LIB(bproc, bproc_numnodes, + OMPI_HAVE_BPROC=1, + AC_MSG_ERROR([*** Connot find working libbproc.])) + LIBS="$LIBS_save" + +# +# Case 3: nothing specified - if it is there, go with it. If not, don't :) +# +elif test -z "$with_bproc"; then + LIBS_save="$LIBS" + AC_CHECK_LIB(bproc, bproc_numnodes, OMPI_HAVE_BPROC=1) + LIBS="$LIBS_save" + +# +# Case 4: --with-bproc= specified - try where they said to find it +# +else + BPROC_DIR=$with_bproc + + if test -n "$BPROC_DIR"; then + # Make the tests work... + OLDLDFLAGS="$LDFLAGS" + OLDCPPFLAGS="$CPPFLAGS" + BPROC_LDFLAGS="-L$BPROC_DIR/lib" + LDFLAGS="$LDFLAGS $BPROC_LDFLAGS" + CPPFLAGS="$CPPFLAGS -I$BPROC_DIR/include" + LIBS_save="$LIBS" + + AC_CHECK_LIB(bproc, bproc_numnodes, OMPI_HAVE_BPROC=1, + AC_MSG_ERROR([*** Cannot find working libbproc.])) + + # Since we are going to add the -L and -l to LIBOMPI_EXTRA_LIBS, + # we reset this to the start ... + LDFLAGS="$OLDLDFLAGS" + CPPFLAGS="$OLDCPPFLAGS" + LIBS="$LIBS_save" + + else + AC_CHECK_LIB(bproc, bproc_numnodes, OMPI_HAVE_BPROC=1, + AC_MSG_ERROR([*** Cannot find working libbproc.])) + fi +fi + +AC_MSG_CHECKING([if want BPROC support]) + +if test "$OMPI_HAVE_BPROC" = "1"; then + + AC_MSG_RESULT([yes]) +# +# Ok, we have bproc support. Add proper things to the various +# compiler flags.. +# + WRAPPER_EXTRAN_LDFLAGS="$BPROC_LDFLAGS" + WRAPPER_EXTRA_LIBS="-lbproc" +else + AC_MSG_RESULT([no]) + LAM_HAVE_BPROC3_API=0 +fi + +AC_DEFINE_UNQUOTED(OMPI_HAVE_BPROC, $OMPI_HAVE_BPROC, + [Whether we have bproc support or not]) + +# Clean up +unset BPROC_LDFLAGS +])dnl diff --git a/src/mca/pcm/bproc/src/Makefile.am b/src/mca/pcm/bproc/src/Makefile.am new file mode 100644 index 0000000000..8b31963f6d --- /dev/null +++ b/src/mca/pcm/bproc/src/Makefile.am @@ -0,0 +1,14 @@ +# +# $HEADER$ +# + +include $(top_ompi_srcdir)/config/Makefile.options + +AM_CPPFLAGS = -I$(top_ompi_builddir)/src/include \ + -I$(top_ompi_srcdir)/src -I$(top_ompi_srcdir)/src/include + +noinst_LTLIBRARIES = libmca_pcm_bproc.la +libmca_pcm_bproc_la_SOURCES = \ + pcm_bproc.c \ + pcm_bproc.h \ + pcm_bproc_component.c diff --git a/src/mca/pcm/bproc/src/pcm_bproc.c b/src/mca/pcm/bproc/src/pcm_bproc.c new file mode 100644 index 0000000000..437c294ad1 --- /dev/null +++ b/src/mca/pcm/bproc/src/pcm_bproc.c @@ -0,0 +1,61 @@ +/* -*- C -*- + * + * $HEADER$ + * + */ + +#include "ompi_config.h" + +#include "mca/pcm/pcm.h" +#include "mca/pcm/base/base.h" +#include "mca/pcm/bproc/pcm_bproc.h" +#include "class/ompi_list.h" + + +ompi_list_t * +mca_pcm_bproc_allocate_resources(struct mca_pcm_base_module_1_0_0_t* me, + mca_ns_base_jobid_t jobid, + int nodes, int procs) +{ + return NULL; +} + + +bool +mca_pcm_bproc_can_spawn(struct mca_pcm_base_module_1_0_0_t* me) +{ + return true; +} + + +int +mca_pcm_bproc_spawn_procs(struct mca_pcm_base_module_1_0_0_t* me, + mca_ns_base_jobid_t jobid, ompi_list_t *schedlist) +{ + return OMPI_SUCCESS; +} + + +int +mca_pcm_bproc_kill_proc(struct mca_pcm_base_module_1_0_0_t* me, + ompi_process_name_t *name, int flags) +{ + return OMPI_SUCCESS; +} + + +int +mca_pcm_bproc_kill_job(struct mca_pcm_base_module_1_0_0_t* me, + mca_ns_base_jobid_t jobid, int flags) +{ + return OMPI_SUCCESS; +} + + +int +mca_pcm_bproc_deallocate_resources(struct mca_pcm_base_module_1_0_0_t* me, + mca_ns_base_jobid_t jobid, + ompi_list_t *nodelist) +{ + return OMPI_SUCCESS; +} diff --git a/src/mca/pcm/bproc/src/pcm_bproc.h b/src/mca/pcm/bproc/src/pcm_bproc.h new file mode 100644 index 0000000000..1aa9e25316 --- /dev/null +++ b/src/mca/pcm/bproc/src/pcm_bproc.h @@ -0,0 +1,100 @@ +/* -*- C -*- + * + * $HEADER$ + * + * BWB: COMPONENT TODO + * + * - add process reaping code + * - trigger status change events on process death + * + */ + +#include "ompi_config.h" + +#include "mca/pcm/pcm.h" +#include "include/types.h" +#include "class/ompi_list.h" + +#include + +#ifndef MCA_PCM_RMS_H_ +#define MCA_PCM_RMS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + /* + * Module open / close + */ + int mca_pcm_rms_component_open(void); + int mca_pcm_rms_component_close(void); + + /* + * Startup / Shutdown + */ + struct mca_pcm_base_module_1_0_0_t* mca_pcm_rms_init(int *priority, + bool *allow_multi_user_threads, + bool *have_hidden_threads, + int constraints); + int mca_pcm_rms_finalize(struct mca_pcm_base_module_1_0_0_t* me); + + /* + * Interface + */ + ompi_list_t* mca_pcm_rms_allocate_resources(struct mca_pcm_base_module_1_0_0_t* me, + mca_ns_base_jobid_t jobid, + int nodes, int procs); + bool mca_pcm_rms_can_spawn(struct mca_pcm_base_module_1_0_0_t* me); + int mca_pcm_rms_spawn_procs(struct mca_pcm_base_module_1_0_0_t* me, + mca_ns_base_jobid_t jobid, ompi_list_t *schedule_list); + int mca_pcm_rms_kill_proc(struct mca_pcm_base_module_1_0_0_t* me, + ompi_process_name_t *name, int flags); + int mca_pcm_rms_kill_job(struct mca_pcm_base_module_1_0_0_t* me, + mca_ns_base_jobid_t jobid, int flags); + int mca_pcm_rms_deallocate_resources(struct mca_pcm_base_module_1_0_0_t* me, + mca_ns_base_jobid_t jobid, + ompi_list_t *nodelist); + + /* + * Job management code + */ + void mca_pcm_rms_job_list_init(void); + void mca_pcm_rms_job_list_fini(void); + + int mca_pcm_rms_add_started_pids(mca_ns_base_jobid_t jobid, pid_t child_pid, + mca_ns_base_vpid_t lower, mca_ns_base_vpid_t upper); + pid_t mca_pcm_rms_get_started_pid(mca_ns_base_jobid_t jobid, mca_ns_base_vpid_t vpid, + bool remove_started_pid); + int mca_pcm_rms_get_started_pid_list(mca_ns_base_jobid_t jobid, pid_t **pids, size_t *len, + bool remove_started_pids); + int mca_pcm_rms_remove_job(mca_ns_base_jobid_t jobid); + + struct mca_pcm_rms_pids_t { + ompi_list_item_t super; + mca_ns_base_vpid_t lower; + mca_ns_base_vpid_t upper; + pid_t child; + }; + typedef struct mca_pcm_rms_pids_t mca_pcm_rms_pids_t; + OBJ_CLASS_DECLARATION(mca_pcm_rms_pids_t); + + struct mca_pcm_rms_job_item_t { + ompi_list_item_t super; + mca_ns_base_jobid_t jobid; + ompi_list_t *pids; + }; + typedef struct mca_pcm_rms_job_item_t mca_pcm_rms_job_item_t; + OBJ_CLASS_DECLARATION(mca_pcm_rms_job_item_t); + +#ifdef __cplusplus +} +#endif + +/* + * Module variables + */ +extern int mca_pcm_rms_output; +extern int mca_pcm_rms_use_ns; + +#endif /* MCA_PCM_RMS_H_ */ diff --git a/src/mca/pcm/bproc/src/pcm_bproc_component.c b/src/mca/pcm/bproc/src/pcm_bproc_component.c new file mode 100644 index 0000000000..a3708922d6 --- /dev/null +++ b/src/mca/pcm/bproc/src/pcm_bproc_component.c @@ -0,0 +1,132 @@ +/* -*- C -*- + * + * $HEADER$ + * + */ + +#include "ompi_config.h" + +#include "include/constants.h" +#include "include/types.h" +#include "class/ompi_list.h" +#include "mca/mca.h" +#include "mca/base/mca_base_param.h" +#include "mca/pcm/pcm.h" +#include "mca/pcm/base/base.h" +#include "mca/pcm/rms/pcm_rms.h" +#include "mca/llm/base/base.h" + +#include +#include +#include +#include + +/* + * Struct of function pointers and all that to let us be initialized + */ +mca_pcm_base_component_1_0_0_t mca_pcm_bproc_component = { + { + MCA_PCM_BASE_VERSION_1_0_0, + + "bproc", /* MCA component name */ + 1, /* MCA component major version */ + 0, /* MCA component minor version */ + 0, /* MCA component release version */ + mca_pcm_bproc_component_open, /* component open */ + mca_pcm_bproc_component_close /* component close */ + }, + { + false /* checkpoint / restart */ + }, + mca_pcm_bproc_init, /* component init */ + NULL /* unique name */ +}; + + +struct mca_pcm_base_module_1_0_0_t mca_pcm_bproc_1_0_0 = { + mca_pcm_bproc_allocate_resources, + mca_pcm_bproc_can_spawn, + mca_pcm_bproc_spawn_procs, + mca_pcm_bproc_kill_proc, + mca_pcm_bproc_kill_job, + mca_pcm_bproc_deallocate_resources, + mca_pcm_bproc_finalize +}; + + +/* need to create output stream to dump in file */ +ompi_output_stream_t mca_pcm_bproc_output_stream = { + false, /* lds_is_debugging BWB - change me for release */ + 0, /* lds_verbose_level */ + false, /* lds_want_syslog */ + 0, /* lds_syslog_priority */ + NULL, /* lds_syslog_ident */ + "pcm: bproc: ", /* lds_prefix */ + true, /* lds_want_stdout */ + false, /* lds_want_stderr */ + true, /* lds_want_file */ + true, /* lds_want_file_append */ + "pcm_bproc" /* lds_file_suffix */ +}; + + +/* + * Module variables handles + */ +static int mca_pcm_bproc_param_priority; +static int mca_pcm_bproc_param_debug; + +/* + * Component variables. All of these are shared among the module + * instances, so they don't need to go in a special structure or + * anything. + */ +int mca_pcm_bproc_output = 0; + +int +mca_pcm_bproc_component_open(void) +{ + mca_pcm_bproc_param_debug = + mca_base_param_register_int("pcm", "bproc", "debug", NULL, 100); + + mca_pcm_bproc_param_priority = + mca_base_param_register_int("pcm", "bproc", "priority", NULL, 5); + + return OMPI_SUCCESS; +} + + +int +mca_pcm_bproc_component_close(void) +{ + return OMPI_SUCCESS; +} + + +mca_pcm_base_module_t* +mca_pcm_bproc_init(int *priority, + bool *allow_multi_user_threads, + bool *have_hidden_threads, + int constraints) +{ + int debug; + + mca_base_param_lookup_int(mca_pcm_bproc_param_debug, &debug); + mca_pcm_bproc_output = ompi_output_open(&mca_pcm_bproc_output_stream); + ompi_output_set_verbosity(mca_pcm_bproc_output, debug); + + mca_base_param_lookup_int(mca_pcm_bproc_param_priority, priority); + + *allow_multi_user_threads = true; + *have_hidden_threads = false; + + return NULL; +} + + +int +mca_pcm_bproc_finalize(struct mca_pcm_base_module_1_0_0_t* me) +{ + return OMPI_SUCCESS; +} +