root/orte/test/system/ofi_query_test.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. send_callback
  2. print_transports_query
  3. main

   1 #include "orte_config.h"
   2 
   3 #include <stdio.h>
   4 #include <signal.h>
   5 #include <math.h>
   6 
   7 #include <rdma/fabric.h>
   8 #include <rdma/fi_cm.h>
   9 #include <rdma/fi_domain.h>
  10 #include <rdma/fi_endpoint.h>
  11 #include <rdma/fi_errno.h>
  12 #include <rdma/fi_tagged.h>
  13 
  14 #include "opal/runtime/opal_progress.h"
  15 
  16 #include "orte/util/proc_info.h"
  17 #include "orte/util/name_fns.h"
  18 #include "orte/runtime/orte_globals.h"
  19 #include "orte/mca/rml/rml.h"
  20 #include "orte/mca/rml/base/base.h"
  21 #include "orte/mca/rml/rml_types.h"
  22 #include "orte/mca/errmgr/errmgr.h"
  23 
  24 #include "orte/runtime/runtime.h"
  25 #include "orte/runtime/orte_wait.h"
  26 
  27 #define MY_TAG 12345
  28 #define MAX_COUNT 3
  29 
  30 static bool msg_recvd;
  31 static volatile bool msg_active;
  32 
  33 static void send_callback(int status, orte_process_name_t *peer,
  34                           opal_buffer_t* buffer, orte_rml_tag_t tag,
  35                           void* cbdata)
  36 
  37 {
  38     OBJ_RELEASE(buffer);
  39     if (ORTE_SUCCESS != status) {
  40         exit(1);
  41     }
  42     msg_active = false;
  43 }
  44 
  45 
  46 //debug routine to print the opal_value_t returned by query interface
  47 void print_transports_query()
  48 {
  49     opal_value_t *providers=NULL;
  50     char* prov_name = NULL;
  51     int ret;
  52     int32_t *protocol_ptr, protocol;
  53     int8_t conduit_id;
  54     int8_t *prov_num=&conduit_id;
  55 
  56     protocol_ptr = &protocol;
  57 
  58     opal_output(0,"\n print_transports_query() Begin- %s:%d",__FILE__,__LINE__);
  59     opal_output(0,"\n calling the orte_rml_ofi_query_transports() ");
  60     if( ORTE_SUCCESS == orte_rml.query_transports(&providers)) {
  61        opal_output(0,"\n query_transports() completed, printing details\n");
  62        while (providers) {
  63             //get the first opal_list_t;
  64             opal_list_t temp;
  65             opal_list_t *prov = &temp;
  66 
  67             ret = opal_value_unload(providers,(void **)&prov,OPAL_PTR);
  68             if (ret == OPAL_SUCCESS) {
  69                 opal_output_verbose(1,orte_rml_base_framework.framework_output,"\n %s:%d opal_value_unload() succeeded, opal_list* prov = %x",
  70                                     __FILE__,__LINE__,prov);
  71                 if (orte_get_attribute( prov, ORTE_CONDUIT_ID, (void **)&prov_num,OPAL_UINT8)) {
  72                     opal_output(0," Provider conduit_id  : %d",*prov_num);
  73                 }
  74                 if( orte_get_attribute( prov, ORTE_PROTOCOL, (void **)&protocol_ptr,OPAL_UINT32)) {
  75                     opal_output(0," Protocol  : %s",fi_tostr(protocol_ptr,FI_TYPE_PROTOCOL));
  76                 }
  77                 if( orte_get_attribute( prov, ORTE_PROV_NAME, (void **)&prov_name ,OPAL_STRING)) {
  78                     opal_output(0," Provider name : %s",prov_name);
  79                 } else {
  80                     opal_output(0," Error in getting Provider name");
  81                 }
  82             } else {
  83                 opal_output(0," %s:%d opal_value_unload() failed, opal_list* prov = %x",__FILE__,__LINE__,prov);
  84             }
  85             providers = (opal_value_t *)providers->super.opal_list_next;
  86             // opal_output_verbose(1,orte_rml_base_framework.framework_output,"\n %s:%d -
  87             //                                Moving on to next provider provders=%x",__FILE__,__LINE__,providers);
  88         }
  89     } else {
  90         opal_output(0,"\n query_transports() returned Error ");
  91     }
  92     opal_output(0,"\n End of print_transports_query() from ofi_query_test.c \n");
  93 
  94   //need to free all the providers here
  95 }
  96 
  97 
  98 int
  99 main(int argc, char *argv[]){
 100     int count;
 101     int msgsize;
 102     uint8_t *msg;
 103     int i, j, rc;
 104     orte_process_name_t peer;
 105     double maxpower;
 106     opal_buffer_t *buf;
 107     orte_rml_recv_cb_t blob;
 108 
 109 
 110      opal_output(0, "%s pid = %d ", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), getpid());
 111 
 112      /*
 113      * Init
 114      */
 115     orte_init(&argc, &argv, ORTE_PROC_NON_MPI);
 116    //  orte_init(&argc, &argv, ORTE_PROC_MPI);
 117 
 118         /*
 119      * Runtime Messaging Layer  - added this as RML was not being initialised in the app process,
 120      * but now ompimaster has code added to call this automatically
 121      */
 122 /*
 123      if (ORTE_SUCCESS == ( mca_base_framework_open(&orte_rml_base_framework, 0))) {
 124          opal_output(0, "%s RML framework opened successfully ", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), getpid());
 125         if (ORTE_SUCCESS == orte_rml_base_select()) {
 126             opal_output(0, "%s RML framework base_select completed successfully ", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), getpid());
 127             print_transports_query();
 128         }
 129     }
 130 */
 131 
 132     print_transports_query();
 133     opal_output(0, "%s calling orte_finalize() from ofi_query_test.c ",ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
 134     orte_finalize();
 135 
 136     return 0;
 137 }

/* [<][>][^][v][top][bottom][index][help] */