root/opal/mca/hwloc/hwloc201/hwloc/include/hwloc/deprecated.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. hwloc_topology_insert_misc_object_by_parent
  2. hwloc_obj_cpuset_snprintf
  3. hwloc_obj_type_sscanf
  4. hwloc_set_membind_nodeset
  5. hwloc_get_membind_nodeset
  6. hwloc_set_proc_membind_nodeset
  7. hwloc_get_proc_membind_nodeset
  8. hwloc_set_area_membind_nodeset
  9. hwloc_get_area_membind_nodeset
  10. hwloc_alloc_membind_nodeset
  11. hwloc_alloc_membind_policy_nodeset
  12. hwloc_cpuset_to_nodeset_strict
  13. hwloc_cpuset_from_nodeset_strict

   1 /*
   2  * Copyright © 2009 CNRS
   3  * Copyright © 2009-2017 Inria.  All rights reserved.
   4  * Copyright © 2009-2012 Université Bordeaux
   5  * Copyright © 2009-2010 Cisco Systems, Inc.  All rights reserved.
   6  * See COPYING in top-level directory.
   7  */
   8 
   9 /**
  10  * This file contains the inline code of functions declared in hwloc.h
  11  */
  12 
  13 #ifndef HWLOC_DEPRECATED_H
  14 #define HWLOC_DEPRECATED_H
  15 
  16 #ifndef HWLOC_H
  17 #error Please include the main hwloc.h instead
  18 #endif
  19 
  20 #ifdef __cplusplus
  21 extern "C" {
  22 #endif
  23 
  24 /* backward compat with v1.11 before System removal */
  25 #define HWLOC_OBJ_SYSTEM HWLOC_OBJ_MACHINE
  26 /* backward compat with v1.10 before Socket->Package renaming */
  27 #define HWLOC_OBJ_SOCKET HWLOC_OBJ_PACKAGE
  28 /* backward compat with v1.10 before Node->NUMANode clarification */
  29 #define HWLOC_OBJ_NODE HWLOC_OBJ_NUMANODE
  30 
  31 /** \brief Insert a misc object by parent.
  32  *
  33  * Identical to hwloc_topology_insert_misc_object().
  34  */
  35 static __hwloc_inline hwloc_obj_t
  36 hwloc_topology_insert_misc_object_by_parent(hwloc_topology_t topology, hwloc_obj_t parent, const char *name) __hwloc_attribute_deprecated;
  37 static __hwloc_inline hwloc_obj_t
  38 hwloc_topology_insert_misc_object_by_parent(hwloc_topology_t topology, hwloc_obj_t parent, const char *name)
  39 {
  40   return hwloc_topology_insert_misc_object(topology, parent, name);
  41 }
  42 
  43 /** \brief Stringify the cpuset containing a set of objects.
  44  *
  45  * If \p size is 0, \p string may safely be \c NULL.
  46  *
  47  * \return the number of character that were actually written if not truncating,
  48  * or that would have been written (not including the ending \\0).
  49  */
  50 static __hwloc_inline int
  51 hwloc_obj_cpuset_snprintf(char *str, size_t size, size_t nobj, struct hwloc_obj * const *objs) __hwloc_attribute_deprecated;
  52 static __hwloc_inline int
  53 hwloc_obj_cpuset_snprintf(char *str, size_t size, size_t nobj, struct hwloc_obj * const *objs)
  54 {
  55   hwloc_bitmap_t set = hwloc_bitmap_alloc();
  56   int res;
  57   unsigned i;
  58 
  59   hwloc_bitmap_zero(set);
  60   for(i=0; i<nobj; i++)
  61     if (objs[i]->cpuset)
  62       hwloc_bitmap_or(set, set, objs[i]->cpuset);
  63 
  64   res = hwloc_bitmap_snprintf(str, size, set);
  65   hwloc_bitmap_free(set);
  66   return res;
  67 }
  68 
  69 /** \brief Convert a type string into a type and some attributes.
  70  *
  71  * Deprecated by hwloc_type_sscanf()
  72  */
  73 static __hwloc_inline int
  74 hwloc_obj_type_sscanf(const char *string, hwloc_obj_type_t *typep, int *depthattrp, void *typeattrp, size_t typeattrsize) __hwloc_attribute_deprecated;
  75 static __hwloc_inline int
  76 hwloc_obj_type_sscanf(const char *string, hwloc_obj_type_t *typep, int *depthattrp, void *typeattrp, size_t typeattrsize)
  77 {
  78   union hwloc_obj_attr_u attr;
  79   int err = hwloc_type_sscanf(string, typep, &attr, sizeof(attr));
  80   if (err < 0)
  81     return err;
  82   if (hwloc_obj_type_is_cache(*typep)) {
  83     if (depthattrp)
  84       *depthattrp = (int) attr.cache.depth;
  85     if (typeattrp && typeattrsize >= sizeof(hwloc_obj_cache_type_t))
  86       memcpy(typeattrp, &attr.cache.type, sizeof(hwloc_obj_cache_type_t));
  87   } else if (*typep == HWLOC_OBJ_GROUP) {
  88     if (depthattrp)
  89       *depthattrp = (int) attr.group.depth;
  90   }
  91   return 0;
  92 }
  93 
  94 /** \brief Set the default memory binding policy of the current
  95  * process or thread to prefer the NUMA node(s) specified by physical \p nodeset
  96  */
  97 static __hwloc_inline int
  98 hwloc_set_membind_nodeset(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_deprecated;
  99 static __hwloc_inline int
 100 hwloc_set_membind_nodeset(hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
 101 {
 102   return hwloc_set_membind(topology, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
 103 }
 104 
 105 /** \brief Query the default memory binding policy and physical locality of the
 106  * current process or thread.
 107  */
 108 static __hwloc_inline int
 109 hwloc_get_membind_nodeset(hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags) __hwloc_attribute_deprecated;
 110 static __hwloc_inline int
 111 hwloc_get_membind_nodeset(hwloc_topology_t topology, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags)
 112 {
 113   return hwloc_get_membind(topology, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
 114 }
 115 
 116 /** \brief Set the default memory binding policy of the specified
 117  * process to prefer the NUMA node(s) specified by physical \p nodeset
 118  */
 119 static __hwloc_inline int
 120 hwloc_set_proc_membind_nodeset(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_deprecated;
 121 static __hwloc_inline int
 122 hwloc_set_proc_membind_nodeset(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
 123 {
 124   return hwloc_set_proc_membind(topology, pid, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
 125 }
 126 
 127 /** \brief Query the default memory binding policy and physical locality of the
 128  * specified process.
 129  */
 130 static __hwloc_inline int
 131 hwloc_get_proc_membind_nodeset(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags) __hwloc_attribute_deprecated;
 132 static __hwloc_inline int
 133 hwloc_get_proc_membind_nodeset(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags)
 134 {
 135   return hwloc_get_proc_membind(topology, pid, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
 136 }
 137 
 138 /** \brief Bind the already-allocated memory identified by (addr, len)
 139  * to the NUMA node(s) in physical \p nodeset.
 140  */
 141 static __hwloc_inline int
 142 hwloc_set_area_membind_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_deprecated;
 143 static __hwloc_inline int
 144 hwloc_set_area_membind_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
 145 {
 146   return hwloc_set_area_membind(topology, addr, len, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
 147 }
 148 
 149 /** \brief Query the physical NUMA node(s) and binding policy of the memory
 150  * identified by (\p addr, \p len ).
 151  */
 152 static __hwloc_inline int
 153 hwloc_get_area_membind_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags) __hwloc_attribute_deprecated;
 154 static __hwloc_inline int
 155 hwloc_get_area_membind_nodeset(hwloc_topology_t topology, const void *addr, size_t len, hwloc_nodeset_t nodeset, hwloc_membind_policy_t * policy, int flags)
 156 {
 157   return hwloc_get_area_membind(topology, addr, len, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
 158 }
 159 
 160 /** \brief Allocate some memory on the given physical nodeset \p nodeset
 161  */
 162 static __hwloc_inline void *
 163 hwloc_alloc_membind_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_malloc __hwloc_attribute_deprecated;
 164 static __hwloc_inline void *
 165 hwloc_alloc_membind_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
 166 {
 167   return hwloc_alloc_membind(topology, len, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
 168 }
 169 
 170 /** \brief Allocate some memory on the given nodeset \p nodeset.
 171  */
 172 static __hwloc_inline void *
 173 hwloc_alloc_membind_policy_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) __hwloc_attribute_malloc __hwloc_attribute_deprecated;
 174 static __hwloc_inline void *
 175 hwloc_alloc_membind_policy_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags)
 176 {
 177   return hwloc_alloc_membind_policy(topology, len, nodeset, policy, flags | HWLOC_MEMBIND_BYNODESET);
 178 }
 179 
 180 /** \brief Convert a CPU set into a NUMA node set and handle non-NUMA cases
 181  */
 182 static __hwloc_inline void
 183 hwloc_cpuset_to_nodeset_strict(hwloc_topology_t topology, hwloc_const_cpuset_t _cpuset, hwloc_nodeset_t nodeset) __hwloc_attribute_deprecated;
 184 static __hwloc_inline void
 185 hwloc_cpuset_to_nodeset_strict(hwloc_topology_t topology, hwloc_const_cpuset_t _cpuset, hwloc_nodeset_t nodeset)
 186 {
 187   hwloc_cpuset_to_nodeset(topology, _cpuset, nodeset);
 188 }
 189 
 190 /** \brief Convert a NUMA node set into a CPU set and handle non-NUMA cases
 191  */
 192 static __hwloc_inline void
 193 hwloc_cpuset_from_nodeset_strict(hwloc_topology_t topology, hwloc_cpuset_t _cpuset, hwloc_const_nodeset_t nodeset) __hwloc_attribute_deprecated;
 194 static __hwloc_inline void
 195 hwloc_cpuset_from_nodeset_strict(hwloc_topology_t topology, hwloc_cpuset_t _cpuset, hwloc_const_nodeset_t nodeset)
 196 {
 197   hwloc_cpuset_from_nodeset(topology, _cpuset, nodeset);
 198 }
 199 
 200 
 201 #ifdef __cplusplus
 202 } /* extern "C" */
 203 #endif
 204 
 205 
 206 #endif /* HWLOC_DEPRECATED_H */

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