OpenMPI  0.1.1
common_portals.h
1 /*
2  * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
3  * University Research and Technology
4  * Corporation. All rights reserved.
5  * Copyright (c) 2004-2005 The University of Tennessee and The University
6  * of Tennessee Research Foundation. All rights
7  * reserved.
8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9  * University of Stuttgart. All rights reserved.
10  * Copyright (c) 2004-2006 The Regents of the University of California.
11  * All rights reserved.
12  * $COPYRIGHT$
13  *
14  * Additional copyrights may follow
15  *
16  * $HEADER$
17  */
18 
19 #ifndef OMPI_MCA_COMMON_PORTALS_H
20 #define OMPI_MCA_COMMON_PORTALS_H
21 
22 #if OMPI_PORTALS_UTCP
23 
24 #include <portals3.h>
25 #include <stdio.h>
26 #include <p3nal_utcp.h>
27 #include <p3rt/p3rt.h>
28 #include <p3api/debug.h>
29 
30 #define OMPI_BTL_PORTALS_SEND_TABLE_ID 0
31 #define OMPI_BTL_PORTALS_RDMA_TABLE_ID 1
32 
33 #define OMPI_MTL_PORTALS_SEND_TABLE_ID 2
34 #define OMPI_MTL_PORTALS_READ_TABLE_ID 3
35 #define OMPI_MTL_PORTALS_ACK_TABLE_ID 4
36 
37 #elif (OMPI_PORTALS_CRAYXT3 || OMPI_PORTALS_CRAYXT3_MODEX)
38 #include <portals/portals3.h>
39 #define PTL_EQ_HANDLER_NONE NULL
40 /* Cray's definition, differs from the spec */
41 #define PTL_NO_ACK_REQ PTL_NOACK_REQ
42 
43 #define OMPI_BTL_PORTALS_SEND_TABLE_ID 30
44 #define OMPI_BTL_PORTALS_RDMA_TABLE_ID 31
45 
46 #define OMPI_MTL_PORTALS_SEND_TABLE_ID 32
47 #define OMPI_MTL_PORTALS_READ_TABLE_ID 33
48 #define OMPI_MTL_PORTALS_ACK_TABLE_ID 34
49 
50 #else
51 
52 #error "Unknown Portals library configuration"
53 
54 #endif
55 
56 #include "ompi/proc/proc.h"
57 
58 
59 /**
60  * Simple identifier for identifying node/process
61  *
62  * Get a string representing a simple way to identify the node/rank of
63  * the current process. Currently returns the rank in the job on the
64  * XT-3 or the hostname/pid on the reference implementation.
65  *
66  * \note Caller is responsible for calling free() on the returned
67  * string.
68  */
69 char* ompi_common_portals_nodeid(void);
70 
71 
72 /**
73  * Register MCA parameters for Portals code
74  *
75  * Register MCA parameters for Portals common code. This should be
76  * called during component open so that parameters are available to
77  * omp_info and the like. This call will not intiailize the Portals
78  * interface or cause any communication.
79  *
80  * @retval OMPI_SUCCESS
81  */
82 int ompi_common_portals_register_mca(void);
83 
84 
85 /**
86  * Initialize compatibility code
87  *
88  * Initialize Portals compatibility code. A best effort is made to
89  * initialize Portals (with PtlInit() and PtlNIInit(), although this
90  * may not be possible if use of the modex is required to setup the
91  * network (as is the case with the utcp reference implementation).
92  *
93  * @param ni_handle (OUT) network interface handle
94  * @param bool (OUT) true if using accelerated Portals, false otherwise
95  *
96  * @retval OMPI_SUCCESS Portals successfully initialized
97  * @retval OMPI_ERR_NOT_AVAILABLE Portals could not be initialized
98  */
99 int ompi_common_portals_initialize(ptl_handle_ni_t *ni_handle, bool *accel);
100 
101 /**
102  * Initialize network interface
103  *
104  * Initialize the portals network interface. The initializization may
105  * actually have happened in ompi_common_portals_initialize(), but
106  * this will return the network interface handle. This function may
107  * require some information shared by the modex, so should only be
108  * called after the modex data is available.
109  *
110  * @param ni_handle (OUT) network interface handle
111  * @param bool (OUT) true if using accelerated Portals, false otherwise
112  *
113  * @retval OMPI_SUCCESS Portals network interface successfully initialized
114  * @retval OMPI_ERROR Something bad happened
115  */
116 int ompi_common_portals_ni_initialize(ptl_handle_ni_t *ni_handle, bool *accel);
117 
118 
119 /**
120  * Get process_id_t array for proc list
121  *
122  * Get ptl_process_id_t array for proc list
123  *
124  * @param nprocs (IN) Number of procs in proc list
125  * @param procs (IN) List of OMPI procs
126  * @param portals_procs (OUT) array of ptl_process_id_t
127  * structures associated with OMPI procs
128  *
129  * @retval OMPI_SUCCESS All went well
130  * @retval OMPI_ERROR All went poorly
131  */
132 int ompi_common_portals_get_procs(size_t nprocs,
133  struct ompi_proc_t **procs,
134  ptl_process_id_t *portals_procs);
135 
136 
137 /**
138  * Shut down Portals network interface
139  *
140  * Shut down Portals network devince , including calling PtlNIFini()
141  * if appropriate. The common code will reference count so that it is
142  * safe for each component that calls
143  * ompi_component_portals_ni_initialize() to call
144  * ompi_common_portals_ni_finalize()
145  */
146 int ompi_common_portals_ni_finalize(void);
147 
148 
149 /**
150  * Shut down Portals
151  *
152  * Shut down Portals, including calling PtlFini() if appropriate. The
153  * common code will reference count so that it is safe for each
154  * component that calls ompi_component_portals_initialize() to call
155  * ompi_common_portals_finalize()
156  */
157 int ompi_common_portals_finalize(void);
158 
159 
160 int ompi_common_portals_error_ptl_to_ompi(int ptl_error);
161 
162 
163 #endif /* OMPI_MCA_COMMON_PORTALS_H */
Process identification structure interface.
Remote Open MPI process structure.
Definition: proc.h:56