1
1

* shell code for rsh pcm module. Doesn't work, but has priority of 99, so

it should really never get selected.

This commit was SVN r807.
Этот коммит содержится в:
Brian Barrett 2004-02-15 01:45:10 +00:00
родитель b4746704ab
Коммит d50cb6b82a
7 изменённых файлов: 438 добавлений и 0 удалений

37
src/mca/lam/pcm/rsh/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,37 @@
# -*- makefile -*-
#
# $HEADER$
#
# Use the top-level LAM Makefile.options
include $(top_lam_srcdir)/config/Makefile.options
SUBDIRS = src
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_pcm_rsh_LOADABLE_MODULE
module_noinst =
module_install = mca_pcm_rsh.la
else
module_noinst = libmca_lam_pcm_rsh.la
module_install =
endif
mcamoduledir = $(libdir)/lam
mcamodule_LTLIBRARIES = $(module_install)
mca_pcm_rsh_la_SOURCES =
mca_pcm_rsh_la_LIBADD = \
src/libmca_pcm_rsh.la \
$(LIBLAM_LA)
mca_pcm_rsh_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(module_noinst)
libmca_lam_pcm_rsh_la_SOURCES =
libmca_lam_pcm_rsh_la_LIBADD = src/libmca_pcm_rsh.la
libmca_lam_pcm_rsh_la_LDFLAGS = -module -avoid-version

6
src/mca/lam/pcm/rsh/VERSION Обычный файл
Просмотреть файл

@ -0,0 +1,6 @@
major=1
minor=0
release=0
alpha=0
beta=0
cvs=1

9
src/mca/lam/pcm/rsh/configure.params Обычный файл
Просмотреть файл

@ -0,0 +1,9 @@
# -*- shell-script -*-
#
# $HEADER$
#
# Specific to this module
PARAM_INIT_FILE=src/pcm_rsh.c
PARAM_CONFIG_FILES="Makefile src/Makefile"

17
src/mca/lam/pcm/rsh/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_rsh.la
libmca_pcm_rsh_la_SOURCES = \
pcm_rsh.h \
pcm_rsh_module.c \
pcm_rsh.c

155
src/mca/lam/pcm/rsh/src/pcm_rsh.c Обычный файл
Просмотреть файл

@ -0,0 +1,155 @@
/* -*- C -*-
*
* $HEADER$
*
*/
#include "lam_config.h"
#include "mca/lam/pcm/pcm.h"
#include "mca/lam/pcm/rsh/src/pcm_rsh.h"
#include "lam/mem/malloc.h"
#include "lam/types.h"
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
#include <unistd.h>
static const char *handle_base = "pcm_rsh_job";
static unsigned long handle_count = 0;
int
mca_pcm_rsh_query_get_nodes(mca_pcm_rte_node_t **nodes, size_t * nodes_len,
int *available_procs)
{
return LAM_ERR_NOT_SUPPORTED;
}
lam_job_handle_t
mca_pcm_rsh_handle_new(lam_job_handle_t parent)
{
char *new_handle = NULL;
int mypid = 0;
char hostname[MAXHOSTNAMELEN];
size_t handle_len = strlen(handle_base) + strlen("___") +
(8 * sizeof(int) * 2) + MAXHOSTNAMELEN;
/* we don't support spawning just yet */
if (parent != NULL) return NULL;
gethostname(hostname, MAXHOSTNAMELEN);
new_handle = (char*) malloc(handle_len);
if (new_handle == NULL) return new_handle;
snprintf(new_handle, handle_len, "%s_%s_%d_%d", handle_base, hostname,
mypid, handle_count++);
return new_handle;
}
lam_job_handle_t
mca_pcm_rsh_handle_get(void)
{
return mca_pcm_rsh_my_job_handle;
}
void
mca_pcm_rsh_handle_free(lam_job_handle_t * job_handle)
{
if (job_handle != NULL) free(job_handle);
}
int
mca_pcm_rsh_job_can_spawn(lam_job_handle_t job_handle)
{
if (mca_pcm_rsh_handle_get() != NULL) {
/* no support for spawned jobs */
return LAM_ERR_NOT_SUPPORTED;
} else {
return LAM_SUCCESS;
}
}
int
mca_pcm_rsh_job_set_arguments(lam_job_handle_t job_handle,
mca_pcm_control_args_t * opts,
size_t opts_len)
{
return LAM_ERR_NOT_IMPLEMENTED;
}
int
mca_pcm_rsh_job_launch_procs(lam_job_handle_t job_handle,
mca_pcm_rte_node_t *nodes,
size_t nodes_len, const char *file,
int argc, const char *argv[],
const char *env[])
{
return LAM_ERR_NOT_IMPLEMENTED;
}
int
mca_pcm_rsh_job_rendezvous(lam_job_handle_t job_handle)
{
return LAM_ERR_NOT_IMPLEMENTED;
}
int
mca_pcm_rsh_job_wait(lam_job_handle_t job_handle)
{
return LAM_ERR_NOT_IMPLEMENTED;
}
int
mca_pcm_rsh_job_running(lam_job_handle_t job_handle,
int *running)
{
return LAM_ERR_NOT_IMPLEMENTED;
}
int
mca_pcm_rsh_job_list_running(lam_job_handle_t ** handles,
size_t handles_len)
{
return LAM_ERR_NOT_IMPLEMENTED;
}
int
mca_pcm_rsh_proc_startup(void)
{
return LAM_SUCCESS;
}
int
mca_pcm_rsh_proc_get_peers(mca_pcm_proc_t **procs, size_t *nprocs)
{
return LAM_SUCCESS;
}
mca_pcm_proc_t*
mca_pcm_rsh_proc_get_me(void)
{
return NULL;
}
int
mca_pcm_rsh_proc_get_parent(void)
{
return LAM_ERR_NOT_IMPLEMENTED;
}

