root/orte/runtime/data_type_support/orte_dt_compare_fns.c

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

DEFINITIONS

This source file includes following definitions.
  1. orte_dt_compare_std_cntr
  2. orte_dt_compare_job
  3. orte_dt_compare_node
  4. orte_dt_compare_proc
  5. orte_dt_compare_app_context
  6. orte_dt_compare_exit_code
  7. orte_dt_compare_node_state
  8. orte_dt_compare_proc_state
  9. orte_dt_compare_job_state
  10. orte_dt_compare_map
  11. orte_dt_compare_tags
  12. orte_dt_compare_daemon_cmd
  13. orte_dt_compare_iof_tag
  14. orte_dt_compare_attr
  15. orte_dt_compare_sig

   1 /*
   2  * Copyright (c) 2004-2005 The Trustees of Indiana University.
   3  *                         All rights reserved.
   4  * Copyright (c) 2004-2011 The Trustees of the University of Tennessee.
   5  *                         All rights reserved.
   6  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   7  *                         University of Stuttgart.  All rights reserved.
   8  * Copyright (c) 2004-2005 The Regents of the University of California.
   9  *                         All rights reserved.
  10  * Copyright (c) 2011-2013 Los Alamos National Security, LLC.
  11  *                         All rights reserved.
  12  * Copyright (c) 2014      Intel, Inc. All rights reserved.
  13  * $COPYRIGHT$
  14  *
  15  * Additional copyrights may follow
  16  *
  17  * $HEADER$
  18  */
  19 
  20 #include "orte_config.h"
  21 
  22 #include <string.h>
  23 
  24 #include <sys/types.h>
  25 
  26 #include "orte/mca/grpcomm/grpcomm.h"
  27 
  28 #include "orte/runtime/data_type_support/orte_dt_support.h"
  29 
  30 int orte_dt_compare_std_cntr(orte_std_cntr_t *value1, orte_std_cntr_t *value2, opal_data_type_t type)
  31 {
  32     if (*value1 > *value2) return OPAL_VALUE1_GREATER;
  33 
  34     if (*value2 > *value1) return OPAL_VALUE2_GREATER;
  35 
  36     return OPAL_EQUAL;
  37 }
  38 
  39 /**
  40  * JOB
  41  */
  42 int orte_dt_compare_job(orte_job_t *value1, orte_job_t *value2, opal_data_type_t type)
  43 {
  44     /** check jobids */
  45     if (value1->jobid > value2->jobid) return OPAL_VALUE1_GREATER;
  46     if (value1->jobid < value2->jobid) return OPAL_VALUE2_GREATER;
  47 
  48     return OPAL_EQUAL;
  49 }
  50 
  51 /**
  52 * NODE
  53  */
  54 int orte_dt_compare_node(orte_node_t *value1, orte_node_t *value2, opal_data_type_t type)
  55 {
  56     int test;
  57 
  58     /** check node names */
  59     test = strcmp(value1->name, value2->name);
  60     if (0 == test) return OPAL_EQUAL;
  61     if (0 < test) return OPAL_VALUE2_GREATER;
  62 
  63     return OPAL_VALUE1_GREATER;
  64 }
  65 
  66 /**
  67 * PROC
  68  */
  69 int orte_dt_compare_proc(orte_proc_t *value1, orte_proc_t *value2, opal_data_type_t type)
  70 {
  71     orte_ns_cmp_bitmask_t mask;
  72 
  73     /** check vpids */
  74     mask = ORTE_NS_CMP_VPID;
  75 
  76     return orte_util_compare_name_fields(mask, &value1->name, &value2->name);
  77 }
  78 
  79 /*
  80  * APP CONTEXT
  81  */
  82 int orte_dt_compare_app_context(orte_app_context_t *value1, orte_app_context_t *value2, opal_data_type_t type)
  83 {
  84     if (value1->idx > value2->idx) return OPAL_VALUE1_GREATER;
  85     if (value2->idx > value1->idx) return OPAL_VALUE2_GREATER;
  86 
  87     return OPAL_EQUAL;
  88 }
  89 
  90 /*
  91  * EXIT CODE
  92  */
  93 int orte_dt_compare_exit_code(orte_exit_code_t *value1,
  94                                     orte_exit_code_t *value2,
  95                                     opal_data_type_t type)
  96 {
  97     if (*value1 > *value2) return OPAL_VALUE1_GREATER;
  98 
  99     if (*value2 > *value1) return OPAL_VALUE2_GREATER;
 100 
 101     return OPAL_EQUAL;
 102 }
 103 
 104 /*
 105  * NODE STATE
 106  */
 107 int orte_dt_compare_node_state(orte_node_state_t *value1,
 108                                      orte_node_state_t *value2,
 109                                      orte_node_state_t type)
 110 {
 111     if (*value1 > *value2) return OPAL_VALUE1_GREATER;
 112 
 113     if (*value2 > *value1) return OPAL_VALUE2_GREATER;
 114 
 115     return OPAL_EQUAL;
 116 }
 117 
 118 /*
 119  * PROC STATE
 120  */
 121 int orte_dt_compare_proc_state(orte_proc_state_t *value1,
 122                                      orte_proc_state_t *value2,
 123                                      orte_proc_state_t type)
 124 {
 125     if (*value1 > *value2) return OPAL_VALUE1_GREATER;
 126 
 127     if (*value2 > *value1) return OPAL_VALUE2_GREATER;
 128 
 129     return OPAL_EQUAL;
 130 }
 131 
 132 /*
 133  * JOB STATE
 134  */
 135 int orte_dt_compare_job_state(orte_job_state_t *value1,
 136                                     orte_job_state_t *value2,
 137                                     orte_job_state_t type)
 138 {
 139     if (*value1 > *value2) return OPAL_VALUE1_GREATER;
 140 
 141     if (*value2 > *value1) return OPAL_VALUE2_GREATER;
 142 
 143     return OPAL_EQUAL;
 144 }
 145 
 146 /*
 147  * JOB_MAP
 148  */
 149 int orte_dt_compare_map(orte_job_map_t *value1, orte_job_map_t *value2, opal_data_type_t type)
 150 {
 151     return OPAL_EQUAL;
 152 }
 153 
 154 /*
 155  * RML tags
 156  */
 157 int orte_dt_compare_tags(orte_rml_tag_t *value1, orte_rml_tag_t *value2, opal_data_type_t type)
 158 {
 159     if (*value1 > *value2) {
 160         return OPAL_VALUE1_GREATER;
 161     } else if (*value1 < *value2) {
 162         return OPAL_VALUE2_GREATER;
 163     } else {
 164         return OPAL_EQUAL;
 165     }
 166 }
 167 
 168 /* ORTE_DAEMON_CMD */
 169 int orte_dt_compare_daemon_cmd(orte_daemon_cmd_flag_t *value1, orte_daemon_cmd_flag_t *value2, opal_data_type_t type)
 170 {
 171     if (*value1 > *value2) return OPAL_VALUE1_GREATER;
 172 
 173     if (*value2 > *value1) return OPAL_VALUE2_GREATER;
 174 
 175     return OPAL_EQUAL;
 176 }
 177 
 178 /* ORTE_IOF_TAG */
 179 int orte_dt_compare_iof_tag(orte_iof_tag_t *value1, orte_iof_tag_t *value2, opal_data_type_t type)
 180 {
 181     if (*value1 > *value2) return OPAL_VALUE1_GREATER;
 182 
 183     if (*value2 > *value1) return OPAL_VALUE2_GREATER;
 184 
 185     return OPAL_EQUAL;
 186 }
 187 
 188 /* ORTE_ATTR */
 189 int orte_dt_compare_attr(orte_attribute_t *value1, orte_attribute_t *value2, opal_data_type_t type)
 190 {
 191     if (value1->key > value2->key) {
 192         return OPAL_VALUE1_GREATER;
 193     }
 194     if (value2->key > value1->key) {
 195         return OPAL_VALUE2_GREATER;
 196     }
 197 
 198     return OPAL_EQUAL;
 199 }
 200 
 201 /* ORTE_SIGNATURE */
 202 int orte_dt_compare_sig(orte_grpcomm_signature_t *value1, orte_grpcomm_signature_t *value2, opal_data_type_t type)
 203 {
 204     if (value1->sz > value2->sz) {
 205         return OPAL_VALUE1_GREATER;
 206     }
 207     if (value2->sz > value1->sz) {
 208         return OPAL_VALUE2_GREATER;
 209     }
 210     /* same size - check contents */
 211     if (0 == memcmp(value1->signature, value2->signature, value1->sz*sizeof(orte_process_name_t))) {
 212         return OPAL_EQUAL;
 213     }
 214     return OPAL_VALUE2_GREATER;
 215 }

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