@@ -49,9 +49,7 @@ int main(int argc, char **argv)
4949 char nsp2 [PMIX_MAX_NSLEN + 1 ];
5050 pmix_app_t * app ;
5151 char hostname [1024 ], dir [1024 ];
52- pmix_proc_t * peers ;
53- size_t npeers , ntmp = 0 ;
54- char * nodelist ;
52+ size_t ntmp = 0 ;
5553
5654 if (0 > gethostname (hostname , sizeof (hostname ))) {
5755 exit (1 );
@@ -71,14 +69,14 @@ int main(int argc, char **argv)
7169 (void )strncpy (proc .nspace , myproc .nspace , PMIX_MAX_NSLEN );
7270 proc .rank = PMIX_RANK_WILDCARD ;
7371
74- /* get our universe size */
75- if (PMIX_SUCCESS != (rc = PMIx_Get (& proc , PMIX_UNIV_SIZE , NULL , 0 , & val ))) {
76- fprintf (stderr , "Client ns %s rank %d: PMIx_Get universe size failed: %d\n" , myproc .nspace , myproc .rank , rc );
72+ /* get our job size */
73+ if (PMIX_SUCCESS != (rc = PMIx_Get (& proc , PMIX_JOB_SIZE , NULL , 0 , & val ))) {
74+ fprintf (stderr , "Client ns %s rank %d: PMIx_Get job size failed: %d\n" , myproc .nspace , myproc .rank , rc );
7775 goto done ;
7876 }
7977 nprocs = val -> data .uint32 ;
8078 PMIX_VALUE_RELEASE (val );
81- fprintf (stderr , "Client %s:%d universe size %d\n" , myproc .nspace , myproc .rank , nprocs );
79+ fprintf (stderr , "Client %s:%d job size %d\n" , myproc .nspace , myproc .rank , nprocs );
8280
8381 /* call fence to sync */
8482 (void )strncpy (proc .nspace , myproc .nspace , PMIX_MAX_NSLEN );
@@ -103,13 +101,6 @@ int main(int argc, char **argv)
103101 app -> env = (char * * )malloc (2 * sizeof (char * ));
104102 app -> env [0 ] = strdup ("PMIX_ENV_VALUE=3" );
105103 app -> env [1 ] = NULL ;
106- PMIX_INFO_CREATE (app -> info , 2 );
107- (void )strncpy (app -> info [0 ].key , "DARTH" , PMIX_MAX_KEYLEN );
108- app -> info [0 ].value .type = PMIX_INT8 ;
109- app -> info [0 ].value .data .int8 = 12 ;
110- (void )strncpy (app -> info [1 ].key , "VADER" , PMIX_MAX_KEYLEN );
111- app -> info [1 ].value .type = PMIX_DOUBLE ;
112- app -> info [1 ].value .data .dval = 12.34 ;
113104
114105 fprintf (stderr , "Client ns %s rank %d: calling PMIx_Spawn\n" , myproc .nspace , myproc .rank );
115106 if (PMIX_SUCCESS != (rc = PMIx_Spawn (NULL , 0 , app , 1 , nsp2 ))) {
@@ -122,65 +113,28 @@ int main(int argc, char **argv)
122113 val = NULL ;
123114 (void )strncpy (proc .nspace , nsp2 , PMIX_MAX_NSLEN );
124115 proc .rank = PMIX_RANK_WILDCARD ;
125- if (PMIX_SUCCESS != (rc = PMIx_Get (& proc , PMIX_UNIV_SIZE , NULL , 0 , & val )) ||
116+ if (PMIX_SUCCESS != (rc = PMIx_Get (& proc , PMIX_JOB_SIZE , NULL , 0 , & val )) ||
126117 NULL == val ) {
127- fprintf (stderr , "Client ns %s rank %d: PMIx_Get universe size failed: %d\n" , myproc .nspace , myproc .rank , rc );
118+ fprintf (stderr , "Client ns %s rank %d: PMIx_Get job size failed: %d\n" , myproc .nspace , myproc .rank , rc );
128119 goto done ;
129120 }
130121 ntmp = val -> data .uint32 ;
131122 PMIX_VALUE_RELEASE (val );
132- fprintf (stderr , "Client %s:%d universe %s size %d\n" , myproc .nspace , myproc .rank , nsp2 , (int )ntmp );
133- }
134-
135- /* just cycle the connect/disconnect functions */
136- (void )strncpy (proc .nspace , myproc .nspace , PMIX_MAX_NSLEN );
137- proc .rank = PMIX_RANK_WILDCARD ;
138- if (PMIX_SUCCESS != (rc = PMIx_Connect (& proc , 1 , NULL , 0 ))) {
139- fprintf (stderr , "Client ns %s rank %d: PMIx_Connect failed: %d\n" , myproc .nspace , myproc .rank , rc );
140- goto done ;
141- }
142- fprintf (stderr , "Client ns %s rank %d: PMIx_Connect succeeded\n" ,
143- myproc .nspace , myproc .rank );
144- if (PMIX_SUCCESS != (rc = PMIx_Disconnect (& proc , 1 , NULL , 0 ))) {
145- fprintf (stderr , "Client ns %s rank %d: PMIx_Disonnect failed: %d\n" , myproc .nspace , myproc .rank , rc );
146- goto done ;
147- }
148- fprintf (stderr , "Client ns %s rank %d: PMIx_Disconnect succeeded\n" , myproc .nspace , myproc .rank );
123+ fprintf (stderr , "Client %s:%d job %s size %d\n" , myproc .nspace , myproc .rank , nsp2 , (int )ntmp );
149124
150- /* finally, test the resolve functions */
151- if (0 == myproc .rank ) {
152- if (PMIX_SUCCESS != (rc = PMIx_Resolve_peers (hostname , NULL , & peers , & npeers ))) {
153- fprintf (stderr , "Client ns %s rank %d: PMIx_Resolve_peers failed for nspace %s: %d\n" , myproc .nspace , myproc .rank , nsp2 , rc );
154- goto done ;
155- }
156- if ((nprocs + ntmp ) != npeers ) {
157- fprintf (stderr , "Client ns %s rank %d: PMIx_Resolve_peers returned incorrect npeers: %d vs %d\n" , myproc .nspace , myproc .rank , (int )(nprocs + ntmp ), (int )npeers );
158- goto done ;
159- }
160- fprintf (stderr , "Client ns %s rank %d: PMIx_Resolve_peers returned %d npeers\n" , myproc .nspace , myproc .rank , (int )npeers );
161- if (PMIX_SUCCESS != (rc = PMIx_Resolve_nodes (nsp2 , & nodelist ))) {
162- fprintf (stderr , "Client ns %s rank %d: PMIx_Resolve_nodes failed for nspace %s: %d\n" , myproc .nspace , myproc .rank , nsp2 , rc );
163- goto done ;
164- }
165- fprintf (stderr , "Client ns %s rank %d: PMIx_Resolve_nodes %s" , myproc .nspace , myproc .rank , nodelist );
166- } else {
167- if (PMIX_SUCCESS != (rc = PMIx_Resolve_peers (hostname , myproc .nspace , & peers , & npeers ))) {
168- fprintf (stderr , "Client ns %s rank %d: PMIx_Resolve_peers failed for nspace %s: %d\n" , myproc .nspace , myproc .rank , myproc .nspace , rc );
169- goto done ;
170- }
171- if (nprocs != npeers ) {
172- fprintf (stderr , "Client ns %s rank %d: PMIx_Resolve_peers returned incorrect npeers: %d vs %d\n" , myproc .nspace , myproc .rank , nprocs , (int )npeers );
173- goto done ;
174- }
175- fprintf (stderr , "Client ns %s rank %d: PMIx_Resolve_peers returned %d npeers\n" , myproc .nspace , myproc .rank , (int )npeers );
176- if (PMIX_SUCCESS != (rc = PMIx_Resolve_nodes (myproc .nspace , & nodelist ))) {
177- fprintf (stderr , "Client ns %s rank %d: PMIx_Resolve_nodes failed: %d\n" , myproc .nspace , myproc .rank , rc );
125+ /* get a proc-specific value */
126+ val = NULL ;
127+ (void )strncpy (proc .nspace , nsp2 , PMIX_MAX_NSLEN );
128+ proc .rank = 1 ;
129+ if (PMIX_SUCCESS != (rc = PMIx_Get (& proc , PMIX_LOCAL_RANK , NULL , 0 , & val )) ||
130+ NULL == val ) {
131+ fprintf (stderr , "Client ns %s rank %d: PMIx_Get local rank failed: %d\n" , myproc .nspace , myproc .rank , rc );
178132 goto done ;
179133 }
180- fprintf (stderr , "Client ns %s rank %d: PMIx_Resolve_nodes %s\n" , myproc .nspace , myproc .rank , nodelist );
134+ ntmp = (int )val -> data .uint16 ;
135+ PMIX_VALUE_RELEASE (val );
136+ fprintf (stderr , "Client %s:%d job %s local rank %d\n" , myproc .nspace , myproc .rank , nsp2 , (int )ntmp );
181137 }
182- PMIX_PROC_FREE (peers , npeers );
183- free (nodelist );
184138
185139 done :
186140 /* call fence to sync */
0 commit comments