84
src/mca/lam/pcm/rsh/src/pcm_rsh.h Обычный файл
Просмотреть файл

@ -0,0 +1,84 @@
/* -*- C -*-
*
* $HEADER$
*
*/
#include "lam_config.h"
#include "mca/lam/pcm/pcm.h"
#include "lam/types.h"
#include <sys/types.h>
/*
* Module open / close
*/
int mca_pcm_rsh_open(void);
int mca_pcm_rsh_close(void);
/*
* Startup / Shutdown
*/
struct mca_pcm_1_0_0_t* mca_pcm_rsh_init(int *priority,
bool *allow_multi_user_threads,
bool *have_hidden_threads);
int mca_pcm_rsh_finalize(void);
/*
* "Action" functions
*/
int mca_pcm_rsh_query_get_nodes(mca_pcm_rte_node_t **nodes, size_t *nodes_len,
int *available_procs);
lam_job_handle_t mca_pcm_rsh_handle_new(lam_job_handle_t parent);
lam_job_handle_t mca_pcm_rsh_handle_get(void);
void mca_pcm_rsh_handle_free(lam_job_handle_t *job_handle);
int mca_pcm_rsh_job_can_spawn(lam_job_handle_t job_handle);
int mca_pcm_rsh_job_set_arguments(lam_job_handle_t job_handle,
mca_pcm_control_args_t* opts,
size_t opts_len);
int mca_pcm_rsh_job_launch_procs(lam_job_handle_t job_handle,
mca_pcm_rte_node_t *nodes,
size_t nodes_len, const char* file,
int argc, const char* argv[],
const char *env[]);
int mca_pcm_rsh_job_rendezvous(lam_job_handle_t job_handle);
int mca_pcm_rsh_job_wait(lam_job_handle_t job_handle);
int mca_pcm_rsh_job_running(lam_job_handle_t job_handle,
int* running);
int mca_pcm_rsh_job_list_running(lam_job_handle_t **handles,
size_t handles_len);
int mca_pcm_rsh_proc_startup(void);
int mca_pcm_rsh_proc_get_peers(mca_pcm_proc_t **procs, size_t *nprocs);
mca_pcm_proc_t* mca_pcm_rsh_proc_get_me(void);
int mca_pcm_rsh_proc_get_parent(void);
/*
* Private types / data / etc.
*/
struct mca_pcm_rsh_connection_item_t {
lam_list_item_t super;
pid_t rshpid;
int vpid;
int status;
};
typedef struct mca_pcm_rsh_connection_t mca_pcm_rsh_connection_t;
extern lam_list_t mca_pcm_rsh_connections;
extern lam_job_handle_t mca_pcm_rsh_my_job_handle;
extern int mca_pcm_rsh_my_vpid;
extern char *mca_pcm_rsh_rsh;
/*
* Private functions
*/
void mca_pcm_rsh_lock_connections(void);
void mca_pcm_rsh_unlock_connections(void);

