diff --git a/src/mca/lam/pcm/cofs/.cvsignore b/src/mca/lam/pcm/cofs/.cvsignore new file mode 100644 index 0000000000..4f7712fb02 --- /dev/null +++ b/src/mca/lam/pcm/cofs/.cvsignore @@ -0,0 +1,14 @@ +Makefile +Makefile.in +acinclude.m4 +aclocal.m4 +configure +configure.ac +config.log +config.status +libtool +autom4te.cache +.libs +.deps +*.la +.lam* diff --git a/src/mca/lam/pcm/cofs/Makefile.am b/src/mca/lam/pcm/cofs/Makefile.am new file mode 100644 index 0000000000..e3d18ffedc --- /dev/null +++ b/src/mca/lam/pcm/cofs/Makefile.am @@ -0,0 +1,38 @@ +# -*- makefile -*- +# +# $HEADER$ +# + +# Use the top-level LAM Makefile.options + +include $(top_lam_srcdir)/config/Makefile.options + +SUBDIRS = src +DIST_SUBDIRS = config $(SUBDIRS) + +EXTRA_DIST = VERSION + +# According to the MCA spec, we have to make the output library here +# in the top-level directory, and it has to be named +# liblam_ssi_coll_lam_basic.la + +if LAM_BUILD_LOADABLE_MODULE +module_noinst = +module_install = mca_pcm_cofs.la +else +module_noinst = libmca_lam_pcm_cofs.la +module_install = +endif + +lamssiexecdir = $(libdir)/lam +lamssiexec_LTLIBRARIES = $(module_install) +mca_pcm_cofs_la_SOURCES = +mca_pcm_cofs_la_LIBADD = \ + src/libmca_pcm_cofs.la \ + $(top_lam_builddir)/src/lam/liblam.la +mca_pcm_cofs_la_LDFLAGS = -module -avoid-version + +noinst_LTLIBRARIES = $(module_noinst) +libmca_lam_pcm_cofs_la_SOURCES = +libmca_lam_pcm_cofs_la_LIBADD = src/libmca_pcm_cofs.la +libmca_lam_pcm_cofs_la_LDFLAGS = -module -avoid-version diff --git a/src/mca/lam/pcm/cofs/VERSION b/src/mca/lam/pcm/cofs/VERSION new file mode 100644 index 0000000000..54f912ce99 --- /dev/null +++ b/src/mca/lam/pcm/cofs/VERSION @@ -0,0 +1,6 @@ +major=1 +minor=0 +release=0 +alpha=0 +beta=0 +cvs=1 diff --git a/src/mca/lam/pcm/cofs/config/.cvsignore b/src/mca/lam/pcm/cofs/config/.cvsignore new file mode 100644 index 0000000000..9503f6b47c --- /dev/null +++ b/src/mca/lam/pcm/cofs/config/.cvsignore @@ -0,0 +1,9 @@ +config.guess +config.sub +depcomp +install-sh +ltmain.sh +Makefile +Makefile.in +missing +mkinstalldirs diff --git a/src/mca/lam/pcm/cofs/config/Makefile.am b/src/mca/lam/pcm/cofs/config/Makefile.am new file mode 100644 index 0000000000..270f85be02 --- /dev/null +++ b/src/mca/lam/pcm/cofs/config/Makefile.am @@ -0,0 +1,15 @@ +# -*- makefile -*- +# +# $HEADER$ +# + +include $(top_lam_srcdir)/config/Makefile.options + +# This file is only here so that "make dist" grabs all the extra +# config-level files that are necessary to build a LAM distribution +# tarball. Nothing gets built in this directory. + +# Seems to be an automake bug -- depcomp is not automatically included +# in distribution tarballs. + +EXTRA_DIST = depcomp diff --git a/src/mca/lam/pcm/cofs/configure.params b/src/mca/lam/pcm/cofs/configure.params new file mode 100644 index 0000000000..d272df0589 --- /dev/null +++ b/src/mca/lam/pcm/cofs/configure.params @@ -0,0 +1,9 @@ +# -*- shell-script -*- +# +# $HEADER$ +# + +# Specific to this module + +PARAM_INIT_FILE=src/pcm_cofs.c +PARAM_CONFIG_FILES="Makefile config/Makefile src/Makefile" diff --git a/src/mca/lam/pcm/cofs/src/.cvsignore b/src/mca/lam/pcm/cofs/src/.cvsignore new file mode 100644 index 0000000000..f1d83e11bc --- /dev/null +++ b/src/mca/lam/pcm/cofs/src/.cvsignore @@ -0,0 +1,9 @@ +.deps +.libs +Makefile +Makefile.in +*.lo +libmca_pcm_cofs.la +pcm_cofs_config.h +pcm_cofs_config.h.in +stamp-h1 diff --git a/src/mca/lam/pcm/cofs/src/Makefile.am b/src/mca/lam/pcm/cofs/src/Makefile.am new file mode 100644 index 0000000000..2f84095a7a --- /dev/null +++ b/src/mca/lam/pcm/cofs/src/Makefile.am @@ -0,0 +1,17 @@ +# +# $HEADER$ +# + +include $(top_lam_srcdir)/config/Makefile.options + +AM_CPPFLAGS = \ + -I$(top_lam_builddir)/src/include \ + -I$(top_lam_srcdir)/src \ + -I$(top_lam_srcdir)/src/include + +noinst_LTLIBRARIES = libmca_pcm_cofs.la +libmca_pcm_cofs_la_SOURCES = \ + pcm_cofs.h \ + pcm_cofs_module.c \ + pcm_cofs.c + diff --git a/src/mca/lam/pcm/cofs/src/pcm_cofs.c b/src/mca/lam/pcm/cofs/src/pcm_cofs.c new file mode 100644 index 0000000000..c13af85472 --- /dev/null +++ b/src/mca/lam/pcm/cofs/src/pcm_cofs.c @@ -0,0 +1,18 @@ +/* -*- C -*- + * + * $HEADER$ + * + */ + +#include "lam_config.h" + +#include "mca/lam/pcm/pcm.h" +#include "mca/lam/pcm/cofs/src/pcm_cofs.h" +#include "lam/util/malloc.h" +#include "lam/types.h" + +#include +#include +#include +#include +#include diff --git a/src/mca/lam/pcm/cofs/src/pcm_cofs.h b/src/mca/lam/pcm/cofs/src/pcm_cofs.h new file mode 100644 index 0000000000..a05cef7125 --- /dev/null +++ b/src/mca/lam/pcm/cofs/src/pcm_cofs.h @@ -0,0 +1,53 @@ +/* -*- C -*- + * + * $HEADER$ + * + */ +#include "lam_config.h" + +#include "mca/lam/pcm/pcm.h" +#include "lam/types.h" + +/* + * Module open / close + */ +int mca_pcm_cofs_open(lam_cmd_line_t *cmd); +int mca_pcm_cofs_close(void); + +/* + * Startup / Shutdown + */ +int mca_pcm_cofs_query(int *priority); +struct mca_pcm_1_0_0_t* mca_pcm_cofs_init(void); +int mca_pcm_cofs_finalize(void); + +int mca_pcm_cofs_query_get_nodes(lam_pcm_node_t **nodes, size_t *nodes_len, + int available_procs); + +lam_job_handle_t mca_pcm_cofs_handle_new(lam_job_handle_t parent); +lam_job_handle_t mca_pcm_cofs_handle_get(void); +void mca_pcm_cofs_handle_free(lam_job_handle_t *job_handle); + +int mca_pcm_cofs_job_can_spawn(lam_job_handle_t job_handle); +int mca_pcm_cofs_job_set_arguments(lam_job_handle_t job_handle, + lam_pcm_control_args_t* opts, + size_t opts_len); +int mca_pcm_cofs_job_launch_procs(lam_job_handle_t job_handle, + lam_pcm_node_t *nodes, + size_t nodes_len, const char* file, + int argc, const char* argv[], + const char *env[]); +int mca_pcm_cofs_job_rendezvous(lam_job_handle_t job_handle); +int mca_pcm_cofs_job_wait(lam_job_handle_t job_handle); +int mca_pcm_cofs_job_running(lam_job_handle_t job_handle, + int* running); +int mca_pcm_cofs_job_list_running(lam_job_handle_t **handles, + size_t handles_len); + +int mca_pcm_cofs_proc_startup(void); +int mca_pcm_cofs_proc_get_peers(void); +int mca_pcm_cofs_proc_get_me(void); +int mca_pcm_cofs_proc_get_parent(void); + +extern char mca_pcm_cofs_comm_loc[LAM_PATH_MAX]; /* location for file drop-off */ +extern int mca_pcm_cofs_my_vpid; diff --git a/src/mca/lam/pcm/cofs/src/pcm_cofs_module.c b/src/mca/lam/pcm/cofs/src/pcm_cofs_module.c new file mode 100644 index 0000000000..f62992c08b --- /dev/null +++ b/src/mca/lam/pcm/cofs/src/pcm_cofs_module.c @@ -0,0 +1,147 @@ +/* -*- C -*- + * + * $HEADER$ + * + */ + +#include "lam_config.h" + +#include "lam/constants.h" +#include "mca/mca.h" +#include "mca/lam/pcm/pcm.h" +#include "mca/lam/pcm/cofs/src/pcm_cofs.h" +#include "lam/types.h" + +#include +#include +#include +#include + +/* + * Struct of function pointers and all that to let us be initialized + */ +mca_pcm_base_module_1_0_0_t mca_pcm_cofs_module = { + { + MCA_PCM_BASE_VERSION_1_0_0, + + "cofs", /* MCA module name */ + 1, /* MCA module major version */ + 0, /* MCA module minor version */ + 0, /* MCA module release version */ + mca_pcm_cofs_open, /* module open */ + mca_pcm_cofs_close /* module close */ + }, + { + false /* checkpoint / restart */ + }, + mca_pcm_cofs_query, /* module query */ + mca_pcm_cofs_init, /* module init */ + mca_pcm_cofs_finalize +}; + + +struct mca_pcm_1_0_0_t mca_pcm_cofs_1_0_0 = { + mca_pcm_cofs_query_get_nodes, + + mca_pcm_cofs_handle_new, + mca_pcm_cofs_handle_get, + mca_pcm_cofs_handle_free, + + mca_pcm_cofs_job_can_spawn, + mca_pcm_cofs_job_set_arguments, + mca_pcm_cofs_job_launch_procs, + mca_pcm_cofs_job_rendezvous, + mca_pcm_cofs_job_wait, + mca_pcm_cofs_job_running, + mca_pcm_cofs_job_list_running, + + mca_pcm_cofs_proc_startup, + mca_pcm_cofs_proc_get_peers, + mca_pcm_cofs_proc_get_me, + mca_pcm_cofs_proc_get_parent +}; + + +char mca_pcm_cofs_comm_loc[LAM_PATH_MAX]; +int mca_pcm_cofs_my_vpid; + +int +mca_pcm_cofs_open(lam_cmd_line_t *cmd) +{ + return LAM_SUCCESS; +} + + +int +mca_pcm_cofs_close(void) +{ + return LAM_SUCCESS; +} + + +int +mca_pcm_cofs_query(int *priority) +{ + *priority = 0; + return LAM_SUCCESS; +} + + +struct mca_pcm_1_0_0_t* +mca_pcm_cofs_init(void) +{ + char *tmp; + FILE *fp; + + /* + * BWB - fix me, make register the "right" way... + */ + tmp = getenv("MCA_common_lam_cofs_comm_dir"); + if (tmp == NULL) { + /* make it $HOME */ + tmp = getenv("HOME"); + if (tmp == NULL) { + printf("pcm_cofs can not find communication dir\n"); + return NULL; + } + snprintf(mca_pcm_cofs_comm_loc, LAM_PATH_MAX, "%s/cofs", tmp); + } else { + snprintf(mca_pcm_cofs_comm_loc, LAM_PATH_MAX, "%s", tmp); + } + + /* + * See if we can write in our directory... + */ + tmp = malloc(strlen(mca_pcm_cofs_comm_loc) + 5); + if (tmp == NULL) return NULL; + sprintf(tmp, "%s/me", mca_pcm_cofs_comm_loc); + fp = fopen(tmp, "w"); + if (fp == NULL) { + printf("pcm_cofs can not write in communication dir\n"); + free(tmp); + return NULL; + } + fclose(fp); + unlink(tmp); + free(tmp); + + /* + * BWB - fix me, make register the "right" way... + */ + /* find our vpid */ + tmp = getenv("MCA_PCM_BASE_VPID"); + if (tmp == NULL) { + printf("pcm_cofs can not find vpid\n"); + return NULL; + } + mca_pcm_cofs_my_vpid = atoi(tmp); + + return &mca_pcm_cofs_1_0_0; +} + + +int +mca_pcm_cofs_finalize(void) +{ + return LAM_SUCCESS; +} diff --git a/src/mca/lam/pcm/pcm.h b/src/mca/lam/pcm/pcm.h index 38cd278d2b..043cd855b2 100644 --- a/src/mca/lam/pcm/pcm.h +++ b/src/mca/lam/pcm/pcm.h @@ -79,8 +79,8 @@ typedef struct lam_pcm_control_args { * functions every module must provide */ -typedef int (*mca_pcm_query_fn_t)(int *priority); -typedef struct mca_pcm_1_0_0* (*mca_pcm_init_fn_t)(void); +typedef int (*mca_pcm_base_query_fn_t)(int *priority); +typedef struct mca_pcm_1_0_0_t* (*mca_pcm_base_init_fn_t)(void); /** * \func lam_pcm_query_get_nodes @@ -104,8 +104,9 @@ typedef struct mca_pcm_1_0_0* (*mca_pcm_init_fn_t)(void); * In the case where both are available, available_procs will be * equal to the sum of nodes[0...n].num_procs. */ -typedef int (*mca_pcm_query_get_nodes)(lam_pcm_node_t **nodes, size_t *nodes_len, - int available_procs); +typedef int (*mca_pcm_base_query_get_nodes_fn_t)(lam_pcm_node_t **nodes, + size_t *nodes_len, + int available_procs); /** @@ -127,7 +128,7 @@ typedef int (*mca_pcm_query_get_nodes)(lam_pcm_node_t **nodes, size_t *nodes_len * * \warning The handle must be released using lam_pcm_handle_free */ -typedef lam_job_handle_t (*mca_pcm_handle_new_fn_t)(lam_job_handle_t parent); +typedef lam_job_handle_t (*mca_pcm_base_handle_new_fn_t)(lam_job_handle_t parent); /** @@ -140,7 +141,7 @@ typedef lam_job_handle_t (*mca_pcm_handle_new_fn_t)(lam_job_handle_t parent); * * \warning The handle must be released using lam_pcm_handle_free */ -typedef lam_job_handle_t (*mca_pcm_handle_get_fn_t)(void); +typedef lam_job_handle_t (*mca_pcm_base_handle_get_fn_t)(void); /** @@ -151,7 +152,7 @@ typedef lam_job_handle_t (*mca_pcm_handle_get_fn_t)(void); * Free a job handle returned by lam_pcm_handle_new or * lam_pcm_handle_get. */ -typedef void (*mca_pcm_handle_free_fn_t)(lam_job_handle_t *job_handle); +typedef void (*mca_pcm_base_handle_free_fn_t)(lam_job_handle_t *job_handle); /** @@ -167,7 +168,7 @@ typedef void (*mca_pcm_handle_free_fn_t)(lam_job_handle_t *job_handle); * always return LAM_SUCCESS (yes) if called from mpirun. Useful * for asking if MPI_SPAWN and friends can run. */ -typedef int (*mca_pcm_job_can_sapwn_fn_t)(lam_job_handle_t job_handle); +typedef int (*mca_pcm_base_job_can_spawn_fn_t)(lam_job_handle_t job_handle); /** @@ -190,7 +191,7 @@ typedef int (*mca_pcm_job_can_sapwn_fn_t)(lam_job_handle_t job_handle); * \Warning It is an error to call this function more than once on a single * job handle. */ -typedef int (*mca_pcm_job_set_arguments_fn_t)(lam_job_handle_t job_handle, +typedef int (*mca_pcm_base_job_set_arguments_fn_t)(lam_job_handle_t job_handle, lam_pcm_control_args_t* opts, size_t opts_len); @@ -220,7 +221,7 @@ typedef int (*mca_pcm_job_set_arguments_fn_t)(lam_job_handle_t job_handle, * LAM_ERR_NOT_SUPPORTED will be returned if the mca module does not * support spawning of new applications from */ -typedef int (*mca_pcm_job_launch_procs_fn_t)(lam_job_handle_t job_handle, +typedef int (*mca_pcm_base_job_launch_procs_fn_t)(lam_job_handle_t job_handle, lam_pcm_node_t *nodes, size_t nodes_len, const char* file, int argc, const char* argv[], @@ -243,7 +244,7 @@ typedef int (*mca_pcm_job_launch_procs_fn_t)(lam_job_handle_t job_handle, * returns, it is safe to assume that all rendezvous is complete * (ie, you can exit and not mess anything up */ -typedef int (*mca_pcm_job_rendezvous_fn_t)(lam_job_handle_t job_handle); +typedef int (*mca_pcm_base_job_rendezvous_fn_t)(lam_job_handle_t job_handle); /** @@ -258,7 +259,7 @@ typedef int (*mca_pcm_job_rendezvous_fn_t)(lam_job_handle_t job_handle); * on a job at termination, as job results will be expunged over * time as resource limits dictate. */ -typedef int (*mca_pcm_job_wait_fn_t)(lam_job_handle_t job_handle); +typedef int (*mca_pcm_base_job_wait_fn_t)(lam_job_handle_t job_handle); /** @@ -273,7 +274,7 @@ typedef int (*mca_pcm_job_wait_fn_t)(lam_job_handle_t job_handle); * Ask if job is running. If job has recently finished, this does * not imply wait the pcm interface will call wait for you. */ -typedef int (*mca_pcm_job_running_fn_t)(lam_job_handle_t job_handle, +typedef int (*mca_pcm_base_job_running_fn_t)(lam_job_handle_t job_handle, int* running); @@ -291,7 +292,7 @@ typedef int (*mca_pcm_job_running_fn_t)(lam_job_handle_t job_handle, * * \warning This function is not yet implemented. */ -typedef int (*mca_pcm_job_list_running_fn_t)(lam_job_handle_t **handles, +typedef int (*mca_pcm_base_job_list_running_fn_t)(lam_job_handle_t **handles, size_t handles_len); @@ -313,7 +314,7 @@ typedef int (*mca_pcm_job_list_running_fn_t)(lam_job_handle_t **handles, * integration with the oob mca module is probably required to meet * this constraint). */ -typedef int (*mca_pcm_proc_startup_fn_t)(void); +typedef int (*mca_pcm_base_proc_startup_fn_t)(void); /** @@ -328,7 +329,7 @@ typedef int (*mca_pcm_proc_startup_fn_t)(void); * \warning This function is not implemented and its argument list * will obviously change in the very near future. */ -typedef int (*mca_pcm_proc_get_peers_fn_t)(void); +typedef int (*mca_pcm_base_proc_get_peers_fn_t)(void); /** @@ -341,7 +342,7 @@ typedef int (*mca_pcm_proc_get_peers_fn_t)(void); * \warning This function is not implemented and its argument list * will obviously change in the very near future. */ -typedef int (*mca_pcm_proc_get_me_fn_t)(void); +typedef int (*mca_pcm_base_proc_get_me_fn_t)(void); /** * Get my entry in the peers list @@ -353,46 +354,56 @@ typedef int (*mca_pcm_proc_get_me_fn_t)(void); * \warning This function is not implemented and its argument list * will obviously change in the very near future. */ -typedef int (*mca_pcm_proc_get_parent_fn_t)(void); +typedef int (*mca_pcm_base_proc_get_parent_fn_t)(void); -typedef int (*mca_pcm_finalize_fn_t)(void); +typedef int (*mca_pcm_base_finalize_fn_t)(void); /* * Ver 1.0.0 */ -typedef struct mca_pcm_module_1_0_0 { - mca_module_1_0_0_t super; +struct mca_pcm_base_module_1_0_0_t { + mca_base_module_t pcmm_version; + mca_base_module_data_1_0_0_t pcmm_data; - mca_pcm_query_fn_t pcmm_query; - mca_pcm_init_fn_t pcmm_init; - mca_pcm_finalize_fn_t pcmm_finalize; -} mca_pcm_module_1_0_0_t; + mca_pcm_base_query_fn_t pcmm_query; + mca_pcm_base_init_fn_t pcmm_init; + mca_pcm_base_finalize_fn_t pcmm_finalize; +}; +typedef struct mca_pcm_base_module_1_0_0_t mca_pcm_base_module_1_0_0_t; -typedef struct mca_pcm_1_0_0 { - mca_1_0_0_t super; +struct mca_pcm_1_0_0_t { + mca_pcm_base_query_get_nodes_fn_t pcm_query_get_nodes; - mca_pcm_query_get_nodes_fn_t pcm_query_get_nodes; + mca_pcm_base_handle_new_fn_t pcm_handle_new; + mca_pcm_base_handle_get_fn_t pcm_handle_get; + mca_pcm_base_handle_free_fn_t pcm_handle_free; - mca_pcm_handle_new_fn_t pcm_handle_new; - mca_pcm_handle_get_fn_t pcm_handle_get; - mca_pcm_handle_free_fn_t pcm_handle_free; + mca_pcm_base_job_can_spawn_fn_t pcm_job_can_spawn; + mca_pcm_base_job_set_arguments_fn_t pcm_job_set_arguments; + mca_pcm_base_job_launch_procs_fn_t pcm_job_launch_procs; + mca_pcm_base_job_rendezvous_fn_t pcm_job_rendezvous; + mca_pcm_base_job_wait_fn_t pcm_job_wait; + mca_pcm_base_job_running_fn_t pcm_job_running; + mca_pcm_base_job_list_running_fn_t pcm_job_list_running; - mca_pcm_job_can_spwan_fn_t pcm_job_can_spawn; - mca_pcm_job_set_arguments_fn_t pcm_job_set_arguments; - mca_pcm_job_launch_procs_fn_t pcm_job_launch_procs; - mca_pcm_job_rendezvous_fn_t pcm_job_rendezvous; - mca_pcm_job_wait_fn_t pcm_job_wait; - mca_pcm_job_running_fn_t pcm_job_running; - mca_pcm_job_list_running_fn_t pcm_job_list_running; + mca_pcm_base_proc_startup_fn_t pcm_proc_startup; + mca_pcm_base_proc_get_peers_fn_t pcm_proc_get_peers; + mca_pcm_base_proc_get_me_fn_t pcm_proc_get_me; + mca_pcm_base_proc_get_parent_fn_t pcm_proc_get_parent; +}; +typedef struct mca_pcm_1_0_0_t mca_pcm_1_0_0_t; - mca_pcm_proc_startup_fn_t pcm_proc_startup; - mca_pcm_proc_get_peers_fn_t pcm_proc_get_peers; - mca_pcm_proc_get_me_fn_t pcm_proc_get_me; - mca_pcm_proc_get_parent_fn_t pcm_proc_get_parent; -} mca_pcm_module_1_0_0_t; +/* + * Macro for use in modules that are of type pcm v1.0.0 + */ +#define MCA_PCM_BASE_VERSION_1_0_0 \ + /* pcm v1.0 is chained to MCA v1.0 */ \ + MCA_BASE_VERSION_1_0_0, \ + /* pcm v1.0 */ \ + "pcm", 1, 0, 0 -typedef mca_pcm_module_1_0_0_t mca_pcm_module_t; +typedef mca_pcm_base_module_1_0_0_t mca_pcm_base_module_t; typedef mca_pcm_1_0_0_t mca_pcm_t; /* @@ -404,7 +415,7 @@ extern "C" { int mca_pcm_base_open(lam_cmd_line_t *cmd); int mca_pcm_base_close(void); - bool mca_pcm_base_is_checkpointable(void) + bool mca_pcm_base_is_checkpointable(void); int mca_pcm_base_checkpoint(void); int mca_pcm_base_continue(void);