1
1
This commit was SVN r3974.
Этот коммит содержится в:
Tim Woodall 2005-01-12 20:53:10 +00:00
родитель 55325d1651
Коммит c02b7c274f
35 изменённых файлов: 0 добавлений и 6303 удалений

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

@ -1,21 +0,0 @@
#
# 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 $(top_ompi_srcdir)/config/Makefile.options
noinst_LTLIBRARIES = libmca_svc_exec.la
libmca_svc_exec_la_SOURCES = \
svc_exec.c \
svc_exec.h \
svc_exec_component.c

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

@ -1,19 +0,0 @@
# -*- 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=svc_exec.c
PARAM_CONFIG_FILES="Makefile"

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

@ -1,179 +0,0 @@
/*
* 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 <unistd.h>
#include "include/constants.h"
#include "mca/oob/oob.h"
#include "mca/oob/base/base.h"
#include "svc_exec.h"
mca_svc_base_module_t mca_svc_exec_module = {
mca_svc_exec_module_init,
mca_svc_exec_module_fini
};
/**
* Process an exec command.
*/
static void mca_svc_exec_exec(const ompi_process_name_t* peer, ompi_buffer_t request )
{
pid_t pid = -1;
int32_t i;
int32_t base_pid;
int32_t num_procs;
int32_t num_argv;
int32_t num_env;
int32_t status = OMPI_SUCCESS;
char **argv = NULL;
char **env = NULL;
/* Initialize a buffer for the response */
ompi_buffer_t response;
ompi_buffer_init( &response, 128 );
/* unpack request */
ompi_unpack( request, &num_procs, 1, OMPI_INT32 );
ompi_unpack( request, &base_pid, 1, OMPI_INT32 );
/* unpack command line */
ompi_unpack( request, &num_argv, 1, OMPI_INT32 );
if ( NULL == ( *argv = malloc ( (num_argv+1) * sizeof( char* ) ) ) ) {
status = OMPI_ERR_OUT_OF_RESOURCE;
for(i=0; i<num_procs; i++)
ompi_pack(response, &pid, 1, OMPI_INT32);
goto failure;
}
for ( i = 0; i < num_argv; i++){
ompi_unpack_string( request, &argv[i] );
}
argv[num_argv] = NULL;
/* unpack environment */
ompi_unpack( request, &num_env, 1, OMPI_INT32 );
if ( NULL == ( *argv = malloc ( (num_env+1) * sizeof( char* ) ) ) ) {
status = OMPI_ERR_OUT_OF_RESOURCE;
for(i=0; i<num_procs; i++)
ompi_pack(response, &pid, 1, OMPI_INT32);
goto failure;
}
for ( i = 0; i < num_env; i++){
ompi_unpack_string( request, &env[i] );
}
env[num_env] = NULL;
/* exec each process */
for ( i=0; i < num_procs; i++ ) {
if ((pid = fork( )) < 0 ) {
/* Send back something to let the mpirun, etc
that a process failed.
*/
status = OMPI_ERR_OUT_OF_RESOURCE;
ompi_pack( response, &pid, 1, OMPI_INT32 );
}
/* Child process */
else if ( pid == 0 ) {
/* Need to set up the file descriptors here. */
/* This is the child go off and exec things */
execve (argv[0], argv, env );
exit(-1);
}
/* Parent process */
else if ( pid > 0 ) {
/* pack childs pid */
ompi_pack( response, &pid, 1, OMPI_INT32 );
}
}
/* If nothing bad happened, status is OMPI_SUCCESS */
failure:
ompi_pack( response, &status, 1, OMPI_INT32 );
mca_oob_send_packed((ompi_process_name_t*)peer, response, MCA_OOB_TAG_EXEC, 0);
ompi_buffer_free(response);
}
/**
* Process a kill command.
*/
static void mca_svc_exec_kill(
ompi_process_name_t* peer,
ompi_buffer_t request)
{
}
/**
* Process an OOB request.
*/
static void mca_svc_exec_recv(
int status,
ompi_process_name_t* peer,
ompi_buffer_t request,
int tag,
void* cbdata)
{
/* unpack message */
int32_t command;
ompi_unpack( request, &command, 1, OMPI_INT32 );
switch (command){
case OMPID_EXEC_CMD:
mca_svc_exec_exec(peer, request);
break;
case OMPID_KILL_CMD:
mca_svc_exec_kill(peer, request);
break;
}
}
/**
* Register a callback to receive OOB requests.
*/
int mca_svc_exec_module_init(mca_svc_base_module_t* module)
{
return mca_oob_recv_packed_nb(
MCA_OOB_NAME_ANY,
MCA_OOB_TAG_EXEC,
MCA_OOB_ALLOC,
mca_svc_exec_recv,
NULL);
}
/**
* Cleanup
*/
int mca_svc_exec_module_fini(mca_svc_base_module_t* module)
{
return OMPI_SUCCESS;
}

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

@ -1,59 +0,0 @@
/*
* 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$
*/
/**
* @file
*/
#ifndef _MCA_SVC_EXEC_
#define _MCA_SVC_EXEC_
#include "mca/svc/svc.h"
/**
* Command definitions
*/
#define OMPID_EXEC_CMD 1
#define OMPID_KILL_CMD 2
#define OMPID_PING_CMD 3
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/**
* Component open/close/init
*/
int mca_svc_exec_component_open(void);
int mca_svc_exec_component_close(void);
mca_svc_base_module_t* mca_svc_exec_component_init(void);
/**
* Module init/fini
*/
int mca_svc_exec_module_init(mca_svc_base_module_t*);
int mca_svc_exec_module_fini(mca_svc_base_module_t*);
struct mca_svc_exec_component_t {
mca_svc_base_component_t exec_base;
int exec_debug;
};
typedef struct mca_svc_exec_component_t mca_svc_exec_component_t;
extern mca_svc_base_module_t mca_svc_exec_module;
extern mca_svc_exec_component_t mca_svc_exec_component;
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

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

@ -1,95 +0,0 @@
/*
* 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 "include/constants.h"
#include "svc_exec.h"
mca_svc_exec_component_t mca_svc_exec_component = {
{
/* First, the mca_base_module_t struct containing meta
information about the module itself */
{
/* Indicate that we are a pml v1.0.0 module (which also
implies a specific MCA version) */
MCA_SVC_BASE_VERSION_1_0_0,
"exec", /* MCA module name */
1, /* MCA module major version */
0, /* MCA module minor version */
0, /* MCA module release version */
mca_svc_exec_component_open, /* component open */
mca_svc_exec_component_close /* component close */
},
/* Next the MCA v1.0.0 module meta data */
{
/* Whether the module is checkpointable or not */
false
},
mca_svc_exec_component_init
},
0 /* exec_debug */
};
/**
* Utility function to register parameters
*/
static inline int mca_svc_exec_param_register_int(
const char* param_name,
int default_value)
{
int id = mca_base_param_register_int("svc","exec",param_name,NULL,default_value);
int param_value = default_value;
mca_base_param_lookup_int(id,&param_value);
return param_value;
}
/**
*
*/
int mca_svc_exec_component_open(void)
{
mca_svc_exec_component.exec_debug =
mca_svc_exec_param_register_int("debug", 0);
return OMPI_SUCCESS;
}
/**
*
*/
mca_svc_base_module_t* mca_svc_exec_component_init(void)
{
return &mca_svc_exec_module;
}
/**
*
*/
int mca_svc_exec_component_close(void)
{
return OMPI_SUCCESS;
}

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

@ -1,23 +0,0 @@
#
# 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 $(top_ompi_srcdir)/config/Makefile.options
noinst_LTLIBRARIES = libmca_svc_sched.la
libmca_svc_sched_la_SOURCES = \
svc_sched.c \
svc_sched.h \
svc_sched_component.c \
svc_sched_node.c \
svc_sched_node.h

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

@ -1,19 +0,0 @@
# -*- 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=svc_sched.c
PARAM_CONFIG_FILES="Makefile"

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