130
src/mca/lam/pcm/rsh/src/pcm_rsh_module.c Обычный файл
Просмотреть файл

@ -0,0 +1,130 @@
/* -*- C -*-
*
* $HEADER$
*
*/
#include "lam_config.h"
#include "lam/constants.h"
#include "lam/types.h"
#include "lam/mem/malloc.h"
#include "lam/lfc/lam_list.h"
#include "mca/mca.h"
#include "mca/lam/base/mca_base_param.h"
#include "mca/lam/pcm/pcm.h"
#include "mca/lam/pcm/rsh/src/pcm_rsh.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/*
* Struct of function pointers and all that to let us be initialized
*/
mca_pcm_base_module_1_0_0_t mca_pcm_rsh_module = {
{
MCA_PCM_BASE_VERSION_1_0_0,
"rsh", /* MCA module name */
1, /* MCA module major version */
0, /* MCA module minor version */
0, /* MCA module release version */
mca_pcm_rsh_open, /* module open */
mca_pcm_rsh_close /* module close */
},
{
false /* checkpoint / restart */
},
mca_pcm_rsh_init, /* module init */
mca_pcm_rsh_finalize
};
struct mca_pcm_1_0_0_t mca_pcm_rsh_1_0_0 = {
mca_pcm_rsh_query_get_nodes,
mca_pcm_rsh_handle_new,
mca_pcm_rsh_handle_get,
mca_pcm_rsh_handle_free,
mca_pcm_rsh_job_can_spawn,
mca_pcm_rsh_job_set_arguments,
mca_pcm_rsh_job_launch_procs,
mca_pcm_rsh_job_rendezvous,
mca_pcm_rsh_job_wait,
mca_pcm_rsh_job_running,
mca_pcm_rsh_job_list_running,
mca_pcm_rsh_proc_startup,
mca_pcm_rsh_proc_get_peers,
mca_pcm_rsh_proc_get_me,
mca_pcm_rsh_proc_get_parent
};
lam_list_t mca_pcm_rsh_connections;
lam_job_handle_t mca_pcm_rsh_my_job_handle = NULL;
int mca_pcm_rsh_my_vpid = -1;
char *mca_pcm_rsh_rsh = NULL;
char *mca_pcm_rsh_hostfile = NULL;
int
mca_pcm_rsh_open(void)
{
int id;
OBJ_CONSTRUCT(&mca_pcm_rsh_connections, lam_list_t);
/* BWB - we should really make sure that we have an RSH in the path
somewhere and make that a configure option and all that */
id = mca_base_param_register_string("pcm", "rsh", "rsh", NULL, "ssh");
mca_base_param_lookup_string(id, &mca_pcm_rsh_rsh);
id = mca_base_param_register_int("pcm", "rsh", "vpid", NULL, 0);
mca_base_param_lookup_int(id, &mca_pcm_rsh_my_vpid);
id = mca_base_param_register_string("pcm", "rsh", "job_handle", NULL, NULL);
mca_base_param_lookup_string(id, &mca_pcm_rsh_my_job_handle);
id = mca_base_param_register_string("pcm", "rsh", "hostfile", NULL, NULL);
mca_base_param_lookup_string(id, &mca_pcm_rsh_hostfile);
return LAM_SUCCESS;
}
int
mca_pcm_rsh_close(void)
{
/* BWB - free list? */
OBJ_DESTRUCT(&mca_pcm_rsh_connections);
return LAM_SUCCESS;
}
struct mca_pcm_1_0_0_t*
mca_pcm_rsh_init(int *priority, bool *allow_multi_user_threads,
bool *have_hidden_threads)
{
*priority = 0;
/* BWB - reevaluate this setting at some point */
*allow_multi_user_threads = true;
*have_hidden_threads = false;
/* That's about all we wrote thus far */
return &mca_pcm_rsh_1_0_0;
}
int
mca_pcm_rsh_finalize(void)
{
return LAM_SUCCESS;
}