[mpich2-commits] r5590 - mpich2/trunk/src/pm/hydra/pm/pmiserv
balaji at mcs.anl.gov
balaji at mcs.anl.gov
Tue Oct 27 18:10:57 CDT 2009
Author: balaji
Date: 2009-10-27 18:10:56 -0500 (Tue, 27 Oct 2009)
New Revision: 5590
Removed:
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v1.h
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v2.h
Modified:
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle.c
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle.h
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_common.c
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v1.c
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v2.c
mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_serv_cb.c
Log:
Merge equivalent parts of the PMI-1 and PMI-2 code bases.
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle.c 2009-10-27 23:10:55 UTC (rev 5589)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle.c 2009-10-27 23:10:56 UTC (rev 5590)
@@ -6,8 +6,6 @@
#include "hydra.h"
#include "pmi_handle.h"
-#include "pmi_handle_v1.h"
-#include "pmi_handle_v2.h"
HYD_pmcd_pmi_pg_t *HYD_pg_list = NULL;
struct HYD_pmcd_pmi_handle *HYD_pmcd_pmi_handle = { 0 };
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle.h
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle.h 2009-10-27 23:10:55 UTC (rev 5589)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle.h 2009-10-27 23:10:56 UTC (rev 5590)
@@ -9,8 +9,17 @@
#include "hydra_base.h"
+/* PMI-1 specific definitions */
+#define PMI_V1_DELIM " "
+extern struct HYD_pmcd_pmi_handle HYD_pmcd_pmi_v1;
+
+/* PMI-2 specific definitions */
+#define PMI_V2_DELIM ";"
+extern struct HYD_pmcd_pmi_handle HYD_pmcd_pmi_v2;
+
+/* Generic definitions */
#define MAXKEYLEN 64 /* max length of key in keyval space */
-/* PMI-1 uses 256, PMI-2 uses 1024; we use the MAX */
+/* FIXME: PMI-1 uses 256, PMI-2 uses 1024; we use the MAX */
#define MAXVALLEN 1024 /* max length of value in keyval space */
#define MAXNAMELEN 256 /* max length of various names */
#define MAXKVSNAME MAXNAMELEN /* max length of a kvsname */
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_common.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_common.c 2009-10-27 23:10:55 UTC (rev 5589)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_common.c 2009-10-27 23:10:56 UTC (rev 5590)
@@ -7,8 +7,6 @@
#include "hydra.h"
#include "pmi_handle.h"
#include "pmi_handle_common.h"
-#include "pmi_handle_v1.h"
-#include "pmi_handle_v2.h"
HYD_status HYD_pmcd_pmi_handle_init(int fd, char *args[])
{
@@ -27,13 +25,13 @@
tmp = "cmd=response_to_init pmi_version=1 pmi_subversion=1 rc=0\n";
status = HYDU_sock_writeline(fd, tmp, strlen(tmp));
HYDU_ERR_POP(status, "error writing PMI line\n");
- HYD_pmcd_pmi_handle = HYD_pmcd_pmi_v1;
+ HYD_pmcd_pmi_handle = &HYD_pmcd_pmi_v1;
}
else if (pmi_version == 2 && pmi_subversion == 0) {
tmp = "cmd=response_to_init pmi_version=2 pmi_subversion=0 rc=0\n";
status = HYDU_sock_writeline(fd, tmp, strlen(tmp));
HYDU_ERR_POP(status, "error writing PMI line\n");
- HYD_pmcd_pmi_handle = HYD_pmcd_pmi_v2;
+ HYD_pmcd_pmi_handle = &HYD_pmcd_pmi_v2;
}
else {
/* PMI version mismatch */
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v1.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v1.c 2009-10-27 23:10:55 UTC (rev 5589)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v1.c 2009-10-27 23:10:56 UTC (rev 5590)
@@ -9,27 +9,8 @@
#include "bsci.h"
#include "demux.h"
#include "pmi_handle.h"
-#include "pmi_handle_v1.h"
-/* TODO: abort, create_kvs, destroy_kvs, getbyidx, spawn */
-static struct HYD_pmcd_pmi_handle_fns pmi_v1_handle_fns_foo[] = {
- {"initack", HYD_pmcd_pmi_handle_v1_initack},
- {"get_maxes", HYD_pmcd_pmi_handle_v1_get_maxes},
- {"get_appnum", HYD_pmcd_pmi_handle_v1_get_appnum},
- {"get_my_kvsname", HYD_pmcd_pmi_handle_v1_get_my_kvsname},
- {"barrier_in", HYD_pmcd_pmi_handle_v1_barrier_in},
- {"put", HYD_pmcd_pmi_handle_v1_put},
- {"get", HYD_pmcd_pmi_handle_v1_get},
- {"get_universe_size", HYD_pmcd_pmi_handle_v1_get_usize},
- {"finalize", HYD_pmcd_pmi_handle_v1_finalize},
- {"\0", NULL}
-};
-
-static struct HYD_pmcd_pmi_handle pmi_v1_foo = { PMI_V1_DELIM, pmi_v1_handle_fns_foo };
-
-struct HYD_pmcd_pmi_handle *HYD_pmcd_pmi_v1 = &pmi_v1_foo;
-
-HYD_status HYD_pmcd_pmi_handle_v1_initack(int fd, char *args[])
+static HYD_status fn_initack(int fd, char *args[])
{
int id, rank, i;
char *tmp[HYD_NUM_TMP_STRINGS], *cmd;
@@ -80,8 +61,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v1_get_maxes(int fd, char *args[])
+static HYD_status fn_get_maxes(int fd, char *args[])
{
int i;
char *tmp[HYD_NUM_TMP_STRINGS], *cmd;
@@ -115,8 +95,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v1_get_appnum(int fd, char *args[])
+static HYD_status fn_get_appnum(int fd, char *args[])
{
char *tmp[HYD_NUM_TMP_STRINGS], *cmd;
int i;
@@ -152,8 +131,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v1_get_my_kvsname(int fd, char *args[])
+static HYD_status fn_get_my_kvsname(int fd, char *args[])
{
char *tmp[HYD_NUM_TMP_STRINGS], *cmd;
int i;
@@ -190,8 +168,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v1_barrier_in(int fd, char *args[])
+static HYD_status fn_barrier_in(int fd, char *args[])
{
HYD_pmcd_pmi_process_t *process, *prun;
HYD_pmcd_pmi_node_t *node;
@@ -230,8 +207,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v1_put(int fd, char *args[])
+static HYD_status fn_put(int fd, char *args[])
{
int i, ret;
HYD_pmcd_pmi_process_t *process;
@@ -291,8 +267,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v1_get(int fd, char *args[])
+static HYD_status fn_get(int fd, char *args[])
{
int i, found, ret;
HYD_pmcd_pmi_process_t *process;
@@ -386,8 +361,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v1_finalize(int fd, char *args[])
+static HYD_status fn_finalize(int fd, char *args[])
{
const char *cmd;
HYD_status status = HYD_SUCCESS;
@@ -412,8 +386,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v1_get_usize(int fd, char *args[])
+static HYD_status fn_get_usize(int fd, char *args[])
{
int usize, i;
char *tmp[HYD_NUM_TMP_STRINGS], *cmd;
@@ -445,3 +418,19 @@
fn_fail:
goto fn_exit;
}
+
+/* TODO: abort, create_kvs, destroy_kvs, getbyidx, spawn */
+static struct HYD_pmcd_pmi_handle_fns pmi_v1_handle_fns_foo[] = {
+ {"initack", fn_initack},
+ {"get_maxes", fn_get_maxes},
+ {"get_appnum", fn_get_appnum},
+ {"get_my_kvsname", fn_get_my_kvsname},
+ {"barrier_in", fn_barrier_in},
+ {"put", fn_put},
+ {"get", fn_get},
+ {"get_universe_size", fn_get_usize},
+ {"finalize", fn_finalize},
+ {"\0", NULL}
+};
+
+struct HYD_pmcd_pmi_handle HYD_pmcd_pmi_v1 = { PMI_V1_DELIM, pmi_v1_handle_fns_foo };
Deleted: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v1.h
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v1.h 2009-10-27 23:10:55 UTC (rev 5589)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v1.h 2009-10-27 23:10:56 UTC (rev 5590)
@@ -1,27 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; -*- */
-/*
- * (C) 2008 by Argonne National Laboratory.
- * See COPYRIGHT in top-level directory.
- */
-
-#ifndef PMI_HANDLE_V1_H_INCLUDED
-#define PMI_HANDLE_V1_H_INCLUDED
-
-#include "pmi_handle.h"
-
-#define PMI_V1_DELIM " "
-
-extern struct HYD_pmcd_pmi_handle *HYD_pmcd_pmi_v1;
-
-/* PMI handles */
-HYD_status HYD_pmcd_pmi_handle_v1_initack(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v1_get_maxes(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v1_get_appnum(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v1_get_my_kvsname(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v1_barrier_in(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v1_put(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v1_get(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v1_get_usize(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v1_finalize(int fd, char *args[]);
-
-#endif /* PMI_HANDLE_V1_H_INCLUDED */
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v2.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v2.c 2009-10-27 23:10:55 UTC (rev 5589)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v2.c 2009-10-27 23:10:56 UTC (rev 5590)
@@ -9,26 +9,17 @@
#include "bsci.h"
#include "demux.h"
#include "pmi_handle.h"
-#include "pmi_handle_v2.h"
-/* TODO: abort, create_kvs, destroy_kvs, getbyidx, spawn */
-static struct HYD_pmcd_pmi_handle_fns pmi_v2_handle_fns_foo[] = {
- {"fullinit", HYD_pmcd_pmi_handle_v2_fullinit},
- {"job-getid", HYD_pmcd_pmi_handle_v2_job_getid},
- {"info-putnodeattr", HYD_pmcd_pmi_handle_v2_info_putnodeattr},
- {"info-getnodeattr", HYD_pmcd_pmi_handle_v2_info_getnodeattr},
- {"info-getjobattr", HYD_pmcd_pmi_handle_v2_info_getjobattr},
- {"kvs-put", HYD_pmcd_pmi_handle_v2_kvs_put},
- {"kvs-get", HYD_pmcd_pmi_handle_v2_kvs_get},
- {"kvs-fence", HYD_pmcd_pmi_handle_v2_kvs_fence},
- {"finalize", HYD_pmcd_pmi_handle_v2_finalize},
- {"\0", NULL}
-};
+static HYD_status fn_fullinit(int fd, char *args[]);
+static HYD_status fn_job_getid(int fd, char *args[]);
+static HYD_status fn_info_putnodeattr(int fd, char *args[]);
+static HYD_status fn_info_getnodeattr(int fd, char *args[]);
+static HYD_status fn_info_getjobattr(int fd, char *args[]);
+static HYD_status fn_kvs_put(int fd, char *args[]);
+static HYD_status fn_kvs_get(int fd, char *args[]);
+static HYD_status fn_kvs_fence(int fd, char *args[]);
+static HYD_status fn_finalize(int fd, char *args[]);
-static struct HYD_pmcd_pmi_handle pmi_v2_foo = { PMI_V2_DELIM, pmi_v2_handle_fns_foo };
-
-struct HYD_pmcd_pmi_handle *HYD_pmcd_pmi_v2 = &pmi_v2_foo;
-
struct token {
char *key;
char *val;
@@ -86,7 +77,6 @@
goto fn_exit;
}
-
static HYD_status args_to_tokens(char *args[], struct token **tokens, int *count)
{
int i;
@@ -163,11 +153,11 @@
req_complete = 0;
if (areq->type == GET_NODE_ATTR) {
- status = HYD_pmcd_pmi_handle_v2_info_getnodeattr(areq->fd, areq->req);
+ status = fn_info_getnodeattr(areq->fd, areq->req);
HYDU_ERR_POP(status, "getnodeattr returned error\n");
}
else if (areq->type == KVS_GET) {
- status = HYD_pmcd_pmi_handle_v2_kvs_get(areq->fd, areq->req);
+ status = fn_kvs_get(areq->fd, areq->req);
HYDU_ERR_POP(status, "kvs_get returned error\n");
}
@@ -196,7 +186,6 @@
goto fn_exit;
}
-
static char *find_token_keyval(struct token *tokens, int count, const char *key)
{
int i;
@@ -209,8 +198,7 @@
return NULL;
}
-
-HYD_status HYD_pmcd_pmi_handle_v2_fullinit(int fd, char *args[])
+static HYD_status fn_fullinit(int fd, char *args[])
{
int id, rank, i;
char *tmp[HYD_NUM_TMP_STRINGS], *cmd, *rank_str;
@@ -268,8 +256,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v2_job_getid(int fd, char *args[])
+static HYD_status fn_job_getid(int fd, char *args[])
{
char *tmp[HYD_NUM_TMP_STRINGS], *cmd, *thrid;
int i;
@@ -321,8 +308,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v2_info_putnodeattr(int fd, char *args[])
+static HYD_status fn_info_putnodeattr(int fd, char *args[])
{
char *tmp[HYD_NUM_TMP_STRINGS], *cmd;
char *key, *val, *thrid;
@@ -389,8 +375,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v2_info_getnodeattr(int fd, char *args[])
+static HYD_status fn_info_getnodeattr(int fd, char *args[])
{
int i, found;
HYD_pmcd_pmi_process_t *process;
@@ -490,8 +475,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v2_info_getjobattr(int fd, char *args[])
+static HYD_status fn_info_getjobattr(int fd, char *args[])
{
int i, ret;
HYD_pmcd_pmi_process_t *process;
@@ -590,8 +574,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v2_kvs_put(int fd, char *args[])
+static HYD_status fn_kvs_put(int fd, char *args[])
{
char *tmp[HYD_NUM_TMP_STRINGS], *cmd;
char *key, *val, *thrid;
@@ -658,8 +641,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v2_kvs_get(int fd, char *args[])
+static HYD_status fn_kvs_get(int fd, char *args[])
{
int i, found, node_count;
HYD_pmcd_pmi_process_t *process, *prun;
@@ -761,8 +743,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v2_kvs_fence(int fd, char *args[])
+static HYD_status fn_kvs_fence(int fd, char *args[])
{
HYD_pmcd_pmi_process_t *process;
char *tmp[HYD_NUM_TMP_STRINGS], *cmd, *thrid;
@@ -816,8 +797,7 @@
goto fn_exit;
}
-
-HYD_status HYD_pmcd_pmi_handle_v2_finalize(int fd, char *args[])
+static HYD_status fn_finalize(int fd, char *args[])
{
char *thrid;
char *tmp[HYD_NUM_TMP_STRINGS], *cmd;
@@ -863,3 +843,19 @@
fn_fail:
goto fn_exit;
}
+
+/* TODO: abort, create_kvs, destroy_kvs, getbyidx, spawn */
+static struct HYD_pmcd_pmi_handle_fns pmi_v2_handle_fns_foo[] = {
+ {"fullinit", fn_fullinit},
+ {"job-getid", fn_job_getid},
+ {"info-putnodeattr", fn_info_putnodeattr},
+ {"info-getnodeattr", fn_info_getnodeattr},
+ {"info-getjobattr", fn_info_getjobattr},
+ {"kvs-put", fn_kvs_put},
+ {"kvs-get", fn_kvs_get},
+ {"kvs-fence", fn_kvs_fence},
+ {"finalize", fn_finalize},
+ {"\0", NULL}
+};
+
+struct HYD_pmcd_pmi_handle HYD_pmcd_pmi_v2 = { PMI_V2_DELIM, pmi_v2_handle_fns_foo };
Deleted: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v2.h
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v2.h 2009-10-27 23:10:55 UTC (rev 5589)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle_v2.h 2009-10-27 23:10:56 UTC (rev 5590)
@@ -1,27 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; -*- */
-/*
- * (C) 2008 by Argonne National Laboratory.
- * See COPYRIGHT in top-level directory.
- */
-
-#ifndef PMI_HANDLE_V2_H_INCLUDED
-#define PMI_HANDLE_V2_H_INCLUDED
-
-#include "pmi_handle.h"
-
-#define PMI_V2_DELIM ";"
-
-extern struct HYD_pmcd_pmi_handle *HYD_pmcd_pmi_v2;
-
-/* PMI handles */
-HYD_status HYD_pmcd_pmi_handle_v2_fullinit(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v2_job_getid(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v2_info_putnodeattr(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v2_info_getnodeattr(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v2_info_getjobattr(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v2_kvs_put(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v2_kvs_get(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v2_kvs_fence(int fd, char *args[]);
-HYD_status HYD_pmcd_pmi_handle_v2_finalize(int fd, char *args[]);
-
-#endif /* PMI_HANDLE_V2_H_INCLUDED */
Modified: mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_serv_cb.c
===================================================================
--- mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_serv_cb.c 2009-10-27 23:10:55 UTC (rev 5589)
+++ mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_serv_cb.c 2009-10-27 23:10:56 UTC (rev 5590)
@@ -8,7 +8,6 @@
#include "hydra_utils.h"
#include "pmi_handle.h"
#include "pmi_handle_common.h"
-#include "pmi_handle_v1.h"
#include "pmci.h"
#include "bsci.h"
#include "demux.h"
@@ -67,7 +66,7 @@
* that commands can arrive out-of-order and this is necessary.
*/
if (HYD_pmcd_pmi_handle == NULL)
- HYD_pmcd_pmi_handle = HYD_pmcd_pmi_v1;
+ HYD_pmcd_pmi_handle = &HYD_pmcd_pmi_v1;
do {
status = HYDU_sock_read(fd, bufptr, 6, &linelen, HYDU_SOCK_COMM_MSGWAIT);
@@ -100,9 +99,9 @@
* PMI-2 commands interleaved with regular PMI-2
* commands. */
tbuf = HYDU_strdup(buf);
- cmd = strtok(tbuf, HYD_pmcd_pmi_v1->delim);
+ cmd = strtok(tbuf, HYD_pmcd_pmi_v1.delim);
for (i = 0; i < HYD_NUM_TMP_STRINGS; i++) {
- args[i] = strtok(NULL, HYD_pmcd_pmi_v1->delim);
+ args[i] = strtok(NULL, HYD_pmcd_pmi_v1.delim);
if (args[i] == NULL)
break;
}
More information about the mpich2-commits
mailing list