GHOST  1.1.2
General, Hybrid, and Optimized Sparse Toolkit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
machine.h File Reference

Functions to access machine information. More...

#include <stddef.h>
#include <stdbool.h>
#include <hwloc.h>
#include "error.h"
#include "types.h"
Include dependency graph for machine.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GHOST_NUMANODE_ANY   -1
 

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 *nCores, int numaNode)
 Get the number of (physical) cores in the machine. More...
 
ghost_error ghost_machine_nsmt (int *nLevels)
 Get the number of SMT threads per core 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_nnuma (int *nNodes)
 Get the number of NUMA nodes in the machine. More...
 
ghost_error ghost_machine_nnuma_in_cpuset (int *nNodes, hwloc_const_cpuset_t set)
 
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_numanode (hwloc_obj_t *node, int idx)
 
bool ghost_machine_bigendian ()
 Check whether machine is big endian. More...
 
ghost_error ghost_machine_string (char **str)
 Get a string of the machine information. More...
 
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_implementation ghost_get_best_implementation_for_bytesize (int bytes)
 
int ghost_implementation_alignment (ghost_implementation impl)
 

Detailed Description

Functions to access machine information.

Author
Moritz Kreutzer morit.nosp@m.z.kr.nosp@m.eutze.nosp@m.r@fa.nosp@m.u.de

Macro Definition Documentation

#define GHOST_NUMANODE_ANY   -1

Function Documentation

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.