[mpich2-commits] r3997 - in mpich2/trunk/src/pm/hydra: bootstrap/ssh bootstrap/utils control/consys demux include launcher/mpiexec launcher/utils pm/central pm/utils utils/dbg utils/env utils/launch utils/signals utils/sock
balaji at mcs.anl.gov
balaji at mcs.anl.gov
Tue Mar 10 03:50:37 CDT 2009
Author: balaji
Date: 2009-03-10 03:50:37 -0500 (Tue, 10 Mar 2009)
New Revision: 3997
Added:
mpich2/trunk/src/pm/hydra/include/hydra_base.h
mpich2/trunk/src/pm/hydra/include/hydra_utils.h
Removed:
mpich2/trunk/src/pm/hydra/include/hydra_dbg.h
mpich2/trunk/src/pm/hydra/include/hydra_env.h
mpich2/trunk/src/pm/hydra/include/hydra_launch.h
mpich2/trunk/src/pm/hydra/include/hydra_mem.h
mpich2/trunk/src/pm/hydra/include/hydra_sig.h
mpich2/trunk/src/pm/hydra/include/hydra_sock.h
Modified:
mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_finalize.c
mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_launch.c
mpich2/trunk/src/pm/hydra/bootstrap/utils/bscu.h
mpich2/trunk/src/pm/hydra/bootstrap/utils/bscu_signal.c
mpich2/trunk/src/pm/hydra/bootstrap/utils/bscu_wait.c
mpich2/trunk/src/pm/hydra/control/consys/consys_close.c
mpich2/trunk/src/pm/hydra/control/consys/consys_launch.c
mpich2/trunk/src/pm/hydra/demux/demux.c
mpich2/trunk/src/pm/hydra/include/hydra.h
mpich2/trunk/src/pm/hydra/launcher/mpiexec/callback.c
mpich2/trunk/src/pm/hydra/launcher/mpiexec/mpiexec.c
mpich2/trunk/src/pm/hydra/launcher/mpiexec/utils.c
mpich2/trunk/src/pm/hydra/launcher/utils/lchu.c
mpich2/trunk/src/pm/hydra/pm/central/central_cb.c
mpich2/trunk/src/pm/hydra/pm/central/central_launch.c
mpich2/trunk/src/pm/hydra/pm/central/proxy.c
mpich2/trunk/src/pm/hydra/pm/central/proxy_cb.c
mpich2/trunk/src/pm/hydra/pm/utils/pmcu_pmi.h
mpich2/trunk/src/pm/hydra/pm/utils/pmi.c
mpich2/trunk/src/pm/hydra/utils/dbg/dbg.c
mpich2/trunk/src/pm/hydra/utils/env/env.c
mpich2/trunk/src/pm/hydra/utils/launch/allocate.c
mpich2/trunk/src/pm/hydra/utils/launch/args.c
mpich2/trunk/src/pm/hydra/utils/launch/launch.c
mpich2/trunk/src/pm/hydra/utils/signals/signals.c
mpich2/trunk/src/pm/hydra/utils/sock/sock.c
Log:
Move the base utilities and types into a hydra_base.h header and common
utilities to a hydra_utils.h header. These do not depend on any other
part of the code and can be used in any process/function.
Modified: mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_finalize.c
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_finalize.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_finalize.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,7 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_mem.h"
+#include "hydra_utils.h"
#include "bsci.h"
#include "bscu.h"
Modified: mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_launch.c
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_launch.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/bootstrap/ssh/ssh_launch.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,9 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_sock.h"
-#include "hydra_mem.h"
-#include "hydra_launch.h"
+#include "hydra_utils.h"
#include "bsci.h"
#include "bscu.h"
Modified: mpich2/trunk/src/pm/hydra/bootstrap/utils/bscu.h
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/utils/bscu.h 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/bootstrap/utils/bscu.h 2009-03-10 08:50:37 UTC (rev 3997)
@@ -8,7 +8,7 @@
#define BSCU_H_INCLUDED
#include "hydra.h"
-#include "hydra_sig.h"
+#include "hydra_utils.h"
#include "bsci.h"
HYD_Status HYD_BSCU_Wait_for_completion(void);
Modified: mpich2/trunk/src/pm/hydra/bootstrap/utils/bscu_signal.c
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/utils/bscu_signal.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/bootstrap/utils/bscu_signal.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,7 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_sig.h"
+#include "hydra_utils.h"
#include "bsci.h"
#include "bscu.h"
Modified: mpich2/trunk/src/pm/hydra/bootstrap/utils/bscu_wait.c
===================================================================
--- mpich2/trunk/src/pm/hydra/bootstrap/utils/bscu_wait.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/bootstrap/utils/bscu_wait.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,7 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_mem.h"
+#include "hydra_utils.h"
#include "bsci.h"
#include "bscu.h"
Modified: mpich2/trunk/src/pm/hydra/control/consys/consys_close.c
===================================================================
--- mpich2/trunk/src/pm/hydra/control/consys/consys_close.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/control/consys/consys_close.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,7 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_dbg.h"
+#include "hydra_utils.h"
#include "csi.h"
#include "pmci.h"
#include "bsci.h"
Modified: mpich2/trunk/src/pm/hydra/control/consys/consys_launch.c
===================================================================
--- mpich2/trunk/src/pm/hydra/control/consys/consys_launch.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/control/consys/consys_launch.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,7 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_sock.h"
+#include "hydra_utils.h"
#include "csi.h"
#include "pmci.h"
#include "demux.h"
Modified: mpich2/trunk/src/pm/hydra/demux/demux.c
===================================================================
--- mpich2/trunk/src/pm/hydra/demux/demux.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/demux/demux.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,8 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_sock.h"
-#include "hydra_mem.h"
+#include "hydra_utils.h"
#include "demux.h"
static int num_cb_fds = 0;
Modified: mpich2/trunk/src/pm/hydra/include/hydra.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra.h 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/include/hydra.h 2009-03-10 08:50:37 UTC (rev 3997)
@@ -8,78 +8,9 @@
#define HYDRA_H_INCLUDED
#include <stdio.h>
-#include "mpibase.h"
-#include "hydra_config.h"
+#include "hydra_base.h"
+#include "hydra_utils.h"
-#if defined HAVE_UNISTD_H
-#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-
-#if defined HAVE_STDLIB_H
-#include <stdlib.h>
-#endif /* HAVE_STDLIB_H */
-
-#if defined HAVE_STRING_H
-#include <string.h>
-#endif /* HAVE_STRING_H */
-
-#if defined HAVE_STRINGS_H
-#include <strings.h>
-#endif /* HAVE_STRINGS_H */
-
-#if defined HAVE_STDARG_H
-#include <stdarg.h>
-#endif /* HAVE_STDARG_H */
-
-#if defined HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif /* HAVE_SYS_TYPES_H */
-
-#include <errno.h>
-/* FIXME: Is time.h available everywhere? We should probably have
- * multiple timer options like MPICH2. */
-#include <time.h>
-#include "mpimem.h"
-
-#if defined MAXHOSTNAMELEN
-#define MAX_HOSTNAME_LEN MAXHOSTNAMELEN
-#else
-#define MAX_HOSTNAME_LEN 256
-#endif /* MAXHOSTNAMELEN */
-
-#if defined MANUAL_EXTERN_ENVIRON
-extern char **environ;
-#endif /* MANUAL_EXTERN_ENVIRON */
-
-typedef enum {
- HYD_SUCCESS = 0,
- HYD_NO_MEM,
- HYD_SOCK_ERROR,
- HYD_INVALID_PARAM,
- HYD_INTERNAL_ERROR
-} HYD_Status;
-
-#define HYD_STDOUT (1)
-#define HYD_STDIN (2)
-
-typedef unsigned short HYD_Event_t;
-
-#define HYD_TMPBUF_SIZE (64 * 1024)
-#define HYD_EXEC_ARGS 200
-
-typedef struct HYD_Env {
- char *env_name;
- char *env_value;
- struct HYD_Env *next;
-} HYD_Env_t;
-
-typedef enum {
- HYD_ENV_PROP_UNSET,
- HYD_ENV_PROP_ALL,
- HYD_ENV_PROP_NONE,
- HYD_ENV_PROP_LIST
-} HYD_Env_prop_t;
-
struct HYD_Handle_ {
int debug;
int enablex;
@@ -109,44 +40,8 @@
int exec_proc_count;
char *exec[HYD_EXEC_ARGS];
- struct HYD_Partition_list {
- char *name;
- int proc_count;
- char **mapping; /* Can be core IDs or something else */
+ struct HYD_Partition_list *partition;
- /*
- * The boot-strap server is expected to start a single
- * executable on the first possible node and return a
- * single PID. This executable could be a PM proxy that
- * will launch the actual application on the rest of the
- * partition list.
- *
- * Possible hacks:
- *
- * 1. If the process manager needs more proxies within
- * this same list, it can use different group
- * IDs. Each group ID will have its own proxy.
- *
- * 2. If no proxy is needed, the PM can split this list
- * into one element per process. The boot-strap
- * server itself does not distinguish a proxy from
- * the application executable, so it will not require
- * any changes.
- *
- * 3. One proxy per physical node means that each
- * partition will have a different group ID.
- */
- int group_id; /* Assumed to be in ascending order */
- int group_rank; /* Rank within the group */
- int pid;
- int out;
- int err;
- int exit_status;
- char *args[HYD_EXEC_ARGS];
-
- struct HYD_Partition_list *next;
- } *partition;
-
/* Local environment */
HYD_Env_t *user_env;
HYD_Env_prop_t prop;
@@ -185,62 +80,4 @@
*/
extern HYD_Handle handle;
-#if !defined COMPILER_ACCEPTS_VA_ARGS
-#define HYDU_Print printf
-#else
-#define HYDU_Print(...) \
- { \
- int i; \
- for (i = 0; i < HYDU_Dbg_depth; i++) \
- printf(" "); \
- printf(__VA_ARGS__); \
- }
-#endif /* COMPILER_ACCEPTS_VA_ARGS */
-
-#if !defined ENABLE_DEBUG
-#define HYDU_FUNC_ENTER()
-#define HYDU_FUNC_EXIT()
-#elif defined COMPILER_ACCEPTS_FUNC
-#define HYDU_FUNC_ENTER() \
- { \
- HYDU_Print("Entering function %s\n", __func__); \
- HYDU_Dbg_depth++; \
- }
-#define HYDU_FUNC_EXIT() \
- { \
- HYDU_Print("Exiting function %s\n", __func__); \
- HYDU_Dbg_depth--; \
- }
-#else
-#define HYDU_FUNC_ENTER() \
- { \
- HYDU_Dbg_depth++; \
- }
-#define HYDU_FUNC_EXIT() \
- { \
- HYDU_Dbg_depth--; \
- }
-#endif
-
-#if !defined COMPILER_ACCEPTS_VA_ARGS
-#define HYDU_Error_printf MPIU_Error_printf
-#elif defined COMPILER_ACCEPTS_FUNC && defined __LINE__
-#define HYDU_Error_printf(...) \
- { \
- fprintf(stderr, "%s (%d): ", __func__, __LINE__); \
- MPIU_Error_printf(__VA_ARGS__); \
- }
-#elif defined __FILE__ && defined __LINE__
-#define HYDU_Error_printf(...) \
- { \
- fprintf(stderr, "%s (%d): ", __FILE__, __LINE__); \
- MPIU_Error_printf(__VA_ARGS__); \
- }
-#else
-#define HYDU_Error_printf(...) \
- { \
- MPIU_Error_printf(__VA_ARGS__); \
- }
-#endif
-
#endif /* HYDRA_H_INCLUDED */
Added: mpich2/trunk/src/pm/hydra/include/hydra_base.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra_base.h (rev 0)
+++ mpich2/trunk/src/pm/hydra/include/hydra_base.h 2009-03-10 08:50:37 UTC (rev 3997)
@@ -0,0 +1,141 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ * (C) 2008 by Argonne National Laboratory.
+ * See COPYRIGHT in top-level directory.
+ */
+
+#ifndef HYDRA_BASE_H_INCLUDED
+#define HYDRA_BASE_H_INCLUDED
+
+#include <stdio.h>
+#include "mpibase.h"
+#include "hydra_config.h"
+
+#if defined HAVE_UNISTD_H
+#include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+
+#if defined HAVE_STDLIB_H
+#include <stdlib.h>
+#endif /* HAVE_STDLIB_H */
+
+#if defined HAVE_STRING_H
+#include <string.h>
+#endif /* HAVE_STRING_H */
+
+#if defined HAVE_STRINGS_H
+#include <strings.h>
+#endif /* HAVE_STRINGS_H */
+
+#if defined HAVE_STDARG_H
+#include <stdarg.h>
+#endif /* HAVE_STDARG_H */
+
+#if defined HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif /* HAVE_SYS_TYPES_H */
+
+#include <errno.h>
+/* FIXME: Is time.h available everywhere? We should probably have
+ * multiple timer options like MPICH2. */
+#include <time.h>
+#include "mpimem.h"
+
+#if defined MAXHOSTNAMELEN
+#define MAX_HOSTNAME_LEN MAXHOSTNAMELEN
+#else
+#define MAX_HOSTNAME_LEN 256
+#endif /* MAXHOSTNAMELEN */
+
+#if defined MANUAL_EXTERN_ENVIRON
+extern char **environ;
+#endif /* MANUAL_EXTERN_ENVIRON */
+
+typedef enum {
+ HYD_SUCCESS = 0,
+ HYD_NO_MEM,
+ HYD_SOCK_ERROR,
+ HYD_INVALID_PARAM,
+ HYD_INTERNAL_ERROR
+} HYD_Status;
+
+#define HYD_STDOUT (1)
+#define HYD_STDIN (2)
+
+typedef unsigned short HYD_Event_t;
+
+#define HYD_TMPBUF_SIZE (64 * 1024)
+#define HYD_EXEC_ARGS 200
+
+typedef struct HYD_Env {
+ char *env_name;
+ char *env_value;
+ struct HYD_Env *next;
+} HYD_Env_t;
+
+typedef enum {
+ HYD_ENV_PROP_UNSET,
+ HYD_ENV_PROP_ALL,
+ HYD_ENV_PROP_NONE,
+ HYD_ENV_PROP_LIST
+} HYD_Env_prop_t;
+
+#if !defined COMPILER_ACCEPTS_VA_ARGS
+#define HYDU_Print printf
+#else
+#define HYDU_Print(...) \
+ { \
+ int i; \
+ for (i = 0; i < HYDU_Dbg_depth; i++) \
+ printf(" "); \
+ printf(__VA_ARGS__); \
+ }
+#endif /* COMPILER_ACCEPTS_VA_ARGS */
+
+#if !defined ENABLE_DEBUG
+#define HYDU_FUNC_ENTER()
+#define HYDU_FUNC_EXIT()
+#elif defined COMPILER_ACCEPTS_FUNC
+#define HYDU_FUNC_ENTER() \
+ { \
+ HYDU_Print("Entering function %s\n", __func__); \
+ HYDU_Dbg_depth++; \
+ }
+#define HYDU_FUNC_EXIT() \
+ { \
+ HYDU_Print("Exiting function %s\n", __func__); \
+ HYDU_Dbg_depth--; \
+ }
+#else
+#define HYDU_FUNC_ENTER() \
+ { \
+ HYDU_Dbg_depth++; \
+ }
+#define HYDU_FUNC_EXIT() \
+ { \
+ HYDU_Dbg_depth--; \
+ }
+#endif
+
+#if !defined COMPILER_ACCEPTS_VA_ARGS
+#define HYDU_Error_printf MPIU_Error_printf
+#elif defined COMPILER_ACCEPTS_FUNC && defined __LINE__
+#define HYDU_Error_printf(...) \
+ { \
+ fprintf(stderr, "%s (%d): ", __func__, __LINE__); \
+ MPIU_Error_printf(__VA_ARGS__); \
+ }
+#elif defined __FILE__ && defined __LINE__
+#define HYDU_Error_printf(...) \
+ { \
+ fprintf(stderr, "%s (%d): ", __FILE__, __LINE__); \
+ MPIU_Error_printf(__VA_ARGS__); \
+ }
+#else
+#define HYDU_Error_printf(...) \
+ { \
+ MPIU_Error_printf(__VA_ARGS__); \
+ }
+#endif
+
+#endif /* HYDRA_BASE_H_INCLUDED */
Deleted: mpich2/trunk/src/pm/hydra/include/hydra_dbg.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra_dbg.h 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/include/hydra_dbg.h 2009-03-10 08:50:37 UTC (rev 3997)
@@ -1,12 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; -*- */
-/*
- * (C) 2008 by Argonne National Laboratory.
- * See COPYRIGHT in top-level directory.
- */
-
-#ifndef HYDRA_DBG_H_INCLUDED
-#define HYDRA_DBG_H_INCLUDED
-
-#include "hydra.h"
-
-#endif /* HYDRA_DBG_H_INCLUDED */
Deleted: mpich2/trunk/src/pm/hydra/include/hydra_env.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra_env.h 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/include/hydra_env.h 2009-03-10 08:50:37 UTC (rev 3997)
@@ -1,22 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; -*- */
-/*
- * (C) 2008 by Argonne National Laboratory.
- * See COPYRIGHT in top-level directory.
- */
-
-#ifndef HYDRA_ENV_H_INCLUDED
-#define HYDRA_ENV_H_INCLUDED
-
-#include "hydra.h"
-
-HYD_Status HYDU_Env_global_list(HYD_Env_t ** env_list);
-HYD_Env_t *HYDU_Env_dup(HYD_Env_t env);
-HYD_Env_t *HYDU_Env_listdup(HYD_Env_t * env);
-HYD_Status HYDU_Env_create(HYD_Env_t ** env, char *env_name, char *env_value);
-HYD_Status HYDU_Env_free(HYD_Env_t * env);
-HYD_Status HYDU_Env_free_list(HYD_Env_t * env);
-HYD_Env_t *HYDU_Env_found_in_list(HYD_Env_t * env_list, HYD_Env_t env);
-HYD_Status HYDU_Env_add_to_list(HYD_Env_t ** env_list, HYD_Env_t env);
-HYD_Status HYDU_Env_putenv(HYD_Env_t env);
-
-#endif /* HYDRA_ENV_H_INCLUDED */
Deleted: mpich2/trunk/src/pm/hydra/include/hydra_launch.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra_launch.h 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/include/hydra_launch.h 2009-03-10 08:50:37 UTC (rev 3997)
@@ -1,19 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; -*- */
-/*
- * (C) 2008 by Argonne National Laboratory.
- * See COPYRIGHT in top-level directory.
- */
-
-#ifndef HYDRA_LAUNCH_H_INCLUDED
-#define HYDRA_LAUNCH_H_INCLUDED
-
-#include "hydra.h"
-
-HYD_Status HYDU_Append_env(HYD_Env_t * env_list, char **client_arg, int id);
-HYD_Status HYDU_Append_exec(char **exec, char **client_arg);
-HYD_Status HYDU_Append_wdir(char **client_arg, char *wdir);
-HYD_Status HYDU_Allocate_Partition(struct HYD_Partition_list **partition);
-HYD_Status HYDU_Create_process(char **client_arg, int *in, int *out, int *err, int *pid);
-HYD_Status HYDU_Dump_args(char **args);
-
-#endif /* HYDRA_LAUNCH_H_INCLUDED */
Deleted: mpich2/trunk/src/pm/hydra/include/hydra_mem.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra_mem.h 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/include/hydra_mem.h 2009-03-10 08:50:37 UTC (rev 3997)
@@ -1,83 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; -*- */
-/*
- * (C) 2008 by Argonne National Laboratory.
- * See COPYRIGHT in top-level directory.
- */
-
-#ifndef HYDRA_MEM_H_INCLUDED
-#define HYDRA_MEM_H_INCLUDED
-
-#include "hydra.h"
-
-#define HYDU_NUM_JOIN_STR 100
-
-#define HYDU_MALLOC(p, type, size, status) \
- { \
- (p) = (type) MPIU_Malloc((size)); \
- if ((p) == NULL) { \
- HYDU_Error_printf("failed trying to allocate %d bytes\n", (size)); \
- (status) = HYD_NO_MEM; \
- goto fn_fail; \
- } \
- }
-
-#define HYDU_FREE(p) \
- { \
- MPIU_Free(p); \
- }
-
-#define HYDU_STRDUP(src, dest, type, status) \
- { \
- (dest) = (type) MPIU_Strdup((src)); \
- if ((p) == NULL) { \
- HYDU_Error_printf("failed duping string %s\n", (src)); \
- (status) = HYD_INTERNAL_ERROR; \
- goto fn_fail; \
- } \
- }
-
-#define HYDU_PRINT_ARGS(str) \
- { \
- int i; \
- for (i = 0; (str) != NULL && (str)[i] != NULL; i++) \
- printf("%s ", (str)[i]); \
- printf("\n"); \
- }
-
-#define HYDU_STR_ALLOC_AND_JOIN(strlist, strjoin, status) \
- { \
- int len = 0, i, count; \
- for (i = 0; (strlist)[i] != NULL; i++) \
- len += strlen((strlist)[i]); \
- HYDU_MALLOC((strjoin), char *, len + 1, (status)); \
- count = 0; \
- (strjoin)[0] = 0; \
- for (i = 0; (strlist)[i] != NULL; i++) { \
- MPIU_Snprintf((strjoin) + count, len - count + 1, "%s", (strlist)[i]); \
- count += strlen((strlist)[i]); \
- } \
- }
-
-#define HYDU_Int_to_str(x, str, status) \
- { \
- int len = 1, max = 10, y; \
- if ((x) < 0) { \
- len++; \
- y = -(x); \
- } \
- else \
- y = (x); \
- while (y >= max) { \
- len++; \
- max *= 10; \
- } \
- (str) = (char *) MPIU_Malloc(len + 1); \
- if ((str) == NULL) { \
- HYDU_Error_printf("failed trying to allocate %d bytes\n", len + 1); \
- (status) = HYD_NO_MEM; \
- goto fn_fail; \
- } \
- MPIU_Snprintf((str), len + 1, "%d", (x)); \
- }
-
-#endif /* HYDRA_MEM_H_INCLUDED */
Deleted: mpich2/trunk/src/pm/hydra/include/hydra_sig.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra_sig.h 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/include/hydra_sig.h 2009-03-10 08:50:37 UTC (rev 3997)
@@ -1,28 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; -*- */
-/*
- * (C) 2008 by Argonne National Laboratory.
- * See COPYRIGHT in top-level directory.
- */
-
-#ifndef HYDRA_SIG_H_INCLUDED
-#define HYDRA_SIG_H_INCLUDED
-
-#ifdef NEEDS_POSIX_FOR_SIGACTION
-#define _POSIX_SOURCE
-#endif
-
-#include <sys/wait.h>
-#if defined(USE_SIGNAL) || defined(USE_SIGACTION)
-#include <signal.h>
-#else
-#error no signal choice
-#endif
-#ifdef NEEDS_STRSIGNAL_DECL
-extern char *strsignal(int);
-#endif
-
-#include "hydra.h"
-
-HYD_Status HYDU_Set_signal(int signum, void (*handler) (int));
-
-#endif /* HYDRA_SIG_H_INCLUDED */
Deleted: mpich2/trunk/src/pm/hydra/include/hydra_sock.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra_sock.h 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/include/hydra_sock.h 2009-03-10 08:50:37 UTC (rev 3997)
@@ -1,35 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; -*- */
-/*
- * (C) 2008 by Argonne National Laboratory.
- * See COPYRIGHT in top-level directory.
- */
-
-#ifndef HYDRA_SOCKS_H_INCLUDED
-#define HYDRA_SOCKS_H_INCLUDED
-
-#include "hydra.h"
-
-#include <poll.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-
-#if !defined size_t
-#define size_t unsigned int
-#endif /* size_t */
-
-HYD_Status HYDU_Sock_listen(int *listen_fd, char *port_range, uint16_t * port);
-HYD_Status HYDU_Sock_connect(const char *host, uint16_t port, int *fd);
-HYD_Status HYDU_Sock_accept(int listen_fd, int *fd);
-HYD_Status HYDU_Sock_readline(int fd, char *buf, int maxlen, int *linelen);
-HYD_Status HYDU_Sock_read(int fd, char *buf, int maxlen, int *count);
-HYD_Status HYDU_Sock_writeline(int fd, char *buf, int maxsize);
-HYD_Status HYDU_Sock_write(int fd, char *buf, int maxsize);
-HYD_Status HYDU_Sock_set_nonblock(int fd);
-HYD_Status HYDU_Sock_set_cloexec(int fd);
-HYD_Status HYDU_Sock_stdout_cb(int fd, HYD_Event_t events, int stdout_fd, int *closed);
-HYD_Status HYDU_Sock_stdin_cb(int fd, HYD_Event_t events, char *buf, int *buf_count,
- int *buf_offset, int *closed);
-
-#endif /* HYDRA_SOCKS_H_INCLUDED */
Added: mpich2/trunk/src/pm/hydra/include/hydra_utils.h
===================================================================
--- mpich2/trunk/src/pm/hydra/include/hydra_utils.h (rev 0)
+++ mpich2/trunk/src/pm/hydra/include/hydra_utils.h 2009-03-10 08:50:37 UTC (rev 3997)
@@ -0,0 +1,185 @@
+/* -*- Mode: C; c-basic-offset:4 ; -*- */
+/*
+ * (C) 2008 by Argonne National Laboratory.
+ * See COPYRIGHT in top-level directory.
+ */
+
+#ifndef HYDRA_UTILS_H_INCLUDED
+#define HYDRA_UTILS_H_INCLUDED
+
+#include "hydra_base.h"
+
+
+/* Environment utilities */
+HYD_Status HYDU_Env_global_list(HYD_Env_t ** env_list);
+HYD_Env_t *HYDU_Env_dup(HYD_Env_t env);
+HYD_Env_t *HYDU_Env_listdup(HYD_Env_t * env);
+HYD_Status HYDU_Env_create(HYD_Env_t ** env, char *env_name, char *env_value);
+HYD_Status HYDU_Env_free(HYD_Env_t * env);
+HYD_Status HYDU_Env_free_list(HYD_Env_t * env);
+HYD_Env_t *HYDU_Env_found_in_list(HYD_Env_t * env_list, HYD_Env_t env);
+HYD_Status HYDU_Env_add_to_list(HYD_Env_t ** env_list, HYD_Env_t env);
+HYD_Status HYDU_Env_putenv(HYD_Env_t env);
+
+
+/* Launch utilities */
+struct HYD_Partition_list {
+ char *name;
+ int proc_count;
+ char **mapping; /* Can be core IDs or something else */
+
+ /*
+ * The boot-strap server is expected to start a single executable
+ * on the first possible node and return a single PID. This
+ * executable could be a PM proxy that will launch the actual
+ * application on the rest of the partition list.
+ *
+ * Possible hacks:
+ *
+ * 1. If the process manager needs more proxies within this same
+ * list, it can use different group IDs. Each group ID will
+ * have its own proxy.
+ *
+ * 2. If no proxy is needed, the PM can split this list into one
+ * element per process. The boot-strap server itself does not
+ * distinguish a proxy from the application executable, so it
+ * will not require any changes.
+ *
+ * 3. One proxy per physical node means that each partition will
+ * have a different group ID.
+ */
+ int group_id; /* Assumed to be in ascending order */
+ int group_rank; /* Rank within the group */
+ int pid;
+ int out;
+ int err;
+ int exit_status;
+ char *args[HYD_EXEC_ARGS];
+
+ struct HYD_Partition_list *next;
+};
+
+HYD_Status HYDU_Append_env(HYD_Env_t * env_list, char **client_arg, int id);
+HYD_Status HYDU_Append_exec(char **exec, char **client_arg);
+HYD_Status HYDU_Append_wdir(char **client_arg, char *wdir);
+HYD_Status HYDU_Allocate_Partition(struct HYD_Partition_list **partition);
+HYD_Status HYDU_Create_process(char **client_arg, int *in, int *out, int *err, int *pid);
+HYD_Status HYDU_Dump_args(char **args);
+
+
+/* Memory utilities */
+#define HYDU_NUM_JOIN_STR 100
+
+#define HYDU_MALLOC(p, type, size, status) \
+ { \
+ (p) = (type) MPIU_Malloc((size)); \
+ if ((p) == NULL) { \
+ HYDU_Error_printf("failed trying to allocate %d bytes\n", (size)); \
+ (status) = HYD_NO_MEM; \
+ goto fn_fail; \
+ } \
+ }
+
+#define HYDU_FREE(p) \
+ { \
+ MPIU_Free(p); \
+ }
+
+#define HYDU_STRDUP(src, dest, type, status) \
+ { \
+ (dest) = (type) MPIU_Strdup((src)); \
+ if ((p) == NULL) { \
+ HYDU_Error_printf("failed duping string %s\n", (src)); \
+ (status) = HYD_INTERNAL_ERROR; \
+ goto fn_fail; \
+ } \
+ }
+
+#define HYDU_PRINT_ARGS(str) \
+ { \
+ int i; \
+ for (i = 0; (str) != NULL && (str)[i] != NULL; i++) \
+ printf("%s ", (str)[i]); \
+ printf("\n"); \
+ }
+
+#define HYDU_STR_ALLOC_AND_JOIN(strlist, strjoin, status) \
+ { \
+ int len = 0, i, count; \
+ for (i = 0; (strlist)[i] != NULL; i++) \
+ len += strlen((strlist)[i]); \
+ HYDU_MALLOC((strjoin), char *, len + 1, (status)); \
+ count = 0; \
+ (strjoin)[0] = 0; \
+ for (i = 0; (strlist)[i] != NULL; i++) { \
+ MPIU_Snprintf((strjoin) + count, len - count + 1, "%s", (strlist)[i]); \
+ count += strlen((strlist)[i]); \
+ } \
+ }
+
+#define HYDU_Int_to_str(x, str, status) \
+ { \
+ int len = 1, max = 10, y; \
+ if ((x) < 0) { \
+ len++; \
+ y = -(x); \
+ } \
+ else \
+ y = (x); \
+ while (y >= max) { \
+ len++; \
+ max *= 10; \
+ } \
+ (str) = (char *) MPIU_Malloc(len + 1); \
+ if ((str) == NULL) { \
+ HYDU_Error_printf("failed trying to allocate %d bytes\n", len + 1); \
+ (status) = HYD_NO_MEM; \
+ goto fn_fail; \
+ } \
+ MPIU_Snprintf((str), len + 1, "%d", (x)); \
+ }
+
+
+/* Signal utilities */
+#ifdef NEEDS_POSIX_FOR_SIGACTION
+#define _POSIX_SOURCE
+#endif
+
+#include <sys/wait.h>
+#if defined(USE_SIGNAL) || defined(USE_SIGACTION)
+#include <signal.h>
+#else
+#error no signal choice
+#endif
+#ifdef NEEDS_STRSIGNAL_DECL
+extern char *strsignal(int);
+#endif
+
+HYD_Status HYDU_Set_signal(int signum, void (*handler) (int));
+
+
+/* Sock utilities */
+#include <poll.h>
+#include <fcntl.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+
+#if !defined size_t
+#define size_t unsigned int
+#endif /* size_t */
+
+HYD_Status HYDU_Sock_listen(int *listen_fd, char *port_range, uint16_t * port);
+HYD_Status HYDU_Sock_connect(const char *host, uint16_t port, int *fd);
+HYD_Status HYDU_Sock_accept(int listen_fd, int *fd);
+HYD_Status HYDU_Sock_readline(int fd, char *buf, int maxlen, int *linelen);
+HYD_Status HYDU_Sock_read(int fd, char *buf, int maxlen, int *count);
+HYD_Status HYDU_Sock_writeline(int fd, char *buf, int maxsize);
+HYD_Status HYDU_Sock_write(int fd, char *buf, int maxsize);
+HYD_Status HYDU_Sock_set_nonblock(int fd);
+HYD_Status HYDU_Sock_set_cloexec(int fd);
+HYD_Status HYDU_Sock_stdout_cb(int fd, HYD_Event_t events, int stdout_fd, int *closed);
+HYD_Status HYDU_Sock_stdin_cb(int fd, HYD_Event_t events, char *buf, int *buf_count,
+ int *buf_offset, int *closed);
+
+#endif /* HYDRA_UTILS_H_INCLUDED */
Modified: mpich2/trunk/src/pm/hydra/launcher/mpiexec/callback.c
===================================================================
--- mpich2/trunk/src/pm/hydra/launcher/mpiexec/callback.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/launcher/mpiexec/callback.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,7 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_dbg.h"
+#include "hydra_utils.h"
#include "mpiexec.h"
#include "csi.h"
Modified: mpich2/trunk/src/pm/hydra/launcher/mpiexec/mpiexec.c
===================================================================
--- mpich2/trunk/src/pm/hydra/launcher/mpiexec/mpiexec.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/launcher/mpiexec/mpiexec.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,9 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_dbg.h"
-#include "hydra_mem.h"
-#include "hydra_env.h"
+#include "hydra_utils.h"
#include "mpiexec.h"
#include "lchu.h"
#include "csi.h"
Modified: mpich2/trunk/src/pm/hydra/launcher/mpiexec/utils.c
===================================================================
--- mpich2/trunk/src/pm/hydra/launcher/mpiexec/utils.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/launcher/mpiexec/utils.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,9 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_dbg.h"
-#include "hydra_mem.h"
-#include "hydra_env.h"
+#include "hydra_utils.h"
#include "mpiexec.h"
#include "lchu.h"
Modified: mpich2/trunk/src/pm/hydra/launcher/utils/lchu.c
===================================================================
--- mpich2/trunk/src/pm/hydra/launcher/utils/lchu.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/launcher/utils/lchu.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,7 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_mem.h"
+#include "hydra_utils.h"
HYD_Handle handle;
Modified: mpich2/trunk/src/pm/hydra/pm/central/central_cb.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/central/central_cb.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/pm/central/central_cb.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,8 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_mem.h"
-#include "hydra_sock.h"
+#include "hydra_utils.h"
#include "pmcu_pmi.h"
#include "pmci.h"
#include "bsci.h"
Modified: mpich2/trunk/src/pm/hydra/pm/central/central_launch.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/central/central_launch.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/pm/central/central_launch.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,8 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_sock.h"
-#include "hydra_mem.h"
+#include "hydra_utils.h"
#include "pmci.h"
#include "pmcu_pmi.h"
#include "bsci.h"
Modified: mpich2/trunk/src/pm/hydra/pm/central/proxy.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/central/proxy.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/pm/central/proxy.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,8 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_mem.h"
-#include "hydra_sock.h"
+#include "hydra_utils.h"
#include "demux.h"
#include "proxy.h"
Modified: mpich2/trunk/src/pm/hydra/pm/central/proxy_cb.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/central/proxy_cb.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/pm/central/proxy_cb.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,7 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_sig.h"
+#include "hydra_utils.h"
#include "proxy.h"
#include "central.h"
Modified: mpich2/trunk/src/pm/hydra/pm/utils/pmcu_pmi.h
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/utils/pmcu_pmi.h 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/pm/utils/pmcu_pmi.h 2009-03-10 08:50:37 UTC (rev 3997)
@@ -8,7 +8,7 @@
#define PMCU_PMI_H_INCLUDED
#include "hydra.h"
-#include "hydra_mem.h"
+#include "hydra_utils.h"
#define MAXKEYLEN 64 /* max length of key in keyval space */
#define MAXVALLEN 256 /* max length of value in keyval space */
Modified: mpich2/trunk/src/pm/hydra/pm/utils/pmi.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/utils/pmi.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/pm/utils/pmi.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -5,8 +5,7 @@
*/
#include "hydra.h"
-#include "hydra_mem.h"
-#include "hydra_sock.h"
+#include "hydra_utils.h"
#include "bsci.h"
#include "pmcu_pmi.h"
Modified: mpich2/trunk/src/pm/hydra/utils/dbg/dbg.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/dbg/dbg.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/utils/dbg/dbg.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -4,4 +4,4 @@
* See COPYRIGHT in top-level directory.
*/
-#include "hydra.h"
+#include "hydra_utils.h"
Modified: mpich2/trunk/src/pm/hydra/utils/env/env.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/env/env.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/utils/env/env.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -4,9 +4,7 @@
* See COPYRIGHT in top-level directory.
*/
-#include "hydra.h"
-#include "hydra_env.h"
-#include "hydra_mem.h"
+#include "hydra_utils.h"
HYD_Status HYDU_Env_global_list(HYD_Env_t ** env_list)
{
Modified: mpich2/trunk/src/pm/hydra/utils/launch/allocate.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/launch/allocate.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/utils/launch/allocate.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -4,9 +4,7 @@
* See COPYRIGHT in top-level directory.
*/
-#include "hydra.h"
-#include "hydra_mem.h"
-#include "hydra_launch.h"
+#include "hydra_utils.h"
HYD_Status HYDU_Allocate_Partition(struct HYD_Partition_list **partition)
{
Modified: mpich2/trunk/src/pm/hydra/utils/launch/args.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/launch/args.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/utils/launch/args.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -4,9 +4,7 @@
* See COPYRIGHT in top-level directory.
*/
-#include "hydra.h"
-#include "hydra_mem.h"
-#include "hydra_launch.h"
+#include "hydra_utils.h"
HYD_Status HYDU_Append_env(HYD_Env_t * env_list, char **client_arg, int id)
{
Modified: mpich2/trunk/src/pm/hydra/utils/launch/launch.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/launch/launch.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/utils/launch/launch.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -4,9 +4,7 @@
* See COPYRIGHT in top-level directory.
*/
-#include "hydra.h"
-#include "hydra_mem.h"
-#include "hydra_launch.h"
+#include "hydra_utils.h"
HYD_Status HYDU_Create_process(char **client_arg, int *in, int *out, int *err, int *pid)
{
Modified: mpich2/trunk/src/pm/hydra/utils/signals/signals.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/signals/signals.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/utils/signals/signals.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -4,8 +4,7 @@
* See COPYRIGHT in top-level directory.
*/
-#include "hydra.h"
-#include "hydra_sig.h"
+#include "hydra_utils.h"
HYD_Status HYDU_Set_signal(int signum, void (*handler) (int))
{
Modified: mpich2/trunk/src/pm/hydra/utils/sock/sock.c
===================================================================
--- mpich2/trunk/src/pm/hydra/utils/sock/sock.c 2009-03-10 08:24:14 UTC (rev 3996)
+++ mpich2/trunk/src/pm/hydra/utils/sock/sock.c 2009-03-10 08:50:37 UTC (rev 3997)
@@ -4,8 +4,7 @@
* See COPYRIGHT in top-level directory.
*/
-#include "hydra_sock.h"
-#include "hydra_dbg.h"
+#include "hydra_utils.h"
HYD_Status HYDU_Sock_listen(int *listen_fd, char *port_range, uint16_t * port)
{
More information about the mpich2-commits
mailing list