This source file includes following definitions.
- main
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 
  23 
  24 
  25 
  26 #include <stdio.h>
  27 #include <stdlib.h>
  28 #include <unistd.h>
  29 #include <time.h>
  30 
  31 #include "opal/util/string_copy.h"
  32 
  33 #include <pmix_tool.h>
  34 
  35 int main(int argc, char **argv)
  36 {
  37     pmix_status_t rc;
  38     pmix_proc_t myproc;
  39     pmix_info_t *info;
  40     size_t ninfo;
  41 
  42     
  43     if (PMIX_SUCCESS != (rc = PMIx_tool_init(&myproc, NULL, 0))) {
  44         fprintf(stderr, "PMIx_tool_init failed: %s\n", PMIx_Error_string(rc));
  45         exit(rc);
  46     }
  47     fprintf(stderr, "Tool ns %s rank %d: Running\n", myproc.nspace, myproc.rank);
  48 
  49     
  50     ninfo = 1;
  51     PMIX_INFO_CREATE(info, ninfo);
  52     (void)opal_string_copy(info[0].key, PMIX_QUERY_NAMESPACES, PMIX_MAX_KEYLEN);
  53     if (PMIX_SUCCESS != (rc = PMIx_Query_info(info, ninfo))) {
  54         fprintf(stderr, "Tool ns %s rank %d: PMIx_Query_info failed: %d\n", myproc.nspace, myproc.rank, rc);
  55         goto done;
  56     }
  57     if (0 != strncmp(info[0].key, PMIX_QUERY_NAMESPACES, PMIX_MAX_KEYLEN)) {
  58         fprintf(stderr, "tool ns %s rank %d: PMIx_Query_info key[0] wrong: %s vs %s\n",
  59                     myproc.nspace, myproc.rank, info[0].key, PMIX_QUERY_NAMESPACES);
  60     }
  61     if (PMIX_STRING != info[0].value.type) {
  62         fprintf(stderr, "Tool ns %s rank %d: PMIx_Query_info key[0] wrong type: %d vs %d\n",
  63                     myproc.nspace, myproc.rank, info[0].value.type, PMIX_STRING);
  64     }
  65     fprintf(stderr, "Tool ns %s rank %d: PMIx_Query_info key[0] returned %s\n",
  66             myproc.nspace, myproc.rank,
  67             (NULL == info[0].value.data.string) ? "NULL" : info[0].value.data.string);
  68     PMIX_INFO_FREE(info, ninfo);
  69 
  70  done:
  71     
  72     fprintf(stderr, "Tool ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank);
  73     if (PMIX_SUCCESS != (rc = PMIx_tool_finalize())) {
  74         fprintf(stderr, "Tool ns %s rank %d:PMIx_tool_finalize failed: %d\n", myproc.nspace, myproc.rank, rc);
  75     } else {
  76         fprintf(stderr, "Tool ns %s rank %d:PMIx_tool_finalize successfully completed\n", myproc.nspace, myproc.rank);
  77     }
  78     fflush(stderr);
  79     return(rc);
  80 }