@ -1,205 +0,0 @@
/*
* 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 "util/output.h"
#include "mca/oob/oob.h"
#include "mca/oob/base/base.h"
#include "mca/gpr/gpr.h"
#include "mca/gpr/base/base.h"
#include "svc_sched.h"
#include "svc_sched_node.h"
mca_svc_base_module_t mca_svc_sched_module = {
mca_svc_sched_module_init,
mca_svc_sched_module_fini
};
/**
* Process an OOB request.
*/
static void mca_svc_sched_recv(
int status,
ompi_process_name_t* peer,
ompi_buffer_t buffer,
int tag,
void* cbdata)
{
/* unpack the request */
ompi_buffer_t response;
int32_t jobid;
int32_t num_nodes;
int32_t num_procs;
mca_svc_sched_node_t* node;
int rc;
ompi_unpack(buffer, &jobid, 1, OMPI_INT32);
ompi_unpack(buffer, &num_nodes, 1, OMPI_INT32);
ompi_unpack(buffer, &num_procs, 1, OMPI_INT32);
ompi_buffer_init(&response, 128);
/* iterate through the available daemons and attempt to allocate processes
* in a round-robin fashion - building the response to the requestor.
*/
OMPI_THREAD_LOCK(&mca_svc_sched_component.sched_lock);
/* start with the last used node */
node = mca_svc_sched_component.sched_node_next;
if (node == (mca_svc_sched_node_t*)ompi_list_get_end(&mca_svc_sched_component.sched_node_list))
node = (mca_svc_sched_node_t*)ompi_list_get_first(&mca_svc_sched_component.sched_node_list);
OMPI_THREAD_UNLOCK(&mca_svc_sched_component.sched_lock);
/* send the response back to the peer */
rc = mca_oob_send_packed(peer, response, tag, 0);
if(rc < 0) {
ompi_output(0, "mca_svc_sched_recv: mca_oob_send_packed failed with status=%d\n", rc);
}
ompi_buffer_free(response);
}
/**
* Registry callback on change to list of registered daemons.
*/
static void mca_svc_sched_registry_callback(
ompi_registry_notify_message_t* msg,
void* cbdata)
{
ompi_list_item_t* item;
if(mca_svc_sched_component.sched_debug > 1) {
ompi_output(0, "[%d,%d,%d] mca_svc_sched_registry_callback\n",
OMPI_NAME_ARGS(mca_oob_name_self));
}
OMPI_THREAD_LOCK(&mca_svc_sched_component.sched_lock);
for(item = ompi_list_get_first(&msg->data);
item != ompi_list_get_end(&msg->data);
item = ompi_list_get_next(item)) {
ompi_registry_value_t* value = (ompi_registry_value_t*)item;
mca_svc_sched_node_t* node;
char* hostname = NULL;
ompi_process_name_t proc_name;
char* contact_info = NULL;
int32_t proc_slots;
/* unpack the daemon information */
ompi_buffer_t buffer;
ompi_buffer_init_preallocated(&buffer, value->object, value->object_size);
ompi_unpack_string(buffer, &hostname);
ompi_unpack(buffer, &proc_name, 1, OMPI_NAME);
ompi_unpack_string(buffer, &contact_info);
ompi_unpack(buffer, &proc_slots, 1, OMPI_INT32);
ompi_buffer_free(buffer);
/* lookup the corresponding node */
node = (mca_svc_sched_node_t*)ompi_rb_tree_find(
&mca_svc_sched_component.sched_node_tree,
&proc_name);
/* do the right thing based on the trigger type */
if ((OMPI_REGISTRY_NOTIFY_MODIFICATION & msg->trig_action) ||
(OMPI_REGISTRY_NOTIFY_ADD_ENTRY & msg->trig_action) ||
(OMPI_REGISTRY_NOTIFY_PRE_EXISTING & msg->trig_action)) {
/* create or modify the corresponding daemon entry */
if(node == NULL) {
node = OBJ_NEW(mca_svc_sched_node_t);
node->node_name = proc_name;
ompi_rb_tree_insert(&mca_svc_sched_component.sched_node_tree, &node->node_name, node);
ompi_list_append(&mca_svc_sched_component.sched_node_list, &node->node_item);
}
mca_svc_sched_node_set(node,hostname,contact_info,proc_slots);
} else if (OMPI_REGISTRY_NOTIFY_DELETE_ENTRY & msg->trig_action) {
/* delete the corresponding deamon entry */
if(node != NULL) {
ompi_list_item_t* next;
ompi_rb_tree_delete(&mca_svc_sched_component.sched_node_tree, &proc_name);
next = ompi_list_remove_item(&mca_svc_sched_component.sched_node_list, &node->node_item);
OBJ_RELEASE(node);
if(mca_svc_sched_component.sched_node_next == node)
mca_svc_sched_component.sched_node_next = (mca_svc_sched_node_t*)next;
}
}
/* cleanup */
if(hostname != NULL)
free(hostname);
if(contact_info != NULL)
free(contact_info);
}
OMPI_THREAD_UNLOCK(&mca_svc_sched_component.sched_lock);
}
/**
* Register a callback to receive OOB requests.
*/
int mca_svc_sched_module_init(mca_svc_base_module_t* module)
{
/* register */
int rc;
if(mca_svc_sched_component.sched_debug > 0) {
ompi_output(0, "[%d,%d,%d] mca_svc_sched_module_init: calling ompi_registry.subscribe(\"vm\")");
}
/* initialize next node for scheduling */
mca_svc_sched_component.sched_node_next =
(mca_svc_sched_node_t*)ompi_list_get_end(&mca_svc_sched_component.sched_node_list);
rc = ompi_registry.subscribe(
OMPI_REGISTRY_NONE,
OMPI_REGISTRY_NOTIFY_MODIFICATION|
OMPI_REGISTRY_NOTIFY_ADD_ENTRY|
OMPI_REGISTRY_NOTIFY_DELETE_ENTRY|
OMPI_REGISTRY_NOTIFY_PRE_EXISTING,
"ompi-vm", /* segment */
NULL, /* keys */
mca_svc_sched_registry_callback,
NULL);
if(rc != OMPI_SUCCESS) {
ompi_output(0, "[%d,%d,%d] mca_svc_sched_module_init: ompi_registry.subscribe failed, error=%d\n",
OMPI_NAME_ARGS(mca_oob_name_self), rc);
return rc;
}
rc = mca_oob_recv_packed_nb(
MCA_OOB_NAME_ANY,
MCA_OOB_TAG_SCHED,
MCA_OOB_ALLOC,
mca_svc_sched_recv,
NULL);
if(rc != OMPI_SUCCESS) {
ompi_output(0, "[%d,%d,%d] mca_svc_sched_module_init: mca_oob_recv_packed_nb failed, error=%d\n",
OMPI_NAME_ARGS(mca_oob_name_self), rc);
return rc;
}
return OMPI_SUCCESS;
}
/**
* Cleanup
*/
int mca_svc_sched_module_fini(mca_svc_base_module_t* module)
{
return OMPI_SUCCESS;
}

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

@ -1,60 +0,0 @@
/*
* 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$
*/
/**
* @file
*/
#ifndef _MCA_SVC_SCHED_
#define _MCA_SVC_SCHED_
#include "mca/svc/svc.h"
#include "class/ompi_list.h"
#include "class/ompi_rb_tree.h"
#define OMPI_NAME_ARGS(n) (n).cellid,(n).jobid,(n).vpid
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/**
* Component open/close/init
*/
int mca_svc_sched_component_open(void);
int mca_svc_sched_component_close(void);
mca_svc_base_module_t* mca_svc_sched_component_init(void);
/**
* Module init/fini
*/
int mca_svc_sched_module_init(mca_svc_base_module_t*);
int mca_svc_sched_module_fini(mca_svc_base_module_t*);
struct mca_svc_sched_component_t {
mca_svc_base_component_t sched_base;
int sched_debug; /* debug flag */
ompi_list_t sched_node_list; /* list of nodes for round-robin scheduling */
ompi_rb_tree_t sched_node_tree; /* tree of nodes for quick lookup by name */
struct mca_svc_sched_node_t* sched_node_next; /* iterator for round-robin scheduling */
ompi_mutex_t sched_lock; /* lock to protected global variables */
};
typedef struct mca_svc_sched_component_t mca_svc_sched_component_t;
extern mca_svc_base_module_t mca_svc_sched_module;
extern mca_svc_sched_component_t mca_svc_sched_component;
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

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

@ -1,132 +0,0 @@
/*
* 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 "svc_sched.h"
#include "util/proc_info.h"
mca_svc_sched_component_t mca_svc_sched_component = {
{
/* First, the mca_base_module_t struct containing meta
information about the module itself */
{
/* Indicate that we are a pml v1.0.0 module (which also
implies a specific MCA version) */
MCA_SVC_BASE_VERSION_1_0_0,
"sched", /* MCA module name */
1, /* MCA module major version */
0, /* MCA module minor version */
0, /* MCA module release version */
mca_svc_sched_component_open, /* component open */
mca_svc_sched_component_close /* component close */
},
/* Next the MCA v1.0.0 module meta data */
{
/* Whether the module is checkpointable or not */
false
},
mca_svc_sched_component_init
},
};
/**
* Utility function to register parameters
*/
static inline int mca_svc_sched_param_register_int(
const char* param_name,
int default_value)
{
int id = mca_base_param_register_int("svc","sched",param_name,NULL,default_value);
int param_value = default_value;
mca_base_param_lookup_int(id,&param_value);
return param_value;
}
/**
* Sched component open - Initialize global data and register
* any MCA parameters.
*/
int mca_svc_sched_component_open(void)
{
OBJ_CONSTRUCT(&mca_svc_sched_component.sched_lock, ompi_mutex_t);
OBJ_CONSTRUCT(&mca_svc_sched_component.sched_node_list, ompi_list_t);
OBJ_CONSTRUCT(&mca_svc_sched_component.sched_node_tree, ompi_rb_tree_t);
mca_svc_sched_component.sched_debug =
mca_svc_sched_param_register_int("debug", 0);
return OMPI_SUCCESS;
}
/**
* compare function for tree insert
*/
static int mca_svc_sched_name_compare(const ompi_process_name_t* n1, const ompi_process_name_t* n2)
{
if(n1->cellid < n2->cellid)
return -1;
else if(n1->cellid > n2->cellid)
return 1;
else if(n1->jobid < n2->jobid)
return -1;
else if(n1->jobid > n2->jobid)
return 1;
else if(n1->vpid < n2->vpid)
return -1;
else if(n1->vpid > n2->vpid)
return 1;
return(0);
}
/**
* Sched component initialization.
*/
mca_svc_base_module_t* mca_svc_sched_component_init(void)
{
/* only run in the seed daemon */
if(ompi_process_info.seed == false)
return NULL;
/* initialize data structures */
ompi_rb_tree_init(&mca_svc_sched_component.sched_node_tree,
(ompi_rb_tree_comp_fn_t)mca_svc_sched_name_compare);
return &mca_svc_sched_module;
}
/**
*
*/
int mca_svc_sched_component_close(void)
{
OBJ_DESTRUCT(&mca_svc_sched_component.sched_node_list);
OBJ_DESTRUCT(&mca_svc_sched_component.sched_node_tree);
OBJ_DESTRUCT(&mca_svc_sched_component.sched_lock);
return OMPI_SUCCESS;
}

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

@ -1,62 +0,0 @@
/*
* 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 <string.h>
#include "svc_sched_node.h"
static void mca_svc_sched_node_construct(mca_svc_sched_node_t* node)
{
node->node_hostname = NULL;
node->node_contactinfo = NULL;
node->node_proc_slots = 0;
node->node_proc_avail = 0;
}
static void mca_svc_sched_node_destruct(mca_svc_sched_node_t* node)
{
if(node->node_hostname != NULL)
free(node->node_hostname);
if(node->node_contactinfo != NULL)
free(node->node_contactinfo);
}
OBJ_CLASS_INSTANCE(
mca_svc_sched_node_t,
ompi_list_item_t,
mca_svc_sched_node_construct,
mca_svc_sched_node_destruct);
/**
* Setup node attributes
*/
void mca_svc_sched_node_set(
mca_svc_sched_node_t* node,
const char* hostname,
const char* contactinfo,
int32_t proc_slots)
{
if(node->node_hostname != NULL)
free(node->node_hostname);
node->node_hostname = strdup(hostname);
if(node->node_contactinfo != NULL)
free(node->node_contactinfo);
node->node_contactinfo = strdup(contactinfo);
node->node_proc_slots = proc_slots;
}

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

@ -1,51 +0,0 @@
/*
* 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$
*/
/**
* @file
*/
#ifndef _MCA_SVC_SCHED_NODE_
#define _MCA_SVC_SCHED_NODE_
#include "mca/svc/svc.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
struct mca_svc_sched_node_t {
ompi_list_item_t node_item;
ompi_process_name_t node_name;
char* node_hostname;
char* node_contactinfo;
int32_t node_proc_slots;
int32_t node_proc_avail;
};
typedef struct mca_svc_sched_node_t mca_svc_sched_node_t;
OBJ_CLASS_DECLARATION(mca_svc_sched_node_t);
/**
* Setup node attributes
*/
void mca_svc_sched_node_set(
mca_svc_sched_node_t* node,
const char* hostname,
const char* contactinfo,
int32_t proc_slots);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

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

@ -1,30 +0,0 @@
#
# 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$
#
SNL_OBJECTS = ./snipe_lite/msg.c \
./snipe_lite/msgbuf2.c \
./snipe_lite/memory.c \
./snipe_lite/syslog.c \
./snipe_lite/snipe_lite.c
all : sioapp cioapp
sioapp : sioapp.c
gcc -o sioapp sioapp.c libsio.c $(SNL_OBJECTS) -I./snipe_lite
cioapp : cioapp.c
gcc -o cioapp cioapp.c libcio.c $(SNL_OBJECTS) -I./snipe_lite
clean :
rm -f *.o sioapp cioapp

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

