GHOST  1.1.2
General, Hybrid, and Optimized Sparse Toolkit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
machine.c File Reference
#include "ghost/machine.h"
#include "ghost/log.h"
#include "ghost/util.h"
#include "ghost/locality.h"
#include "ghost/omp.h"
#include "ghost/core.h"
#include <cpuid.h>
#include <strings.h>
Include dependency graph for machine.c:

Functions

ghost_error ghost_topology_create ()
 Initialize and load the topology object (of type hwloc_topology_t). More...
 
void ghost_topology_destroy ()
 Destroy and free the topology object. More...
 
ghost_error ghost_topology_get (hwloc_topology_t *topo)
 Get to topology object. More...
 
ghost_error ghost_machine_innercache_size (uint64_t *size)
 Get the size of the first level cache. More...
 
ghost_error ghost_machine_outercache_size (uint64_t *size)
 Get the size of the last level cache. More...
 
ghost_error ghost_machine_cacheline_size (unsigned *size)
 Get the cache line siye. More...
 
ghost_error ghost_machine_ncore (int *ncore, int numanode)
 Get the number of (physical) cores in the machine. More...
 
ghost_error ghost_machine_npu (int *nPUs, int numanode)
 Get the number of available hardware threads (= physical cores times SMT level) or processing units in the machine. More...
 
ghost_error ghost_machine_npu_in_cpuset (int *nPUs, hwloc_const_cpuset_t set)
 
ghost_error ghost_machine_ncore_in_cpuset (int *nCores, hwloc_const_cpuset_t set)
 
ghost_error ghost_machine_nsmt (int *nLevels)
 Get the number of SMT threads per core in the machine. More...
 
ghost_error ghost_machine_nnuma_in_cpuset (int *nNodes, hwloc_const_cpuset_t set)
 
ghost_error ghost_machine_nnuma (int *nNodes)
 Get the number of NUMA nodes in the machine. More...
 
bool ghost_machine_bigendian ()
 Check whether machine is big endian. More...
 
static void cpuid (int info[4], int InfoType)
 
int ghost_machine_alignment ()
 Get the machine's alignment restriction for aligned stores/loads. More...
 
int ghost_machine_simd_width ()
 Get the machine's SIMD width. More...
 
ghost_error ghost_machine_numanode (hwloc_obj_t *node, int idx)
 
ghost_error ghost_machine_string (char **str)
 Get a string of the machine information. More...
 
ghost_implementation ghost_get_best_implementation_for_bytesize (int bytes)
 
int ghost_implementation_alignment (ghost_implementation impl)
 

Variables

static hwloc_topology_t ghost_topology = NULL
 

Function Documentation

static void cpuid ( int  info[4],
int  InfoType 
)
static
ghost_implementation ghost_get_best_implementation_for_bytesize ( int  bytes)
int ghost_implementation_alignment ( ghost_implementation  impl)

Here is the call graph for this function:

int ghost_machine_alignment ( )

Get the machine's alignment restriction for aligned stores/loads.

Returns
The alignment in bytes.

Here is the call graph for this function:

bool ghost_machine_bigendian ( )

Check whether machine is big endian.

Returns
true if machine is big endian, false if machine is little endian.
ghost_error ghost_machine_cacheline_size ( unsigned *  size)

Get the cache line siye.

Parameters
sizeWhere to store the size.
Returns
GHOST_SUCCESS on success or an error indicator.

This information may be useful in situations where false sharing has to be avoided.

Here is the call graph for this function:

ghost_error ghost_machine_ncore ( int *  nCores,
int  numaNode 
)

Get the number of (physical) cores in the machine.

Parameters
nCoresWhere to store the number of cores.
numaNodeOnly look for PUs inside this NUMA node.
Returns
GHOST_SUCCESS on success or an error indicator.

Here is the call graph for this function:

ghost_error ghost_machine_ncore_in_cpuset ( int *  nCores,
hwloc_const_cpuset_t  set 
)

Here is the call graph for this function:

ghost_error ghost_machine_nnuma ( int *  nNodes)

Get the number of NUMA nodes in the machine.

Parameters
nNodesWhere to store the number.
Returns
GHOST_SUCCESS on success or an error indicator.

Here is the call graph for this function:

ghost_error ghost_machine_nnuma_in_cpuset ( int *  nNodes,
hwloc_const_cpuset_t  set 
)

Here is the call graph for this function:

ghost_error ghost_machine_npu ( int *  nPUs,
int  numaNode 
)

Get the number of available hardware threads (= physical cores times SMT level) or processing units in the machine.

Parameters
nPUsWhere to store the number.
numaNodeOnly look for PUs inside this NUMA node.
Returns
GHOST_SUCCESS on success or an error indicator.

Here is the call graph for this function:

ghost_error ghost_machine_npu_in_cpuset ( int *  nPUs,
hwloc_const_cpuset_t  set 
)

Here is the call graph for this function:

ghost_error ghost_machine_nsmt ( int *  nLevels)

Get the number of SMT threads per core in the machine.

Parameters
nLevelsWhere to store the number.
Returns
GHOST_SUCCESS on success or an error indicator.

Here is the call graph for this function:

ghost_error ghost_machine_numanode ( hwloc_obj_t *  node,
int  idx 
)

Here is the call graph for this function:

int ghost_machine_simd_width ( )

Get the machine's SIMD width.

Returns
The SIMD width in bytes.

Here is the call graph for this function:

ghost_error ghost_topology_create ( )

Initialize and load the topology object (of type hwloc_topology_t).

Returns
GHOST_SUCCESS on success or an error indicator.

If the topology has been created before, this function returns immediately.

void ghost_topology_destroy ( )

Destroy and free the topology object.

ghost_error ghost_topology_get ( hwloc_topology_t *  topo)

Get to topology object.

Parameters
topoWhere to store the topology.
Returns
GHOST_SUCCESS on success or an error indicator.

Variable Documentation

hwloc_topology_t ghost_topology = NULL
static