root/mpich2/trunk/src/pm/hydra/pm/pmiserv/pmi_handle.h @ 4887

Revision 4887, 3.2 KB (checked in by balaji, 5 months ago)

Warning stomp.

Line 
1/* -*- Mode: C; c-basic-offset:4 ; -*- */
2/*
3 *  (C) 2008 by Argonne National Laboratory.
4 *      See COPYRIGHT in top-level directory.
5 */
6
7#ifndef PMI_HANDLE_H_INCLUDED
8#define PMI_HANDLE_H_INCLUDED
9
10#include "hydra_base.h"
11
12#define MAXKEYLEN    64 /* max length of key in keyval space */
13/* PMI-1 uses 256, PMI-2 uses 1024; we use the MAX */
14#define MAXVALLEN  1024 /* max length of value in keyval space */
15#define MAXNAMELEN  256 /* max length of various names */
16#define MAXKVSNAME  MAXNAMELEN  /* max length of a kvsname */
17
18typedef struct HYD_PMCD_pmi_kvs_pair {
19    char key[MAXKEYLEN];
20    char val[MAXVALLEN];
21    struct HYD_PMCD_pmi_kvs_pair *next;
22} HYD_PMCD_pmi_kvs_pair_t;
23
24typedef struct HYD_PMCD_pmi_kvs {
25    char kvs_name[MAXNAMELEN];  /* Name of this kvs */
26    HYD_PMCD_pmi_kvs_pair_t *key_pair;
27} HYD_PMCD_pmi_kvs_t;
28
29typedef struct HYD_PMCD_pmi_pg HYD_PMCD_pmi_pg_t;
30typedef struct HYD_PMCD_pmi_node HYD_PMCD_pmi_node_t;
31typedef struct HYD_PMCD_pmi_process HYD_PMCD_pmi_process_t;
32
33struct HYD_PMCD_pmi_process {
34    /* This is a bad design if we need to tie in an FD to a PMI
35     * process. This essentially kills any chance of PMI server
36     * masquerading. */
37    int fd;
38    int rank;                   /* COMM_WORLD rank of this process */
39    int epoch;                  /* Epoch this process has reached */
40    struct HYD_PMCD_pmi_node *node;     /* Back pointer to the PMI node */
41    struct HYD_PMCD_pmi_process *next;
42};
43
44struct HYD_PMCD_pmi_node {
45    int node_id;                /* This corresponds to the partition ID of the
46                                 * launched processes */
47    struct HYD_PMCD_pmi_pg *pg; /* Back pointer to the group */
48    struct HYD_PMCD_pmi_process *process_list;
49
50    HYD_PMCD_pmi_kvs_t *kvs;    /* Node-level KVS space for node attributes */
51
52    struct HYD_PMCD_pmi_node *next;
53};
54
55struct HYD_PMCD_pmi_pg {
56    int id;
57
58    int num_procs;              /* Number of processes in the group */
59    int num_subgroups;          /* Number of subgroups */
60    int *conn_procs;            /* Number of connected procs in each subgroup */
61
62    int barrier_count;
63
64    struct HYD_PMCD_pmi_node *node_list;
65    HYD_PMCD_pmi_kvs_t *kvs;
66
67    struct HYD_PMCD_pmi_pg *next;
68};
69
70enum HYD_PMCD_pmi_process_mapping_type {
71    HYD_PMCD_pmi_explicit,
72    HYD_PMCD_pmi_vector
73};
74
75HYD_Status HYD_PMCD_pmi_add_process_to_pg(HYD_PMCD_pmi_pg_t * pg, int fd, int rank);
76HYD_Status HYD_PMCD_pmi_id_to_rank(int id, int *rank);
77HYD_PMCD_pmi_process_t *HYD_PMCD_pmi_find_process(int fd);
78HYD_Status HYD_PMCD_pmi_add_kvs(const char *key, char *val, HYD_PMCD_pmi_kvs_t * kvs,
79                                char **key_pair_str, int *ret);
80HYD_Status HYD_PMCD_pmi_process_mapping(HYD_PMCD_pmi_process_t * process,
81                                        enum HYD_PMCD_pmi_process_mapping_type type,
82                                        char **process_mapping);
83HYD_Status HYD_PMCD_pmi_init(void);
84HYD_Status HYD_PMCD_pmi_finalize(void);
85
86extern HYD_PMCD_pmi_pg_t *HYD_pg_list;
87
88struct HYD_PMCD_pmi_handle_fns {
89    const char *cmd;
90     HYD_Status(*handler) (int fd, char *args[]);
91};
92
93struct HYD_PMCD_pmi_handle {
94    const char *delim;
95    struct HYD_PMCD_pmi_handle_fns *handle_fns;
96};
97
98extern struct HYD_PMCD_pmi_handle *HYD_PMCD_pmi_handle;
99
100#endif /* PMI_HANDLE_H_INCLUDED */
Note: See TracBrowser for help on using the browser.