root/opal/mca/hwloc/hwloc201/hwloc/hwloc/topology-noos.c

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

DEFINITIONS

This source file includes following definitions.
  1. hwloc_look_noos
  2. hwloc_noos_component_instantiate

   1 /*
   2  * Copyright © 2009 CNRS
   3  * Copyright © 2009-2017 Inria.  All rights reserved.
   4  * Copyright © 2009-2012 Université Bordeaux
   5  * Copyright © 2009-2011 Cisco Systems, Inc.  All rights reserved.
   6  * See COPYING in top-level directory.
   7  */
   8 
   9 #include <private/autogen/config.h>
  10 #include <hwloc.h>
  11 #include <private/private.h>
  12 
  13 static int
  14 hwloc_look_noos(struct hwloc_backend *backend)
  15 {
  16   struct hwloc_topology *topology = backend->topology;
  17   int nbprocs;
  18 
  19   if (topology->levels[0][0]->cpuset)
  20     /* somebody discovered things */
  21     return -1;
  22 
  23   nbprocs = hwloc_fallback_nbprocessors(topology);
  24   if (nbprocs >= 1)
  25     topology->support.discovery->pu = 1;
  26   else
  27     nbprocs = 1;
  28 
  29   hwloc_alloc_root_sets(topology->levels[0][0]);
  30   hwloc_setup_pu_level(topology, nbprocs);
  31   hwloc_add_uname_info(topology, NULL);
  32   return 0;
  33 }
  34 
  35 static struct hwloc_backend *
  36 hwloc_noos_component_instantiate(struct hwloc_disc_component *component,
  37                                  const void *_data1 __hwloc_attribute_unused,
  38                                  const void *_data2 __hwloc_attribute_unused,
  39                                  const void *_data3 __hwloc_attribute_unused)
  40 {
  41   struct hwloc_backend *backend;
  42   backend = hwloc_backend_alloc(component);
  43   if (!backend)
  44     return NULL;
  45   backend->discover = hwloc_look_noos;
  46   return backend;
  47 }
  48 
  49 static struct hwloc_disc_component hwloc_noos_disc_component = {
  50   HWLOC_DISC_COMPONENT_TYPE_CPU,
  51   "no_os",
  52   HWLOC_DISC_COMPONENT_TYPE_GLOBAL,
  53   hwloc_noos_component_instantiate,
  54   40, /* lower than native OS component, higher than globals */
  55   1,
  56   NULL
  57 };
  58 
  59 const struct hwloc_component hwloc_noos_component = {
  60   HWLOC_COMPONENT_ABI,
  61   NULL, NULL,
  62   HWLOC_COMPONENT_TYPE_DISC,
  63   0,
  64   &hwloc_noos_disc_component
  65 };

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