@ -1,108 +0,0 @@
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$
This should be in a design document but....
Random thoughts on stdio redirection.
- stdin redirection should be buffered (i.e. fragment-based). stdin
should go to process 0. Any need to broadcast stdin?
- stdout/stderr also buffered. Fragment headers: to indicate origin,
and to handle out of order delivery in future distributed situations.
- pipes or ptys from ompid to processes. Fairly portable pty code is
in src/util/pty.c. Goal: wrap up selection of pipes vs ptys in a
transparent fashion for easy selection at compile- or run-time (MCA
parameter-based I guess). Note ptys are typically necessary when stdin
is a tty so that interactive input is possible.
- stdin redirection: base this on LA-MPI's rts/cts fragment-based
approach.
- Consider basing ompid -> mpirun stdout/stderr redirection on FTMPI
libcio/sio ported to use oob framework (tcp component for non-blocking
operation).
In this directory:
libcio/sio are the client and server parts of the FTMPI stdout and
stderr I/O forwarding.
snipe_lite is a close analog of our OOB
Explanatory email from Thara:
From: angskun@cs.utk.edu
Subject: Re: libsio, libcio
Date: August 13, 2004 13:11:14 MDT
To: ddd@lanl.gov
Cc: fagg@cs.utk.edu
Dear David,
Everything in snipe_lite directory is for basic connection management
in FT-MPI. The libcio/sio use the snipe_lite for communication.
You may replace it with socket or OpenMPI communication library.
cioapp.c : client/console/ application example
sioapp.c : server/daemon application example
libcio.*, libsio.* : the library and include file
Example:
*** client/console machine ***
[angskun@torc0 ~/ioapp]$ ./cioapp 3
Port is 6781
[0:stdout] Hi world, my name is foo 1/5 [bar code is 0 (pid 19409)]
Hi world, my name is foo 2/5 [bar code is 0 (pid 19409)]
Hi world, my name is foo 3/5 [bar code is 0 (pid 19409)]
Hi world, my name is foo 4/5 [bar code is 0 (pid 19409)]
Hi world, my name is foo 5/5 [bar code is 0 (pid 19409)]
[1:stdout] Hi world, my name is foo 1/5 [bar code is 1 (pid 19410)]
Hi world, my name is foo 2/5 [bar code is 1 (pid 19410)]
Hi world, my name is foo 3/5 [bar code is 1 (pid 19410)]
Hi world, my name is foo 4/5 [bar code is 1 (pid 19410)]
Hi world, my name is foo 5/5 [bar code is 1 (pid 19410)]
[2:stdout] Hi world, my name is foo 1/5 [bar code is 2 (pid 19411)]
Hi world, my name is foo 2/5 [bar code is 2 (pid 19411)]
Hi world, my name is foo 3/5 [bar code is 2 (pid 19411)]
Hi world, my name is foo 4/5 [bar code is 2 (pid 19411)]
Hi world, my name is foo 5/5 [bar code is 2 (pid 19411)]
[angskun@torc0 ~/ioapp]$
*** server / daemon machine ***
$./sioapp torc0 6781 3
Best Regards,
Thara
----- Original Message -----
From: "David Daniel" <ddd@lanl.gov>
To: "THara Angskun" <angskun@cs.utk.edu>
Cc: "Graham E Fagg" <fagg@cs.utk.edu>
Sent: Friday, August 13, 2004 2:09 PM
Subject: libsio, libcio
Thara
I'm looking at using libcio/sio as a starting point for standard I/O
redirection in Open MPI.
Graham mentioned that you had some tests for testing them on their own.
If you could let me have a copy that would be very helpful.
Thanks, David
--
David Daniel <ddd@lanl.gov> +1-505-667-0883
Advanced Computing Laboratory, LANL, MS-B287, Los Alamos NM 87545, USA

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

@ -1,70 +0,0 @@
/*
* 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 <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <libgen.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <arpa/inet.h>
#include <resolv.h>
#include <netdb.h>
#define TIMEOUT 500
#define SERV_PORT 6780
int setupContactPoint(int *port)
{
int listenfd, rc;
struct sockaddr_in servaddr;
listenfd = socket(AF_INET, SOCK_STREAM, 0);
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
(*port) = SERV_PORT;
servaddr.sin_port = htons((*port));
while((rc=bind(listenfd, (struct sockaddr *) &servaddr, sizeof(servaddr)))!=0) {
servaddr.sin_port = htons(++(*port));
}
listen(listenfd, 5);
return listenfd;
}
int main(int argc,char **argv)
{
int port,listenfd;
int number_of_server_child=0;
int n_child;
int ret;
if(argc!=2) {
printf("%s <#of server's child process>\n",argv[0]);
exit(1);
}
listenfd=setupContactPoint(&port);
n_child=atoi(argv[1]);
printf("Port is %d\n",port);
rioc_init(listenfd, 0);
ret=rioc_poll(TIMEOUT,&number_of_server_child);
while(ret!=0 || number_of_server_child != n_child) {
ret=rioc_poll(TIMEOUT,&number_of_server_child);
}
}

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

@ -1,311 +0,0 @@
/*
* 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$
*/
/*
HARNESS G_HCORE
HARNESS FT_MPI
HARNESS FTMPI_NOTIFIER
Innovative Computer Laboratory,
University of Tennessee,
Knoxville, TN, USA.
harness@cs.utk.edu
--------------------------------------------------------------------------
Authors:
THara Angskun <angskun@cs.utk.edu>
--------------------------------------------------------------------------
NOTICE
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby granted
provided that the above copyright notice appear in all copies and
that both the copyright notice and this permission notice appear in
supporting documentation.
Neither the University of Tennessee nor the Authors make any
representations about the suitability of this software for any
purpose. This software is provided ``as is'' without express or
implied warranty.
HARNESS, HARNESS G_HCORE and FT_MPI was funded in part by the
U.S. Department of Energy.
*/
#include "ompi_config.h"
#include "libcio.h"
#include "debug.h"
static int rioc_pair[RIO_MAXFD];
static int c_num_pair;
static int main_fd;
/* rioc_init - initialize data structure
@param fd file descriptor
@block block flag (1== block,0==nonblock)
*/
int rioc_init(int fd,int block)
{
int i,s;
for(i=0;i<RIO_MAXFD;i++) {
rioc_pair[i]=-1;
}
c_num_pair = 0;
main_fd = fd;
rioc_register_socket(fd);
if(block) {
s = allowconn (main_fd, 0, NULL);
rioc_register_socket(s);
}
return RIO_SUCCESS;
}
/* rioc_stop - clean up data structure
*/
int rioc_stop(void)
{
int i;
for(i=0;i<RIO_MAXFD;i++) {
if(c_num_pair==0) break;
if(rioc_pair[i]!=-1) {
closeconn(i);
rioc_pair[i]=-1;
c_num_pair--;
}
}
return RIO_SUCCESS;
}
/* rioc_register_pipe2_socket - Register I/O
@param src_fd source file descriptor
@param dest_fd destination file descriptor
*/
int rioc_register_socket(int fd)
{
if(fd==main_fd) {
rioc_pair[fd]=0;
} else {
rioc_pair[fd]=1;
}
c_num_pair++;
return RIO_SUCCESS;
}
/* rioc_pollinit - init poll call every time if number of pair has been changed
@param poll_fd poll file descriptor list.
*/
int rioc_pollinit(struct pollfd **poll_fd)
{
int i,j;
#ifndef WIN32
if((*poll_fd)!=NULL) {
_FREE(*poll_fd);
}
j=0;
(*poll_fd)=(struct pollfd *)_MALLOC(sizeof(struct pollfd)*c_num_pair);
for(i=0;i<RIO_MAXFD;i++) {
if(rioc_pair[i]!=-1) {
(*poll_fd)[j].fd=i;
(*poll_fd)[j].events = POLLIN;
(*poll_fd)[j].revents = 0;
j++;
}
if(j>=c_num_pair) break;
}
#endif
return RIO_SUCCESS;
}
/* rioc_poll - startup I/O redirection (NOTE: This function return only no valid pair of src/dest left or timeout)
@param timeout timeout (-1 for infinity)
@return number of connection left before timeout
*/
int rioc_poll(int timeout, int *ncon)
{
int i,count;
struct pollfd *poll_fd;
struct timeval begin, current;
char buf[RIO_MAXBUF];
int max_pair;
int ret;
int s;
long diff;
int update;
int active;
#ifndef WIN32
gettimeofday(&begin,NULL);
poll_fd = NULL;
rioc_pollinit(&poll_fd);
update=0;
do {
gettimeofday(&current,NULL);
diff=(1000000*(current.tv_sec-begin.tv_sec)) + (current.tv_usec-begin.tv_usec);
diff=diff/1000; /* millisecond */
if(timeout>=0) {
if(diff > timeout) {
if((poll_fd)!=NULL) {
_FREE(poll_fd);
}
if(c_num_pair!=0) return c_num_pair-1;
return c_num_pair;
}
}
if((ret=poll(poll_fd, c_num_pair, timeout)) <0) {
if((poll_fd)!=NULL) {
_FREE(poll_fd);
}
return RIO_EPOLL;
}
if(ret==0) { /* time out */
if((poll_fd)!=NULL) {
_FREE(poll_fd);
}
if(c_num_pair!=0) return c_num_pair-1;
return c_num_pair;
}
max_pair=c_num_pair; /* we need max_pair because c_num_pair is dynamic value */
active=0;
for(i=0;i<max_pair;i++) {
if(poll_fd[i].revents!=0) {
if(poll_fd[i].fd==main_fd) {
rioc_pair[main_fd]++;
(*ncon)=rioc_pair[main_fd];
s = allowconn (main_fd, 0, NULL);
rioc_register_socket(s);
update=1;
} else {
count=readmsgconn(poll_fd[i].fd,buf,RIO_MAXBUF);
if(count<=0) {
close(poll_fd[i].fd);
rioc_pair[poll_fd[i].fd]=-1;
c_num_pair--;
update=1;
} else {
buf[count]='\0';
printf("%s",buf);
buf[0]='\0';
}
}
active++;
}
if(active==ret) break;
}
/* Don't check if(c_num_pair!=max_pair). because they may add/delete at the same time */
if(update==1) {
rioc_pollinit(&poll_fd);
update=0;
}
} while(c_num_pair>1);
/* close(main_fd); */
if((poll_fd)!=NULL) {
_FREE(poll_fd);
}
if(c_num_pair!=0) return c_num_pair-1;
#endif
return c_num_pair;
}
/* rioc_getoutput
@param mainfd main output file descriptor to accept output
@param expected_con expected number of connection
*/
int rioc_getoutput(int mainfd,int expected_con)
{
fd_set rfds, rfds_bak;
int maxfd, minfd, i, ret;
int active_con; /* number of active connection */
char buf[RIO_MAXBUF];
int fd;
int updated=0;
int curcon=0;
int respawn=0;
#ifndef WIN32
FD_ZERO(&rfds_bak);
FD_SET(mainfd,&rfds_bak);
maxfd=mainfd+1;
minfd=mainfd;
updated=1;
while(expected_con > 0) {
if(updated>0) {
FD_ZERO(&rfds);
maxfd=0;
minfd=0;
for(fd=0;fd<FD_SETSIZE;fd++) {
if(FD_ISSET(fd,&rfds_bak)) {
FD_SET(fd,&rfds);
if(fd>=maxfd) maxfd=fd+1;
if(fd<minfd) minfd=fd;
}
}
updated=0;
}
active_con = select(maxfd, &rfds, NULL, NULL, NULL);
if(active_con <= 0) {
return RIO_EPOLL;
}
i=minfd;
while(active_con > 0) {
if(FD_ISSET(i,&rfds)) {
if(i==mainfd) {
ret = allowconn (i, 0, NULL);
if(ret>0) {
FD_SET(ret,&rfds_bak);
updated=1;
curcon++;
if(curcon>expected_con) {
respawn=1;
}
if(respawn==1) {
expected_con++;
}
}
} else {
ret=readmsgconn(i,buf,RIO_MAXBUF);
if(ret<=0) {
close(i);
expected_con--;
FD_CLR(i,&rfds_bak);
updated=1;
} else {
buf[ret]='\0';
printf("%s",buf);
buf[0]='\0';
fflush(stdout);
}
}
active_con--;
}
i++;
}
}
#endif
return RIO_SUCCESS;
}

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

