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 <src/include/pmix_config.h>
  27 #include <pmix.h>
  28 
  29 #include <stdio.h>
  30 #include <stdlib.h>
  31 #include <unistd.h>
  32 #include <time.h>
  33 
  34 #include "src/class/pmix_object.h"
  35 #include "src/util/output.h"
  36 #include "src/util/printf.h"
  37 
  38 static pmix_proc_t myproc;
  39 
  40 int main(int argc, char **argv)
  41 {
  42     pmix_status_t rc;
  43     pmix_value_t value;
  44     pmix_value_t *val = &value;
  45     uint64_t seckey[2];
  46     pmix_proc_t proc;
  47     pmix_info_t *info;
  48     size_t n, ninfo;
  49 
  50     
  51     if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) {
  52         pmix_output(0, "Client ns %s rank %d: PMIx_Init failed: %s",
  53                     myproc.nspace, myproc.rank, PMIx_Error_string(rc));
  54         exit(rc);
  55     }
  56     pmix_output(0, "GWClient ns %s rank %d: Running", myproc.nspace, myproc.rank);
  57 
  58     
  59     memset(&proc, 0, sizeof(pmix_proc_t));
  60     (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
  61     proc.rank = PMIX_RANK_WILDCARD;
  62 
  63     if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, "my.net.key", NULL, 0, &val)) ||
  64         PMIX_DATA_ARRAY != val->type ||
  65         NULL == val->data.darray ||
  66         NULL == val->data.darray->array) {
  67         pmix_output(0, "Client ns %s rank %d: PMIx_Get my.net.key failed: %s",
  68                     myproc.nspace, myproc.rank, PMIx_Error_string(rc));
  69         exit(rc);
  70     }
  71     
  72 
  73     info = (pmix_info_t*)val->data.darray->array;
  74     ninfo = val->data.darray->size;
  75     pmix_output(0, "Client ns %s rank %d: got network assignment:",
  76                 myproc.nspace, myproc.rank);
  77     for (n=0; n < ninfo; n++) {
  78         if (PMIX_STRING == info[n].value.type) {
  79             pmix_output(0, "\tKey: %s Value: %s",
  80                         info[n].key, info[n].value.data.string);
  81         } else if (PMIX_BYTE_OBJECT == info[n].value.type) {
  82             memcpy(seckey, info[n].value.data.bo.bytes, info[n].value.data.bo.size);
  83             pmix_output(0, "\tKey: %s sec key: %ld.%ld",
  84                         info[n].key, (long int)seckey[0], (long int)seckey[1]);
  85         }
  86     }
  87     PMIX_VALUE_RELEASE(val);
  88 
  89     
  90     pmix_output(0, "Client ns %s rank %d: Finalizing", myproc.nspace, myproc.rank);
  91     if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) {
  92         fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %s\n",
  93                 myproc.nspace, myproc.rank, PMIx_Error_string(rc));
  94     } else {
  95         fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank);
  96     }
  97     fflush(stderr);
  98     return(rc);
  99 }