1
1

*checkpoint some bproc pcm changes to move machines

* add first take of mapper component for BJS

This commit was SVN r3736.
Этот коммит содержится в:
Brian Barrett 2004-12-07 19:03:20 +00:00
родитель 947f166282
Коммит 13bf550a0f
8 изменённых файлов: 385 добавлений и 3 удалений

0
src/mca/llm/bjs/.ompi_ignore Обычный файл
Просмотреть файл

46
src/mca/llm/bjs/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,46 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Use the top-level Makefile.options
include $(top_ompi_srcdir)/config/Makefile.options
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).
sources = \
llm_bjs.h \
llm_bjs.c \
llm_bjs_component.c
if OMPI_BUILD_llm_bjs_DSO
component_noinst =
component_install = mca_llm_bjs.la
else
component_noinst = libmca_llm_bjs.la
component_install =
endif
mcacomponentdir = $(libdir)/openmpi
mcacomponent_LTLIBRARIES = $(component_install)
mca_llm_bjs_la_SOURCES = $(sources)
mca_llm_bjs_la_LIBADD =
mca_llm_bjs_la_LDFLAGS = -module -avoid-version
noinst_LTLIBRARIES = $(component_noinst)
libmca_llm_bjs_la_SOURCES = $(sources)
libmca_llm_bjs_la_LIBADD =
libmca_llm_bjs_la_LDFLAGS = -module -avoid-version

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

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

19
src/mca/llm/bjs/configure.params Обычный файл
Просмотреть файл

@ -0,0 +1,19 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# Specific to this module
PARAM_INIT_FILE=bjs_hostfile.c
PARAM_CONFIG_FILES="Makefile"

99
src/mca/llm/bjs/llm_bjs.c Обычный файл
Просмотреть файл

@ -0,0 +1,99 @@
/* -*- C -*-
*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "llm_bjs.h"
#include "mca/llm/llm.h"
#include "mca/llm/base/base.h"
#include "mca/llm/base/base_internal.h"
#include "mca/ns/ns.h"
#include "util/output.h"
#include <stdio.h>
ompi_list_t*
mca_llm_bjs_allocate_resources(mca_llm_base_module_t *me,
mca_ns_base_jobid_t jobid,
int nodes, int procs)
{
ompi_list_t *hostlist = NULL;
ompi_list_t *nodelist = NULL;
int ret, i, j, nodes_len;
char *node_string, *tmp;
mca_llm_base_hostfile_node_t *newnode;
hostlist = OBJ_NEW(ompi_list_t);
tmp = getenv("NODES");
if (NULL == tmp) return NULL;
node_string = strdup(tmp);
if (NULL == node_string) return NULL;
for (i = 0 ; i < nodes_len ; ++i) {
/* find the end of this entry and change the comma to end of string */
for (j = 0 ; j + i < nodes_len ; ++j) {
if (node_string[i + j] == ',') {
node_string[i + j] = '\0';
break;
}
}
newnode = OBJ_NEW(mca_llm_base_hostfile_node_t);
strcpy(newnode->hostname, node_string + i);
newnode->given_count = 1;
ompi_list_append(hostlist, (ompi_list_item_t*) newnode);
i += j;
}
ret = mca_llm_base_map_resources(nodes, procs, hostlist);
if (OMPI_SUCCESS != ret) {
mca_llm_base_deallocate(hostlist);
return NULL;
}
nodelist = mca_llm_base_create_node_allocation(hostlist);
if (OMPI_SUCCESS != ret) {
mca_llm_base_deallocate(hostlist);
return NULL;
}
return nodelist;
}
int
mca_llm_bjs_deallocate_resources(mca_llm_base_module_t *me,
mca_ns_base_jobid_t jobid,
ompi_list_t *nodelist)
{
ompi_list_item_t *item;
/* pop off all the ompi_ret_node_allocatoin_t instances and free
* them. Their destructors will kill the
* mca_llm_base_hostfile_data_t, who's destructor will kill the
* mca_llm_base_hostfile_node_t instances associated with the
* node_allocation. In other words, everything goes "bye-bye"
*/
while (NULL != (item = ompi_list_remove_first(nodelist))) {
OBJ_RELEASE(item);
}
OBJ_RELEASE(nodelist);
return OMPI_SUCCESS;
}

61
src/mca/llm/bjs/llm_bjs.h Обычный файл
Просмотреть файл