@ -1,82 +0,0 @@
/*
* 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$
*/
/*
HARNESS G_HCORE
HARNESS FT_MPI
HARNESS FTMPI_NOTIFIER
Innovative Computer Laboratory,
University of Tennessee,
Knoxville, TN, USA.
harness@cs.utk.edu
--------------------------------------------------------------------------
Authors:
THara Angskun <angskun@cs.utk.edu>
--------------------------------------------------------------------------
NOTICE
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby granted
provided that the above copyright notice appear in all copies and
that both the copyright notice and this permission notice appear in
supporting documentation.
Neither the University of Tennessee nor the Authors make any
representations about the suitability of this software for any
purpose. This software is provided ``as is'' without express or
implied warranty.
HARNESS, HARNESS G_HCORE and FT_MPI was funded in part by the
U.S. Department of Energy.
*/
#ifndef __RIO_H
#define __RIO_H
#include <stdio.h>
#include <stdlib.h>
#ifndef WIN32
#include <unistd.h>
#include <sys/select.h> /* for FD_SETSIZE */
#include <sys/time.h>
#include <fcntl.h>
#include <poll.h>
#include <sys/types.h>
#include "snipe_lite.h"
#else
#include "../../wincomm/wincomm.h"
#endif
#define RIO_SUCCESS 0
#define RIO_EPOLL -1
#define RIO_MAXFD FD_SETSIZE
#define RIO_MAXBUF 8192
int rioc_init(int main_fd,int block);
int rioc_poll(int timeout,int *ncon);
int rioc_register_socket(int fd);
int rioc_stop (void);
#endif

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

@ -1,304 +0,0 @@
/*
* 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$
*/
/*
HARNESS G_HCORE
HARNESS FT_MPI
HARNESS FTMPI_NOTIFIER
Innovative Computer Laboratory,
University of Tennessee,
Knoxville, TN, USA.
harness@cs.utk.edu
--------------------------------------------------------------------------
Authors:
THara Angskun <angskun@cs.utk.edu>
--------------------------------------------------------------------------
NOTICE
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby granted
provided that the above copyright notice appear in all copies and
that both the copyright notice and this permission notice appear in
supporting documentation.
Neither the University of Tennessee nor the Authors make any
representations about the suitability of this software for any
purpose. This software is provided ``as is'' without express or
implied warranty.
HARNESS, HARNESS G_HCORE and FT_MPI was funded in part by the
U.S. Department of Energy.
*/
#include "ompi_config.h"
#include "libsio.h"
#include "debug.h"
static struct pair rios_pair[RIO_MAXFD];
static int s_num_pair;
static struct pollfd* ppoll = NULL;
static int ppoll_space = 0;
/* rios_init - initialize data structure
*/
int rios_init(void)
{
int i;
for(i=0;i<RIO_MAXFD;i++) {
rios_pair[i].name=NULL;
rios_pair[i].sockfd=-1;
rios_pair[i].mypair=-1;
rios_pair[i].silent=0;
}
s_num_pair = 0;
return RIO_SUCCESS;
}
/* rios_stop - clean up data structure
*/
int rios_stop(void)
{
int i;
for(i=0;i<RIO_MAXFD;i++) {
if(s_num_pair==0) break;
if(rios_pair[i].sockfd!=-1) {
close(rios_pair[i].sockfd);
close(i);
rios_pair[i].sockfd=-1;
rios_pair[i].silent=0;
if(rios_pair[i].name!=NULL) _FREE(rios_pair[i].name);
rios_pair[i].name=NULL;
if(rios_pair[i].mypair!=-1) {
close(rios_pair[i].mypair);
rios_pair[rios_pair[i].mypair].sockfd=-1;
rios_pair[rios_pair[i].mypair].silent=0;
if(rios_pair[rios_pair[i].mypair].name!=NULL)
_FREE(rios_pair[rios_pair[i].mypair].name);
rios_pair[rios_pair[i].mypair].name=NULL;
s_num_pair--;
}
s_num_pair--;
}
}
if( ppoll != NULL ) _FREE(ppoll);
ppoll_space = 0;
return RIO_SUCCESS;
}
/* rios_unregister - unregister
@param src_fd source file descriptor
*/
int rios_unregister(int src_fd)
{
if(src_fd <0 || src_fd >= RIO_MAXFD || rios_pair[src_fd].sockfd==-1 ) {
return RIO_EINVLFD;
}
close(src_fd);
if(rios_pair[src_fd].mypair==-1) {
writemsgconn(rios_pair[src_fd].sockfd,"",0); /* tell listener to close connection */
close(rios_pair[src_fd].sockfd);
} else {
rios_pair[rios_pair[src_fd].mypair].mypair=-1;
rios_pair[src_fd].mypair=-1;
}
rios_pair[src_fd].sockfd=-1;
rios_pair[src_fd].silent=0; /* reset it to normal */
if(rios_pair[src_fd].name!=NULL) _FREE(rios_pair[src_fd].name);
rios_pair[src_fd].name=NULL;
s_num_pair--;
return RIO_SUCCESS;
}
/* rios_register_dup
@param template_fd
@param my_fd
@param slient slient flags (-1 is yell, 0 is normal, 1 is shut up)
*/
int rios_register_dup(char *name,int template_fd,int my_fd, int silent)
{
if(template_fd <0 || template_fd >= RIO_MAXFD || rios_pair[template_fd].sockfd == -1 || my_fd < 0 || my_fd >= RIO_MAXFD) {
return RIO_EINVLFD;
}
rios_pair[my_fd].sockfd=rios_pair[template_fd].sockfd;
rios_pair[my_fd].mypair=template_fd;
rios_pair[template_fd].mypair=my_fd;
if(name!=NULL) {
rios_pair[my_fd].name=_MALLOC(sizeof(char)*(strlen(name)+1));
strcpy(rios_pair[my_fd].name,name);
}
rios_pair[my_fd].silent=silent;
s_num_pair++;
return RIO_SUCCESS;
}
/* rios_register_pipe2_socket - Register I/O
@param src_fd source file descriptor
@param dest_fd destination file descriptor
@param slient slient flags (-1 is yell, 0 is normal, 1 is shut up)
*/
int rios_register_pipe2_socket(char *name,int src_fd,int dest_fd, int silent)
{
if(src_fd <0 || src_fd >= RIO_MAXFD || dest_fd < 0 || dest_fd >= RIO_MAXFD) {
return RIO_EINVLFD;
}
rios_pair[src_fd].sockfd=dest_fd;
if(name!=NULL) {
rios_pair[src_fd].name=_MALLOC(sizeof(char)*(strlen(name)+1));
strcpy(rios_pair[src_fd].name,name);
}
rios_pair[src_fd].silent=silent;
s_num_pair++;
return RIO_SUCCESS;
}
/* rios_register_pipe2_host_port - Register I/O
@param src_fd source file descriptor
@param host hostname
@param port port
@param slient slient flags (-1 is yell, 0 is normal, 1 is shut up)
*/
int rios_register_pipe2_host_port(char *name,int src_fd,char *host,int port, int silent)
{
int dest_fd;
dest_fd = getconn (host, &port, 10); /* search a range of 10 */
if(dest_fd<0) {
return RIO_EINVLFD;
}
return rios_register_pipe2_socket(name,src_fd,dest_fd,silent);
}
/* rios_register_pipe2_addr_port - Register I/O
@param src_fd source file descriptor
@param addr address
@param port port
*/
int rios_register_pipe2_addr_port(char *name,int src_fd,long addr,int port, int silent)
{
int dest_fd;
dest_fd = getconn_addr (addr, &port, 10); /* search a range of 10 */
if(dest_fd<0) {
return RIO_EINVLFD;
}
return rios_register_pipe2_socket(name,src_fd,dest_fd,silent);
}
/* rios_pollinit - init poll call every time if number of pair has been changed
@param poll_fd poll file descriptor list.
@param free_me free pollfd
*/
int rios_pollinit(struct pollfd **poll_fd,int free_me)
{
int i,j;
*poll_fd = NULL;
if(s_num_pair <= 0 ) return RIO_EINVLPAIR;
if( ppoll_space < s_num_pair ) {
if( ppoll != NULL ) _FREE( ppoll );
ppoll_space = s_num_pair + (s_num_pair >> 1);
ppoll = (struct pollfd*)_MALLOC( sizeof(struct pollfd) * ppoll_space );
}
j=0;
for(i=0;i<RIO_MAXFD;i++) {
if(rios_pair[i].sockfd!=-1) {
ppoll[j].fd=i;
ppoll[j].events = POLLIN;
ppoll[j].revents = 0;
j++;
}
if(j>=s_num_pair) break;
}
*poll_fd = ppoll;
return RIO_SUCCESS;
}
/* rios_poll - startup I/O redirection (NOTE: This function return only no valid pair of src/dest left or timeout)
@param timeout timeout (-1 for infinity)
@return number of connection left before timeout
*/
int rios_poll(int timeout)
{
int i,count;
struct pollfd *poll_fd;
struct timeval begin, current;
char buf[RIO_MAXBUF];
char tmpbuf[RIO_MAXBUF+500];
int max_pair;
int ret;
long diff;
gettimeofday(&begin,NULL);
poll_fd = NULL;
ret=rios_pollinit(&poll_fd,0);
if(ret<0) {
return ret;
}
while(s_num_pair>0) {
gettimeofday(&current,NULL);
diff=(1000000*(current.tv_sec-begin.tv_sec)) + (current.tv_usec-begin.tv_usec);
diff=diff/1000; /* millisecond */
if(diff > timeout) {
return s_num_pair;
}
if((ret=poll(poll_fd, s_num_pair, timeout)) <0) {
return RIO_EPOLL;
}
if(ret==0) { /* time out */
return s_num_pair;
}
max_pair=s_num_pair; /* we need max_pair because s_num_pair is dynamic value */
for(i=0;i<max_pair;i++) {
if(poll_fd[i].revents!=0) {
if( poll_fd[i].revents & POLLERR ) {
rios_unregister( poll_fd[i].fd );
} else {
count=read(poll_fd[i].fd,buf,RIO_MAXBUF);
if( count <= 0 ) {
rios_unregister(poll_fd[i].fd);
} else {
buf[count]='\0';
if (rios_pair[poll_fd[i].fd].silent==1) { /* shut up */
sprintf(tmpbuf,"%s",buf);
} else { /* shut down, ... I mean normal */
sprintf(tmpbuf,"[%s] %s",rios_pair[poll_fd[i].fd].name,buf);
}
ret=writemsgconn(rios_pair[poll_fd[i].fd].sockfd,tmpbuf,strlen(tmpbuf));
if(ret!=strlen(tmpbuf)) {
rios_unregister(poll_fd[i].fd);
}
}
}
}
}
if(s_num_pair!=max_pair) { /* someone close connection */
ret=rios_pollinit(&poll_fd,1);
if(ret<0) {
return ret;
}
}
}
return RIO_SUCCESS;
}

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

