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 
  27 
  28 
  29 
  30 #ifndef _ORTE_NAME_FNS_H_
  31 #define _ORTE_NAME_FNS_H_
  32 
  33 #include "orte_config.h"
  34 
  35 #ifdef HAVE_STDINT_h
  36 #include <stdint.h>
  37 #endif
  38 
  39 #include "orte/types.h"
  40 
  41 #include "opal/class/opal_list.h"
  42 
  43 BEGIN_C_DECLS
  44 
  45 typedef uint8_t  orte_ns_cmp_bitmask_t;  
  46 #define ORTE_NS_CMP_NONE       0x00
  47 #define ORTE_NS_CMP_JOBID      0x02
  48 #define ORTE_NS_CMP_VPID       0x04
  49 #define ORTE_NS_CMP_ALL        0x0f
  50 #define ORTE_NS_CMP_WILD       0x10
  51 
  52 
  53 ORTE_DECLSPEC char* orte_util_print_name_args(const orte_process_name_t *name);
  54 #define ORTE_NAME_PRINT(n) \
  55     orte_util_print_name_args(n)
  56 
  57 ORTE_DECLSPEC char* orte_util_print_jobids(const orte_jobid_t job);
  58 #define ORTE_JOBID_PRINT(n) \
  59     orte_util_print_jobids(n)
  60 
  61 ORTE_DECLSPEC char* orte_util_print_vpids(const orte_vpid_t vpid);
  62 #define ORTE_VPID_PRINT(n) \
  63     orte_util_print_vpids(n)
  64 
  65 ORTE_DECLSPEC char* orte_util_print_job_family(const orte_jobid_t job);
  66 #define ORTE_JOB_FAMILY_PRINT(n) \
  67     orte_util_print_job_family(n)
  68 
  69 ORTE_DECLSPEC char* orte_util_print_local_jobid(const orte_jobid_t job);
  70 #define ORTE_LOCAL_JOBID_PRINT(n) \
  71     orte_util_print_local_jobid(n)
  72 
  73 ORTE_DECLSPEC char *orte_pretty_print_timing(int64_t secs, int64_t usecs);
  74 
  75 
  76 
  77 
  78 #define ORTE_JOB_FAMILY(n) \
  79     (((n) >> 16) & 0x0000ffff)
  80 
  81 
  82 #define ORTE_HNP_NAME_FROM_JOB(n, job)     \
  83     do {                                   \
  84         (n)->jobid = (job) & 0xffff0000;   \
  85         (n)->vpid = 0;                     \
  86     } while(0);
  87 
  88 
  89 
  90 
  91 #define ORTE_LOCAL_JOBID(n) \
  92     ( (n) & 0x0000ffff)
  93 
  94 #define ORTE_CONSTRUCT_JOB_FAMILY(n) \
  95     ( ((n) << 16) & 0xffff0000)
  96 
  97 #define ORTE_CONSTRUCT_LOCAL_JOBID(local, job) \
  98     ( ((local) & 0xffff0000) | ((job) & 0x0000ffff) )
  99 
 100 #define ORTE_CONSTRUCT_JOBID(family, local) \
 101     ORTE_CONSTRUCT_LOCAL_JOBID(ORTE_CONSTRUCT_JOB_FAMILY(family), local)
 102 
 103 
 104 #define ORTE_JOBID_IS_DAEMON(n)  \
 105     !((n) & 0x0000ffff)
 106 
 107 
 108 #define ORTE_DAEMON_JOBID(n) \
 109     ((n) & 0xffff0000)
 110 
 111 
 112 struct orte_namelist_t {
 113     opal_list_item_t super;      
 114     orte_process_name_t name;   
 115 };
 116 typedef struct orte_namelist_t orte_namelist_t;
 117 
 118 ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_namelist_t);
 119 
 120 ORTE_DECLSPEC int orte_util_snprintf_jobid(char *jobid_string, size_t size, const orte_jobid_t jobid);
 121 ORTE_DECLSPEC int orte_util_convert_jobid_to_string(char **jobid_string, const orte_jobid_t jobid);
 122 ORTE_DECLSPEC int orte_util_convert_string_to_jobid(orte_jobid_t *jobid, const char* jobidstring);
 123 ORTE_DECLSPEC int orte_util_convert_vpid_to_string(char **vpid_string, const orte_vpid_t vpid);
 124 ORTE_DECLSPEC int orte_util_convert_string_to_vpid(orte_vpid_t *vpid, const char* vpidstring);
 125 ORTE_DECLSPEC int orte_util_convert_string_to_process_name(orte_process_name_t *name,
 126                                              const char* name_string);
 127 ORTE_DECLSPEC int orte_util_convert_process_name_to_string(char** name_string,
 128                                              const orte_process_name_t *name);
 129 ORTE_DECLSPEC int orte_util_create_process_name(orte_process_name_t **name,
 130                                   orte_jobid_t job,
 131                                   orte_vpid_t vpid);
 132 
 133 ORTE_DECLSPEC int orte_util_compare_name_fields(orte_ns_cmp_bitmask_t fields,
 134                                   const orte_process_name_t* name1,
 135                                   const orte_process_name_t* name2);
 136 
 137 ORTE_DECLSPEC uint32_t orte_util_hash_vpid(orte_vpid_t vpid);
 138 ORTE_DECLSPEC int orte_util_convert_string_to_sysinfo(char **cpu_type, char **cpu_model,
 139                                              const char* sysinfo_string);
 140 ORTE_DECLSPEC int orte_util_convert_sysinfo_to_string(char** sysinfo_string,
 141                                                       const char *cpu_model, const char *cpu_type);
 142 
 143 END_C_DECLS
 144 #endif