@ -0,0 +1,61 @@
/* -*- C -*-
*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef LLM_BJS_H
#define LLM_BJS_H
#include "ompi_config.h"
#include "mca/mca.h"
#include "mca/llm/llm.h"
#include "mca/ns/ns.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/*
* Globally exported variable
*/
OMPI_COMP_EXPORT extern const mca_llm_base_component_1_0_0_t mca_llm_bjs_component;
/*
* llm API functions
*/
int mca_llm_bjs_component_open(void);
int mca_llm_bjs_component_close(void);
struct mca_llm_base_module_1_0_0_t*
mca_llm_bjs_component_init(const char *active_pcm,
bool have_threads,
int *priority);
int mca_llm_bjs_finalize(mca_llm_base_module_t *me);
ompi_list_t*
mca_llm_bjs_allocate_resources(mca_llm_base_module_t *me,
mca_ns_base_jobid_t jobid,
int nodes,
int procs);
int mca_llm_bjs_deallocate_resources(mca_llm_base_module_t *me,
mca_ns_base_jobid_t jobid,
ompi_list_t *nodelist);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

132
src/mca/llm/bjs/llm_bjs_component.c Обычный файл
Просмотреть файл

@ -0,0 +1,132 @@
/* -*- C -*-
*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "mca/llm/bjs/llm-bjs-version.h"
#include "llm_bjs.h"
#include "include/constants.h"
#include "util/os_path.h"
#include "mca/llm/llm.h"
#include "mca/llm/base/base.h"
#include "mca/base/mca_base_param.h"
#include "util/output.h"
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
const mca_llm_base_component_1_0_0_t mca_llm_bjs_component = {
/* First, the mca_module_t struct containing meta information
about the module itself */
{
/* Indicate that we are a llm v1.0.0 module (which also implies a
specific MCA version) */
MCA_LLM_BASE_VERSION_1_0_0,
/* Module name and version */
"bjs",
MCA_llm_bjs_MAJOR_VERSION,
MCA_llm_bjs_MINOR_VERSION,
MCA_llm_bjs_RELEASE_VERSION,
/* Module open and close functions */
mca_llm_bjs_component_open,
mca_llm_bjs_component_close
},
/* Next the MCA v1.0.0 module meta data */
{
/* Whether the module is checkpointable or not */
false
},
/* Initialization / shutdown functions */
mca_llm_bjs_component_init,
};
/*
* component variables handles
*/
static int param_priority;
int
mca_llm_bjs_component_open(void)
{
param_priority = mca_base_param_register_int("llm",
"bjs",
"priority",
NULL,
0);
return OMPI_SUCCESS;
}
int
mca_llm_bjs_component_close(void)
{
return OMPI_SUCCESS;
}
struct mca_llm_base_module_1_0_0_t*
mca_llm_bjs_component_init(const char *active_pcm,
bool have_threads,
int *priority)
{
mca_llm_base_module_t *me;
char *nodes;
int nodes_len, i;
mca_base_param_lookup_int(param_priority, priority);
if (0 == *priority) return NULL;
/* make sure we are running in BJS or a BJS-like system */
nodes = getenv("NODES");
if (NULL == nodes) return NULL;
nodes_len = strlen(nodes);
for (i = 0 ; i < nodes_len ; ++i) {
/* make sure all we have are negative sign, number, or comma */
if (! (nodes[i] == '-' || nodes[i] == ',' ||
(nodes[i] >= '0' && nodes[i] <= '9'))) {
ompi_output_verbose(10, 0, "found non-BJS friendly character %c", nodes[i]);
return NULL;
}
}
me = malloc(sizeof(mca_llm_base_module_t));
if (NULL == me) return NULL;
me->llm_allocate_resources = mca_llm_bjs_allocate_resources;
me->llm_deallocate_resources = mca_llm_bjs_deallocate_resources;
me->llm_finalize = mca_llm_bjs_finalize;
return me;
}
int
mca_llm_bjs_finalize(mca_llm_base_module_t *me)
{
if (NULL == me) return OMPI_ERR_BAD_PARAM;
free(me);
return OMPI_SUCCESS;
}

Просмотреть файл

@ -75,13 +75,32 @@ ompi_output_stream_t mca_pcm_bproc_output_stream = {
/*
* Module variables handles
*/
static int mca_pcm_bproc_param_priority;
static int param_priority;
/* disable stdio */
static int param_stdin_dev_null;
static int param_no_io_forwarding;
/* use forwarding */
static int param_line_buffer;
static int param_prefix_io;
static int param_line_buffer_size;
static int param_stdin_rank;
/* use files */
static int param_stdin_file;
static int param_stdout_file;
static int param_stderr_file;
int
mca_pcm_bproc_component_open(void)
{
mca_pcm_bproc_param_priority =
param_priority =
mca_base_param_register_int("pcm", "bproc", "priority", NULL, 5);
param_stdin_dev_null =
mca_base_param_register_int("pcm", "bproc", "priority", NULL, 5);
return OMPI_SUCCESS;
}
@ -103,7 +122,7 @@ mca_pcm_bproc_init(int *priority,
mca_pcm_bproc_module_t *me;
struct bproc_version_t vers;
mca_base_param_lookup_int(mca_pcm_bproc_param_priority, priority);
mca_base_param_lookup_int(param_priority, priority);
/* we can start daemons, we can do qos, and it looks like we can spawn,
so no constrains searching */