@ -1,88 +0,0 @@
/*
* 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$
*/
/*
HARNESS G_HCORE
HARNESS FT_MPI
HARNESS FTMPI_NOTIFIER
Innovative Computer Laboratory,
University of Tennessee,
Knoxville, TN, USA.
harness@cs.utk.edu
--------------------------------------------------------------------------
Authors:
THara Angskun <angskun@cs.utk.edu>
--------------------------------------------------------------------------
NOTICE
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby granted
provided that the above copyright notice appear in all copies and
that both the copyright notice and this permission notice appear in
supporting documentation.
Neither the University of Tennessee nor the Authors make any
representations about the suitability of this software for any
purpose. This software is provided ``as is'' without express or
implied warranty.
HARNESS, HARNESS G_HCORE and FT_MPI was funded in part by the
U.S. Department of Energy.
*/
#ifndef __RIO_H
#define __RIO_H
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/select.h> /* for FD_SETSIZE */
#include <sys/time.h>
#include <fcntl.h>
#include <poll.h>
#include <string.h>
#include "snipe_lite.h"
#define RIO_SUCCESS 0
#define RIO_EPOLL -1
#define RIO_EINVLFD -2
#define RIO_EINVLPAIR -3
#define RIO_MAXFD FD_SETSIZE
#define RIO_MAXBUF 8192
struct pair {
char *name;
int sockfd;
int mypair;
int silent; /* -1 = yell, 0 = normal, 1= shut up. */
};
int rios_init(void);
int rios_poll(int timeout);
int rios_register_pipe2_socket(char *name,int srcfd,int destfd,int silent);
int rios_register_pipe2_host_port(char *name,int srcfd, char* host, int port, int silent);
int rios_register_pipe2_addr_port(char *name,int srcfd, long addr, int port, int silent);
int rios_register_dup(char *name,int template_fd,int my_fd, int silent);
int rios_unregister(int srcfd);
int rios_stop (void);
#endif

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

@ -1,96 +0,0 @@
/*
* 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 <stdio.h>
#include "libsio.h"
#define TIMEOUT 500
/*
This file is an example for application that use libsio
It simply create numbers of processes and sent their output to
speicify host and port
*/
struct rio {
int pid;
int pp[2]; /* stdout */
int pp2[2]; /* stderr */
} *rios;
int main(int argc,char **argv)
{
int nchild, ret;
int entry=0;
char cioapp_host[256];
char buf[256];
int cioapp_port;
int startup_silent=0; /* 1=silent, 0= verbose */
int pid,k;
if(argc!=4) {
printf("%s <cioapp_hostname> <cioapp_port> <#of child processes>\n",argv[0]);
exit(1);
}
strcpy(cioapp_host,argv[1]);
cioapp_port=atoi(argv[2]);
nchild=atoi(argv[3]);
if(nchild <1) {
printf("#of child must be more than 1\n");
exit(1);
}
rios_init();
rios=(struct rio *)malloc(sizeof(struct rio)*nchild);
for(entry=0;entry<nchild;entry++) {
if (pipe(rios[entry].pp) == -1) perror("pipe");
if (pipe(rios[entry].pp2) == -1) perror("pipe");
sprintf(buf,"%d:stdout",entry);
ret=rios_register_pipe2_host_port(buf,rios[entry].pp[0],cioapp_host,cioapp_port,startup_silent);
if(ret!=RIO_SUCCESS) printf("Cannot connect to %s:%d ret %d\n",cioapp_host,cioapp_port,ret);
sprintf(buf,"%d:stderr",entry);
ret=rios_register_dup(buf,rios[entry].pp[0],rios[entry].pp2[0],startup_silent);
if(ret!=RIO_SUCCESS) printf("Cannot duplicate destination for stderr (ret=%d)\n",ret);
pid = fork();
if (pid == 0) {
dup2(rios[entry].pp[1],1);
dup2(rios[entry].pp2[1],2);
for(k=0;k<5;k++) {
printf("Hi world, my name is foo %d/%d [bar code is %d (pid %d)]\n",k+1,5,entry,getpid());
sleep(1);
}
exit(1);
}
rios[entry].pid=pid;
close(rios[entry].pp[1]);
close(rios[entry].pp2[1]);
rios[entry].pp[1] = -1;
rios[entry].pp2[1] = -1;
}
/* Now, parent poll for child stdout/err */
while(1) {
rios_poll(TIMEOUT);
}
return 0;
}

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

@ -1,78 +0,0 @@
/*
* 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 DEBUG_H_HAS_BEEN_INCLUDED
#define DEBUG_H_HAS_BEEN_INCLUDED
#include <stdio.h>
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/* AIX requires this to be the first thing in the file. */
#ifdef HAVE_ALLOCA
# ifndef __GNUC__
# ifdef _MSC_VER
# include <malloc.h>
# define alloca _alloca
# else
# ifdef HAVE_ALLOCA_H
# include <alloca.h>
# else
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
# endif
# endif /* _AIX */
# endif /* HAVE_ALLOCA_H */
# endif /* _MSC_VER */
# else /* Im a __GNUC__ happy compiler */
#include <stdlib.h>
# endif /* __GNUC__ */
#endif /* HAVE_ALLOCA */
#if !defined(NDEBUG)
#if !defined(__FILE__)
#define __FILE__ "unsupported"
#endif /* __FILE */
#if !defined(__LINE__)
#define __LINE__ -1
#endif /* __LINE__ */
extern void* ftmpi_malloc( size_t, char*, int );
extern void* ftmpi_calloc( size_t, size_t, char*, int );
extern void* ftmpi_realloc( void*, size_t, char*, int );
extern void ftmpi_free( void*, char*, int );
extern void ftmpi_display_memory_usage( void );
#define _MALLOC(size) ftmpi_malloc( (size), __FILE__, __LINE__ )
#define _CALLOC(nb, size) ftmpi_calloc( (nb), (size), __FILE__, __LINE__ )
#define _REALLOC(ptr, size) ftmpi_realloc( (ptr), (size), __FILE__, __LINE__ )
#define _FREE(ptr) ftmpi_free( (ptr), __FILE__, __LINE__ )
#define DUMP_ALLOCATED_MEMORY() ftmpi_display_memory_usage()
#else /* !defined(NDEBUG) */
#include <stdlib.h>
#define _MALLOC(size) malloc((size))
#define _CALLOC(nb, size) calloc((nb), (size))
#define _REALLOC(ptr, size) realloc( (ptr), (size) )
#define _FREE(ptr) free((ptr))
#define DUMP_ALLOCATED_MEMORY()
#endif /* NDEBUG */
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* DEBUG_H_HAS_BEEN_INCLUDED */

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

@ -1,213 +0,0 @@
/*
* 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"
#if !defined(NDEBUG)
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
typedef struct __mem_allocator smemAllocator_t;
#define VALIDATOR 0xdeadbeaf
/* #define EXTREME_DEBUG */
#ifdef EXTREME_DEBUG
#define ZEROS_FOLLOW 1024
#else
#define ZEROS_FOLLOW 0
#endif /* EXTREME_DEBUG */
#define VALUE_CHAR 0xbe
struct __mem_allocator {
smemAllocator_t* prev;
smemAllocator_t* next;
unsigned int lineno;
unsigned int validator;
char* pFileName;
unsigned int length;
int index;
};
static int __alloc_index = 0;
static smemAllocator_t* pdllmem = NULL;
#ifdef EXTREME_DEBUG
static int __overflow_detection( smemAllocator_t* pTemp )
{
int i;
unsigned char* pchar = ((char*)&pTemp[1]) + pTemp->length;
for( i = 0; i < ZEROS_FOLLOW; i++ ) {
if( pchar[i] != VALUE_CHAR ) {
printf( "buffer overflow detected at position %d(%p) on memory allocated in %s at line %d (pointer %p size %d) \n",
i, pchar + i, pTemp->pFileName, pTemp->lineno, ((char*)pTemp) + sizeof(smemAllocator_t), pTemp->length );
return -1;
}
}
return 0;
}
#endif /* EXTREME_DEBUG */
void* ftmpi_malloc( size_t size, char* file, int lineno )
{
size_t totalLength = 0;
smemAllocator_t* pTemp;
totalLength = sizeof( smemAllocator_t ) + size + ZEROS_FOLLOW;
pTemp = (smemAllocator_t*)malloc( totalLength );
if( pTemp == NULL ) return NULL;
pTemp->length = size;
pTemp->validator = VALIDATOR;
pTemp->pFileName = file;
pTemp->lineno = lineno;
pTemp->index = __alloc_index++;
if( pdllmem == NULL ) {
pdllmem = pTemp;
pTemp->next = pTemp;
pTemp->prev = pTemp;
} else {
pdllmem->prev->next = pTemp;
pTemp->prev = pdllmem->prev;
pTemp->next = pdllmem;
pdllmem->prev = pTemp;
}
#ifdef EXTREME_DEBUG
memset( ((char*)pTemp) + sizeof(smemAllocator_t) + pTemp->length, VALUE_CHAR, ZEROS_FOLLOW );
#endif /* EXTREME_DEBUG */
return (void*)&pTemp[1];
}
void* ftmpi_calloc( size_t number, size_t size, char* file, int lineno )
{
size_t totalLength = 0;
smemAllocator_t* pTemp;
totalLength = sizeof( smemAllocator_t ) + number * size + ZEROS_FOLLOW;
pTemp = (smemAllocator_t*)calloc( 1, totalLength );
pTemp->length = number * size;
pTemp->validator = VALIDATOR;
pTemp->pFileName = file;
pTemp->lineno = lineno;
pTemp->index = __alloc_index++;
if( pdllmem == NULL ) {
pdllmem = pTemp;
pTemp->next = pTemp;
pTemp->prev = pTemp;
} else {
pdllmem->prev->next = pTemp;
pTemp->prev = pdllmem->prev;
pTemp->next = pdllmem;
pdllmem->prev = pTemp;
}
#ifdef EXTREME_DEBUG
memset( ((char*)pTemp) + sizeof(smemAllocator_t) + pTemp->length, VALUE_CHAR, ZEROS_FOLLOW );
#endif /* EXTREME_DEBUG */
return (void*)&pTemp[1];
}
void* ftmpi_realloc( void* ptr, size_t size, char* file, int lineno )
{
size_t totalLength = 0;
smemAllocator_t* pTemp = (smemAllocator_t*)((char*)ptr - sizeof(smemAllocator_t));
smemAllocator_t *prev, *next, *old;
prev = pTemp->prev;
next = pTemp->next;
old = pTemp;
#ifdef EXTREME_DEBUG
if( __overflow_detection( pTemp ) != 0 ) assert(0);
#endif /* EXTREME_DEBUG */
totalLength = sizeof( smemAllocator_t ) + size + ZEROS_FOLLOW;
pTemp = (smemAllocator_t*)realloc( pTemp, totalLength );
pTemp->length = size;
pTemp->validator = VALIDATOR;
pTemp->pFileName = file;
pTemp->lineno = lineno;
pTemp->index = __alloc_index++;
if( pdllmem == old ) {
if( prev == old ) {
assert( next == old );
prev = next = pTemp;
}
pdllmem = pTemp;
}
prev->next = pTemp;
next->prev = pTemp;
pTemp->prev = prev;
pTemp->next = next;
#ifdef EXTREME_DEBUG
memset( ((char*)pTemp) + sizeof(smemAllocator_t) + pTemp->length, VALUE_CHAR, ZEROS_FOLLOW );
#endif /* EXTREME_DEBUG */
return (void*)&pTemp[1];
}
void ftmpi_free( void* ptr, char* file, int lineno )
{
smemAllocator_t* pTemp = (smemAllocator_t*)((char*)ptr - sizeof(smemAllocator_t));
/* remove it from the allocated memory */
#ifdef EXTREME_DEBUG
if( __overflow_detection( pTemp ) != 0 ) assert(0);
#endif /* EXTREME_DEBUG */
assert( pTemp->prev->next == pTemp );
assert( pTemp->next->prev == pTemp );
pTemp->prev->next = pTemp->next;
pTemp->next->prev = pTemp->prev;
if( pTemp == pdllmem ) {
if( pTemp->next == pTemp ) {
assert( pTemp->prev == pTemp );
pdllmem = NULL;
} else {
pdllmem = pTemp->next;
}
}
assert( pTemp->validator == VALIDATOR );
pTemp->validator = 0;
/* keep this informations to see where the memory has been freed */
pTemp->pFileName = file;
pTemp->lineno = lineno;
/* And now really free the memory */
free( pTemp );
}
void ftmpi_display_memory_usage( void )
{
smemAllocator_t* pTemp = pdllmem;
int totalSize = 0, chunks = 0;
if( pTemp == NULL ) return;
printf( ">> BEGIN MEMORY USAGE and TRACE\n" );
do {
#ifdef EXTREME_DEBUG
if( __overflow_detection( pTemp ) != 0 ) assert(0);
#endif /* EXTREME_DEBUG */
printf( "Allocate %d bytes in file %s at line %d pointer %p index %d\n",
pTemp->length, pTemp->pFileName, pTemp->lineno,
((char*)pTemp + sizeof(smemAllocator_t)), pTemp->index );
chunks++;
totalSize += pTemp->length;
pTemp = pTemp->next;
} while( pTemp != pdllmem );
printf( "Allocated %d chunks of memory with the total size of %d bytes\n",
chunks, totalSize );
printf( ">> END MEMORY USAGE and TRACE\n" );
}
#endif /* NDEBUG */

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

