root/orte/util/name_fns.h

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

INCLUDED FROM


   1 /*
   2  * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2011 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2010      Oracle and/or its affiliates.  All rights reserved.
  13  * Copyright (c) 2014-2016 Research Organization for Information Science
  14  *                         and Technology (RIST). All rights reserved.
  15  * $COPYRIGHT$
  16  *
  17  * Additional copyrights may follow
  18  *
  19  * $HEADER$
  20  */
  21 
  22 /** @file:
  23  *
  24  * Populates global structure with system-specific information.
  25  *
  26  * Notes: add limits.h, compute size of integer and other types via sizeof(type)*CHAR_BIT
  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;  /**< Bit mask for comparing process names */
  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 /* useful define to print name args in output messages */
  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 /* a macro for identifying the job family - i.e., for
  76  * extracting the mpirun-specific id field of the jobid
  77  */
  78 #define ORTE_JOB_FAMILY(n) \
  79     (((n) >> 16) & 0x0000ffff)
  80 
  81 /* a macro for discovering the HNP name of a proc given its jobid */
  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 /* a macro for extracting the local jobid from the jobid - i.e.,
  89  * the non-mpirun-specific id field of the jobid
  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 /* a macro for identifying that a proc is a daemon */
 104 #define ORTE_JOBID_IS_DAEMON(n)  \
 105     !((n) & 0x0000ffff)
 106 
 107 /* a macro for obtaining the daemon jobid */
 108 #define ORTE_DAEMON_JOBID(n) \
 109     ((n) & 0xffff0000)
 110 
 111 /* List of names for general use */
 112 struct orte_namelist_t {
 113     opal_list_item_t super;      /**< Allows this item to be placed on a list */
 114     orte_process_name_t name;   /**< Name of a process */
 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 /** This funtion returns a guaranteed unique hash value for the passed process name */
 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

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