@ -1,272 +0,0 @@
/*
* 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$
*/
/*
HARNESS G_HCORE
Innovative Computer Laboratory,
University of Tennessee,
Knoxville, TN, USA.
harness@cs.utk.edu
--------------------------------------------------------------------------
Authors:
Graham E Fagg <fagg@cs.utk.edu>
--------------------------------------------------------------------------
NOTICE
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby granted
provided that the above copyright notice appear in all copies and
that both the copyright notice and this permission notice appear in
supporting documentation.
Neither the University of Tennessee nor the Authors make any
representations about the suitability of this software for any
purpose. This software is provided ``as is'' without express or
implied warranty.
HARNESS, HARNESS G_HCORE and FT_MPI was funded in part by the
U.S. Department of Energy.
*/
#include "ompi_config.h"
#include "msgbuf.h"
#include "msg.h"
#ifdef WIN32
#include "wincomm.h"
#else
#include "snipe_lite.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <netinet/in.h>
/* Note this is a simple (bad) description of a basic header */
/*
0-3 PKMESSAGEVER used to make sure its a packed message.. so if its not, then drop it.... if we can.
4-7 PACKEDMESSAGELEN length of packed data in octets (can be zero but not negative)
8-11 SENDERS ID arbitary id that they specify
12-15 NUMBER OF TAGS if no tags then set to zero
16-((4*ntag)-1) individual tags ...
16+(4*ntag)- Start of packed data.
*/
/* Note to avoid using writeV etc we get a message buffer of our own JUST for packing stuff in and out of */
/* we don't use the msgbuf routines as that effects cache coherency */
char hdrbuf [4096];
/* this routine sends a message down a socket as a complete message */
/* this includes a simple header (sender, tag, length) */
/* if the free flag is set then the message buffer is freed */
/* if free is set then even if its not send it is still freed always */
/* return value is either the total length sent or an error */
/* if the complete amount is not sent then the buffer is not freed */
int send_pkmesg (int send_s,int myid,int ntag,int * tagp,int buf_id,int free_buf)
/* int send_s; socket to send_s */
/* int myid; ID I place in message header */
/* int ntag; Number of Tags in header */
/* int *tagp; pointer to Tags to put in header */
/* int buf_id; message buffer I am sending or if you want to send an EMPTY message send EMPTYMSGBUF */
/* int free_buf; non zero if you want to free the buffer up after a good send */
{
int len = 0;
char * buf_ptr;
int ret = -1;
int *data;
int valid;
int i;
if (buf_id != EMPTYMSGBUF) valid = check_buf (buf_id);
else valid = 1;
if (!valid) return (BADBUFFER);
if (buf_id != EMPTYMSGBUF)
get_msg_buf_info(buf_id,&buf_ptr,&len); /* get buffer info */
else {
buf_ptr = NULL; /* if empty message */
len = 0;
}
data = (int*) hdrbuf;
*data++ = htonl (PKMESSAGEVER);
*data++ = htonl (len);
*data++ = htonl (myid);
*data++ = htonl (ntag);
for (i=0;i<ntag;i++) { /* pack the tags */
*data++ = htonl (tagp[i]);
}
#ifdef VERBOSE
PRINT("TRYING TO SEND %d %d - size %d of buf %d\n",myid,ntag,len, buf_id);
#endif
while(ret < 1){
ret = writeconn(send_s,(char*) hdrbuf,sizeof(int)*(4+ntag));
if(ret <= 0){
if ((buf_id != EMPTYMSGBUF)&&(free_buf)) free_msg_buf(buf_id);
return(ret);
}
if(len > 0){
ret = writeconn(send_s,buf_ptr,len);
if(ret <= 0){
if ((buf_id != EMPTYMSGBUF)&&(free_buf)) free_msg_buf(buf_id);
return(ret);
}
else
if ((buf_id != EMPTYMSGBUF)&&(free_buf)) free_msg_buf(buf_id);
}
}
return(ret);
}
/* recv a packed message and return the buffer of the message / size etc */
/* This route will allocate a buffer if it is needed (i.e. if it has a */
/* payload). */
/* If there isn't enought space for all the tags it drops tags */
/* ntags can be NULL or 0 */
/* if there is a protocol error i.e. protocol versions don't match it bombs */
int recv_pkmesg (int recv_s,int * from,int * ntag,int * tagp,int * buf_id)
{
int len;
char * buf_ptr = NULL;
int *hdata;
int *hdata2;
int size;
int ret;
int client;
int i, j;
int tmp;
int rtags; /* how many tags to receive even if it drops some */
int tbid; /* temp buf id */
#ifdef VERBOSE
PRINT("Atempting to receive from %d via socket %d\n",recv_s, from);
#endif
/* download the data into the header buffer */
hdata = (int*) hdrbuf;
hdata2 = (int*) hdrbuf;
ret = readconn(recv_s,(char*)hdata,sizeof(int)*4);
if(!ret){
return(ret);
}
tmp = ntohl(hdata[0]);
if (tmp != PKMESSAGEVER) { /* Header check */
#ifdef VERBOSE
printf("Recv_pkmesg has received a message with an incorrect hdr [0x%x]\n", hdata[0]);
#endif
return (MSG_BAD_HEADER);
}
size = ntohl(hdata[1]);
client = ntohl(hdata[2]);
rtags = ntohl(hdata[3]);
#ifdef VERBOSE
printf("header 0x%x size %d from %d ntags %d\n",
tmp, size, client, rtags);
#endif
/* now we have a copy of the header we can overwrite the headerbuffer */
/* download the message tags into the header buffer */
if (rtags>0) {
hdata2 = (int*) hdrbuf;
ret = readconn(recv_s,(char*)hdata2,sizeof(int)*rtags);
if(!ret){
return(ret);
}
}
/* ok copy over the ones we have been given space for */
/* check to see if we are even excepting tags first ! */
if (ntag) {
j = *ntag;
if (j>rtags) j=rtags;
for(i=0;i<j;i++) {
*tagp = ntohl(*hdata2);
tagp++;
hdata2++;
}
/* NOTE we only do the conversion on the ones we keep. Saves a few usecs? */
/* return the number of tags copied down */
*ntag = j;
}
else
j = 0; /* no tags copied */
/* copy across the return info */
/* senders id */
if (from) *from = client;
/* if no data (payload) to copy in, return outa here */
if(size == 0){
if (buf_id) *buf_id = EMPTYMSGBUF;
return(0);
}
/* get a buffer for the incoming data */
/* the buffer must be resizable */
/* i.e. we need a buffer, resize one if needed */
/* Also we reset the unpack len (toend) value automatically on it */
tbid = get_msg_buf_of_size(size, 1, 1);
get_msg_buf_info(tbid, &buf_ptr, &len); /* get the buffers ptr */
ret = readconn(recv_s, buf_ptr, size); /* read socket into buffer */
/* now we need to return the buffer id */
/* if its been given a NULL pointer we blow it away */
if (!buf_id) { /* a null return address! */
#ifdef VERBOSE
printf("Recv_pkmesg has a valid buffer but a NULL return address!\n");
#endif
free_msg_buf (tbid); /* blow it away */
}
else
*buf_id = tbid; /* return it */
return(ret); /* return read data length */
}

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

@ -1,62 +0,0 @@
/*
* 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$
*/
/*
HARNESS G_HCORE
Innovative Computer Laboratory,
University of Tennessee,
Knoxville, TN, USA.
harness@cs.utk.edu
--------------------------------------------------------------------------
Authors:
Graham E Fagg <fagg@cs.utk.edu>
--------------------------------------------------------------------------
NOTICE
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby granted
provided that the above copyright notice appear in all copies and
that both the copyright notice and this permission notice appear in
supporting documentation.
Neither the University of Tennessee nor the Authors make any
representations about the suitability of this software for any
purpose. This software is provided ``as is'' without express or
implied warranty.
HARNESS, HARNESS G_HCORE and FT_MPI was funded in part by the
U.S. Department of Energy.
*/
#ifndef _GHCORE_MSG_H
#define _GHCORE_MSG_H 1
#define EMPTYMSGBUF -1812
#define MSG_BAD_HEADER -1111
#define PKMESSAGEVER 0xABCD
int send_pkmesg (int send_s,int myid,int ntag,int * tagp,int buf_id,int free_buf);
int recv_pkmesg (int recv_s,int * from,int * ntag,int * tagp,int * buf_id);
#endif /* _GHCORE_MSG_H */

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

@ -1,168 +0,0 @@
/*
* 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$
*/
/*
HARNESS G_HCORE
HARNESS FT_MPI
Innovative Computer Laboratory,
University of Tennessee,
Knoxville, TN, USA.
harness@cs.utk.edu
--------------------------------------------------------------------------
Authors:
Graham E Fagg <fagg@cs.utk.edu>
--------------------------------------------------------------------------
NOTICE
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby granted
provided that the above copyright notice appear in all copies and
that both the copyright notice and this permission notice appear in
supporting documentation.
Neither the University of Tennessee nor the Authors make any
representations about the suitability of this software for any
purpose. This software is provided ``as is'' without express or
implied warranty.
HARNESS, HARNESS G_HCORE and FT_MPI was funded in part by the
U.S. Department of Energy.
*/
#ifndef _GHCORE_MSGBUF_H
#define _GHCORE_MSGBUF_H 1
/*
message packing/unpacking routines
*/
/* Uncomment the following line to enable msgbuf V2.0 */
#define MSG_BUF_V2
#ifdef MSG_BUF_V2
#define _msg_resize_buf _hn_msg_resize_buf
#define init_msg_bufs hn_init_msg_bufs
#define dump_msg_bufs hn_dump_msg_bufs
#define check_buf hn_check_buf
#define get_msg_buf_info hn_get_msg_buf_info
#define get_msg_buf hn_get_msg_buf
#define set_unpksize hn_set_unpksize
#define get_msg_buf_of_size hn_get_msg_buf_of_size
#define free_msg_buf hn_free_msg_buf
#define end_msg_buf hn_end_msg_buf
#define pk_int8 hn_pk_int8
#define pk_int16 hn_pk_int16
#define pk_int32 hn_pk_int32
#define pk_raw32 hn_pk_raw32
#define pk_int64 hn_pk_int64
#define pk_int128 hn_pk_int128
#define pk_real32 hn_pk_real32
#define pk_real64 hn_pk_real64
#define pk_byte hn_pk_byte
#define pk_string hn_pk_string
#define upk_int8 hn_upk_int8
#define upk_int16 hn_upk_int16
#define upk_int32 hn_upk_int32
#define upk_raw32 hn_upk_raw32
#define upk_int64 hn_upk_int64
#define upk_int128 hn_upk_int128
#define upk_real32 hn_upk_real32
#define upk_real64 hn_upk_real64
#define upk_byte hn_upk_byte
#define upk_string hn_upk_string
#endif
int init_msg_bufs (); /* must call first */
int get_msg_buf_info (int buf,char ** base,int * len); /* get info on buf */
int get_msg_buf (int resizable ); /* get a free buf */
int get_msg_buf_of_size (unsigned long reqsize,int resize,int setunpksize); /* get a free buf that is a particular size */
int free_msg_buf (int buf); /* free a buf */
int check_buf (int buf); /* valid buf ? */
int dump_msg_bufs (); /* dump msg buf information */
int end_msg_buf (); /* free ALL bufs */
/* pack and unpack binary data */
int pk_byte (int buf,void * ptr,long n);
int upk_byte (int buf,void * ptr,long n);
int pk_raw32 (int buf,void * ptr,long n);
int upk_raw32 (int buf,void * ptr,long n);
/* pack basic integer types */
int pk_int8 (int buf,void * ptr,long n);
int pk_int16 (int buf,void * ptr,long n);
int pk_int32 (int buf,void * ptr,long n);
int pk_int64 (int buf,void * ptr,long n);
int pk_int128 (int buf,void * ptr,long n);
/* pack real numbers */
int pk_real32 (int buf,void * ptr,long n);
int pk_real64 (int buf,void * ptr,long n);
/* unpack basic integer types */
int upk_int8 (int buf,void * ptr,long n);
int upk_int16 (int buf,void * ptr,long n);
int upk_int32 (int buf,void * ptr,long n);
int upk_int64 (int buf,void * ptr,long n);
int upk_int128 (int buf,void * ptr,long n);
/* unpack real numbers */
int upk_real32 (int buf,void * ptr,long n);
int upk_real64 (int buf,void * ptr,long n);
/* handles strings */
/* note this takes NULL terminated strings and returns null terminated strings */
int pk_string (int buf,char *strptr);
int upk_string (int buf,void * strptr,long maxlen);
/* error codes (i.e. rather than just -1) */
#define BADBUFFER -2010 /* bad buffer id */
#define OUTOFBUFFERS -2011 /* no free msg buffers free */
#define OUTOFMEMORY -2012 /* cannot allocate any more memory for message buffers */
#define BADLUCK -13 /* no comment */
#define BADPARM -2014 /* other parameters are bad/invalid pointers */
#define BADDATA -2015 /* to/from data addr is bad (null etc) */
#endif /* _GHCORE_MSGBUF_H */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,128 +0,0 @@
/*
* 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$
*/
/*
HARNESS G_HCORE
Innovative Computer Laboratory,
University of Tennessee,
Knoxville, TN, USA.
harness@cs.utk.edu
--------------------------------------------------------------------------
Authors: Graham Fagg <fagg@cs.utk.edu>
--------------------------------------------------------------------------
NOTICE
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby granted
provided that the above copyright notice appear in all copies and
that both the copyright notice and this permission notice appear in
supporting documentation.
Neither the University of Tennessee nor the Authors make any
representations about the suitability of this software for any
purpose. This software is provided ``as is'' without express or
implied warranty.
HARNESS, HARNESS G_HCORE and FT_MPI was funded in part by the
U.S. Department of Energy.
*/
/*
SNIPE_LITE was part of the SNIPE experimental metacomputing system
the comms library was a non threaded 'get the message there' TCP
library that is a little more carefull than the cs340 socketfun stuff
Incept for this code was in 1998.
*/
#ifndef _SNIPE_LITE_H
#define _SNIPE_LITE_H 1
/* Syslog facility for snipe_lite */
#include "syslog.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
extern syslog_t* slsyslog;
/*
Create listening socket etc
*/
int setportconn (int *s,int port,int range) ;
int allowconn (int s,int fe,int * spid);
int probeconn (int s,int fe,int * spid);
int pollconn (int s,int dir,int tout);
/*
Client connect
*/
int getconn (char * host,int * port,int search); /* by host name */
int getconn_addr (unsigned long addr,int * port,int search); /* by sa_addr */
/*
Close by either side
*/
int closeconn (int s);
/*
Stream based blocking send/recv operations
*/
int writeconn (int s,char * data,int len);
int readconn (int s,char * data,int len);
/*
Message based/styled communications
*/
int writemsgconn (int s,char * data,int len);
int readmsgconn (int s,char * data,int mlen);
void nodelay(int s); /* hack routine to improve performance.. maybe */
void setnonblocking(int s); /* sets the given socket non-blocking */
void setblocking(int s); /* sets the given socket blocking again */
int setsendrecvbufs(int s, int bufsize); /* Sets send/recv buffer sizes */
int free_default_name(void);
char *getHostnameByAddr(int addr);
/* Benchmarking ops */
double sec_time(void);
/* defines */
/* these needs to be set per daemon type really */
#ifdef IMA_LINUX
#include <sys/socket.h>
#define LISTENBACKLOG SOMAXCONN
#else
#define LISTENBACKLOG 128
#endif
int get_my_addr( char** pdefault_name );
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* _SNIPE_LITE_H */

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

@ -1,211 +0,0 @@
/*
* 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 "syslog.h"
#include "debug.h"
#include <stdarg.h>
#include <stdlib.h>
typedef struct _log_flags {
char* name;
char* optname;
syslog_t** syslog;
} log_flag_t;
struct syslog_t {
char* name;
int level;
FILE* output;
int private_id;
};
static log_flag_t logFlags[] = {
{ "CONN", "conn", &LOG_CONN },
{ "RESTART", "restart", &LOG_RESTART },
{ "NOTIFIER", "not", &LOG_NOTIFIER },
{ "MPI", "mpi", &LOG_MPI },
{ "CALLBACK", "callback", &LOG_CALLBACK },
{ "DDT", "ddt", &LOG_DDT },
{ "IOVEC", "iovec", &LOG_IOVEC },
{ "SNIPE2", "snipe2", &LOG_SNIPE2 },
{ "SYS", "sys", &LOG_SYS }
};
syslog_t* conn_syslog = NULL; /* connection stuff */
syslog_t* restart_syslog = NULL; /* restart messages */
syslog_t* mpi_syslog = NULL; /* high level messages */
syslog_t* notif_syslog = NULL; /* communications with the notifier */
syslog_t* cb_syslog = NULL; /* callback functions */
syslog_t* ddt_syslog = NULL; /* ddt stuff */
syslog_t* iovec_syslog = NULL; /* iovec informations */
syslog_t* snipe2_syslog = NULL; /* snipe2 information */
syslog_t* sys_syslog = NULL; /* system messages */
int ftmpi_syslog_init( int private_id )
{
char envName[128];
char *pEnv, *pFileEnv;
int i, pos = 0;
pEnv = getenv( "HARNESS_FTMPI_DEBUG" );
if( pEnv == NULL ) return 0;
while( 1 ) {
if( pEnv[pos] == ' ' ) continue;
for( i = 0; i < (sizeof(logFlags) / sizeof(log_flag_t)); i++ ) {
if( strcmp( pEnv, logFlags[i].optname ) == 0 ) {
/* one of the flags is present */
sprintf( envName, "HARNESS_FTMPI_%s_FILE", logFlags[i].name );
pFileEnv = getenv( envName );
if( pFileEnv == NULL )
*(logFlags[i].syslog) = syslog_init( NULL, private_id, 100 );
else {
FILE* pf = fopen( pFileEnv, "w" );
if( pf == NULL ) {
fprintf( stderr, "Unable to open the file %s\n", pFileEnv );
} else {
*(logFlags[i].syslog) = syslog_init( pf, private_id, 100 );
}
}
pos += strlen(logFlags[i].optname);
break;
}
}
while( 1 ) {
if( pEnv[pos] == '\0' ) return 1;
if( pEnv[pos] == ',' ) pos++;
else if( pEnv[pos] == ' ' ) pos++;
else break;
}
}
return 1;
}
syslog_t* syslog_init( FILE* output, int private_id, int level )
{
syslog_t* pSyslog = _MALLOC( sizeof(struct syslog_t) );
if( output == NULL ) pSyslog->output = stderr;
else pSyslog->output = output;
pSyslog->level = level;
pSyslog->private_id = private_id;
/* unsigned int activeFlags = LOG_RESTART|LOG_CONN|LOG_SYS|LOG_SNIPE2; */
return pSyslog;
}
int syslog_close( syslog_t** pSyslog )
{
if( (*pSyslog) == NULL ) return 0;
fflush( (*pSyslog)->output );
_FREE( (*pSyslog) );
*pSyslog = NULL;
return 0;
}
void syslog_hint( syslog_t* pSyslog, const unsigned int level, const char* file, int lineno, const char* fmt, ... )
{
va_list list;
if( pSyslog == NULL ) return;
if( level < pSyslog->level ) return;
fprintf( pSyslog->output, "%x-%s:%d [H-%s] ", pSyslog->private_id, file, lineno, pSyslog->name );
va_start( list, fmt );
vfprintf( pSyslog->output, fmt, list );
va_end( list );
}
void syslog_warning( syslog_t* pSyslog, const char* file, int lineno, const char* fmt, ... )
{
va_list list;
FILE* output;
int id = 0;
char* name = "UNKN";
if( pSyslog == NULL ) output = stderr;
else {
output = pSyslog->output;
id = pSyslog->private_id;
name = pSyslog->name;
}
fprintf( output, "%x-%s:%d [W-%s] ", id, file, lineno, name );
va_start( list, fmt );
vfprintf( output, fmt, list );
va_end( list );
}
void syslog_fatal( syslog_t* pSyslog, const char* file, int lineno, const char* fmt, ... )
{
va_list list;
FILE* output;
int id = 0;
char* name = "UNKN";
if( pSyslog == NULL ) output = stderr;
else {
output = pSyslog->output;
id = pSyslog->private_id;
name = pSyslog->name;
}
fprintf( output, "%x-%s:%d [F-%s] ", id, file, lineno, name );
va_start( list, fmt );
vfprintf( output, fmt, list );
va_end( list );
#if !defined(NDEBUG)
{
int* l = NULL;
*l = 0; /* generate a SEGV could be trapped with a debugger */
}
#endif /* NDEBUG */
}
#if !defined(NDEBUG)
# if !defined(__GNUC__) && !defined(ACCEPT_C99)
/* Simple case as the compiler thas not support macros with
* a variable number of arguments.
*/
void HINT( syslog_t* psyslog, const unsigned int flags, const char* fmt, ... )
{
va_list list;
va_start( list, fmt );
syslog_hint( flags, "unknown", -1, fmt, list );
va_end( list );
}
# endif /* !defined(__GNUC__) && !defined(ACCEPT_C99) */
#endif /* NDEBUG */
#if !defined(__GNUC__) && !defined(ACCEPT_C99)
void WARNING( syslog_t* psyslog, const unsigned int flags, const char* fmt, ... )
{
va_list list;
va_start( list, fmt );
syslog_warning( flags, "unknown", -1, fmt, list );
va_end( list );
}
void FATAL( syslog_t* psyslog, const unsigned int flags, const char* fmt, ... )
{
va_list list;
va_start( list, fmt );
syslog_fatal( flags, "unknown", -1, fmt, list );
va_end( list );
}
#endif /* !defined(__GNUC__) && !defined(ACCEPT_C99) */

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

@ -1,132 +0,0 @@
/*
* 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 SYSLOG_H_HAS_BEEN_INCLUDED
#define SYSLOG_H_HAS_BEEN_INCLUDED
#include "debug.h"
typedef struct syslog_t syslog_t;
#define LOG_CONN conn_syslog /* connection stuff */
#define LOG_RESTART restart_syslog /* restart messages */
#define LOG_MPI mpi_syslog /* high level messages */
#define LOG_NOTIFIER notif_syslog /* communications with the notifier */
#define LOG_CALLBACK cb_syslog /* callback functions */
#define LOG_DDT ddt_syslog /* ddt stuff */
#define LOG_IOVEC iovec_syslog /* iovec informations */
#define LOG_SNIPE2 snipe2_syslog /* snipe2 information */
#define LOG_SYS sys_syslog /* system messages */
extern syslog_t* conn_syslog; /* connection stuff */
extern syslog_t* restart_syslog; /* restart messages */
extern syslog_t* mpi_syslog; /* high level messages */
extern syslog_t* notif_syslog; /* communications with the notifier */
extern syslog_t* cb_syslog; /* callback functions */
extern syslog_t* ddt_syslog; /* ddt stuff */
extern syslog_t* iovec_syslog; /* iovec informations */
extern syslog_t* snipe2_syslog; /* snipe2 information */
extern syslog_t* sys_syslog; /* system messages */
extern syslog_t* syslog_init( FILE* output, int private_id, int level );
extern void syslog_hint( syslog_t* syslog, const unsigned int level,
const char* file, int lineno,
const char* fmt, ... );
extern void syslog_warning( syslog_t* syslog,
const char* file, int lineno,
const char* fmt, ... );
extern void syslog_fatal( syslog_t* syslog,
const char* file, int lineno,
const char* fmt, ... );
#if defined(NDEBUG)
# if defined(__GNUC__)
# define DO_DEBUG(args...)
# define HINT( SYSLOG, LEVEL, FMT...)
# define WARNING( SYSLOG, FMT... ) syslog_warning( (SYSLOG), __FILE__, __LINE__, ##FMT )
# define FATAL( SYSLOG, FMT... ) syslog_fatal( (SYSLOG), __FILE__, __LINE__, ##FMT )
# else
# if defined(ACCEPT_C99)
# define DO_DEBUG( ... )
# define HINT( SYSLOG, LEVEL, args... )
# define WARNING( SYSLOG, FMT, args... ) syslog_warning( (SYSLOG), __FILE__, __LINE__, (FMT), __VA_ARGS__ )
# define FATAL( SYSLOG, FMT, args... ) syslog_fatal( (SYSLOG), __FILE__, __LINE__, (FMT), __VA_ARGS__ )
# else
# define DO_DEBUG( Args )
static void HINT( syslog_t* syslog, const unsigned int level, const char* fmt, ... ) { /* empty hopefully removed by the compiler */};
extern void WARNING( syslog_t* syslog, const char* fmt, ... );
extern void FATAL( syslog_t* syslog, const char* fmt, ... );
# endif /* ACCEPT_C99 */
# endif /* __GNUC__ */
#else /* NDEBUG not defined */
# if defined(__GNUC__)
# define DO_DEBUG(args...) args
# define HINT( SYSLOG, LEVEL, FMT, args...) if( (SYSLOG) != NULL ) syslog_hint( (SYSLOG), (LEVEL), __FILE__, (int)__LINE__, FMT, ##args )
# define WARNING( SYSLOG, FMT, args... ) syslog_warning( (SYSLOG), __FILE__, __LINE__, (FMT), ##args )
# define FATAL( SYSLOG, FMT, args... ) syslog_fatal( (SYSLOG), __FILE__, __LINE__, (FMT), ##args )
# else
# if defined(ACCEPT_C99)
# define DO_DEBUG( ... ) __VA_ARGS__
# define HINT( SYSLOG, LEVEL, args... ) if( (SYSLOG) != NULL ) syslog_hint( (SYSLOG), (LEVEL), __FILE__, (int)__LINE__, __VA_ARGS__ )
# define WARNING( SYSLOG, FMT, args... ) syslog_warning( (SYSLOG), __FILE__, __LINE__, (FMT), __VA_ARGS__ )
# define FATAL( SYSLOG, FMT, args... ) syslog_fatal( (SYSLOG), __FILE__, __LINE__, (FMT), __VA_ARGS__ )
# else
# define DO_DEBUG( Args ) Args
extern void HINT( syslog_t* syslog, const unsigned int level, const char* fmt, ... );
extern void WARNING( syslog_t* syslog, const char* fmt, ... );
extern void FATAL( syslog_t* syslog, const char* fmt, ... );
# endif /* ACCEPT_C99 */
# endif /* __GNUC__ */
#endif /* NDEBUG */
#include <sys/socket.h>
#include <string.h>
#include <stdio.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
extern int errno;
#define DUMP_SOCKET_ERROR(SOCK, ERRNO) \
do { \
struct sockaddr_in sockname; \
socklen_t length = sizeof(struct sockaddr); \
\
if( getpeername( (SOCK), (struct sockaddr*)&sockname, &length ) == 0 ) { \
WARNING( LOG_CONN, "sock %d [%s:%d] generate error %d %s\n", \
(SOCK), inet_ntoa(sockname.sin_addr), sockname.sin_port, \
(ERRNO), strerror((ERRNO)) ); \
} else { \
WARNING( LOG_CONN, "unable to get the peer name on socket %d. error %d %s\n", \
(SOCK), errno, strerror(errno) ); \
if( (ERRNO) != 0 ) \
WARNING( LOG_CONN, " initial error was %d:%s\n", (ERRNO), strerror((ERRNO)) ); \
} \
} while (0)
#define DUMP_SOCKET_INFO(LOGGING, SOCK, SSTR, ESTR) \
do { \
struct sockaddr_in sockname; \
socklen_t length = sizeof(struct sockaddr); \
\
if( getpeername( (SOCK), (struct sockaddr*)&sockname, &length ) == 0 ) { \
HINT( LOGGING, 10, " %s sock %d [%s:%d] %s", (SSTR), \
(SOCK), inet_ntoa(sockname.sin_addr), sockname.sin_port, (ESTR) ); \
} else { \
HINT( LOGGING, 10, " unable to get the peer name on socket %d. error %d %s\n", \
(SOCK), errno, strerror(errno) ); \
HINT( LOGGING, 10, " %s sock %d [??:??] %s", (SSTR), (SOCK), (ESTR) ); \
} \
} while (0)
#endif /* SYSLOG_H_HAS_BEEN_INCLUDED */

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

@ -1,21 +0,0 @@
#
# 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 $(top_ompi_srcdir)/config/Makefile.options
noinst_LTLIBRARIES = libmca_svc_stdio.la
libmca_svc_stdio_la_SOURCES = \
svc_stdio.c \
svc_stdio.h \
svc_stdio_component.c

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

@ -1,19 +0,0 @@
# -*- 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=svc_stdio.c
PARAM_CONFIG_FILES="Makefile"

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

@ -1,65 +0,0 @@
/*
* 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 "include/constants.h"
#include "mca/oob/oob.h"
#include "mca/oob/base/base.h"
#include "svc_stdio.h"
mca_svc_base_module_t mca_svc_stdio_module = {
mca_svc_stdio_module_init,
mca_svc_stdio_module_fini
};
/**
* Process an OOB request.
*/
static void mca_svc_stdio_recv(
int status,
ompi_process_name_t* peer,
ompi_buffer_t buffer,
int tag,
void* cbdata)
{
}
/**
* Register a callback to receive OOB requests.
*/
int mca_svc_stdio_module_init(mca_svc_base_module_t* module)
{
return mca_oob_recv_packed_nb(
MCA_OOB_NAME_ANY,
MCA_OOB_TAG_STDIO,
MCA_OOB_ALLOC,
mca_svc_stdio_recv,
NULL);
}
/**
* Cleanup
*/
int mca_svc_stdio_module_fini(mca_svc_base_module_t* module)
{
return OMPI_SUCCESS;
}

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

@ -1,46 +0,0 @@
/*
* 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$
*/
/**
* @file
*/
#ifndef _MCA_SVC_STDIO_
#define _MCA_SVC_STDIO_
#include "mca/svc/svc.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
/**
* Component open/close/init
*/
int mca_svc_stdio_component_open(void);
int mca_svc_stdio_component_close(void);
mca_svc_base_module_t* mca_svc_stdio_component_init(void);
/**
* Module init/fini
*/
int mca_svc_stdio_module_init(mca_svc_base_module_t*);
int mca_svc_stdio_module_fini(mca_svc_base_module_t*);
extern mca_svc_base_module_t mca_svc_stdio_module;
extern mca_svc_base_component_t mca_svc_stdio_component;
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif

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

@ -1,77 +0,0 @@
/*
* 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 "include/constants.h"
#include "svc_stdio.h"
mca_svc_base_component_t mca_svc_stdio_component = {
/* First, the mca_base_module_t struct containing meta
information about the module itself */
{
/* Indicate that we are a pml v1.0.0 module (which also
implies a specific MCA version) */
MCA_SVC_BASE_VERSION_1_0_0,
"stdio", /* MCA module name */
1, /* MCA module major version */
0, /* MCA module minor version */
0, /* MCA module release version */
mca_svc_stdio_component_open, /* component open */
mca_svc_stdio_component_close /* component close */
},
/* Next the MCA v1.0.0 module meta data */
{
/* Whether the module is checkpointable or not */
false
},
mca_svc_stdio_component_init
};
/**
*
*/
int mca_svc_stdio_component_open(void)
{
return OMPI_SUCCESS;
}
/**
*
*/
mca_svc_base_module_t* mca_svc_stdio_component_init(void)
{
return &mca_svc_stdio_module;
}
/**
*
*/
int mca_svc_stdio_component_close(void)
{
return OMPI_SUCCESS;
}