Functions to access machine information.
More...
#include <stddef.h>
#include <stdbool.h>
#include <hwloc.h>
#include "error.h"
#include "types.h"
Go to the source code of this file.
Functions to access machine information.
- Author
- Moritz Kreutzer morit.nosp@m.z.kr.nosp@m.eutze.nosp@m.r@fa.nosp@m.u.de
#define GHOST_NUMANODE_ANY -1 |
int ghost_machine_alignment |
( |
| ) |
|
Get the machine's alignment restriction for aligned stores/loads.
- Returns
- The alignment in bytes.
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
-
size | Where 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.
ghost_error ghost_machine_ncore |
( |
int * |
nCores, |
|
|
int |
numaNode |
|
) |
| |
Get the number of (physical) cores in the machine.
- Parameters
-
nCores | Where to store the number of cores. |
numaNode | Only look for PUs inside this NUMA node. |
- Returns
- GHOST_SUCCESS on success or an error indicator.
ghost_error ghost_machine_ncore_in_cpuset |
( |
int * |
nCores, |
|
|
hwloc_const_cpuset_t |
set |
|
) |
| |
Get the number of NUMA nodes in the machine.
- Parameters
-
nNodes | Where to store the number. |
- Returns
- GHOST_SUCCESS on success or an error indicator.
ghost_error ghost_machine_nnuma_in_cpuset |
( |
int * |
nNodes, |
|
|
hwloc_const_cpuset_t |
set |
|
) |
| |
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
-
nPUs | Where to store the number. |
numaNode | Only look for PUs inside this NUMA node. |
- Returns
- GHOST_SUCCESS on success or an error indicator.
ghost_error ghost_machine_npu_in_cpuset |
( |
int * |
nPUs, |
|
|
hwloc_const_cpuset_t |
set |
|
) |
| |
Get the number of SMT threads per core in the machine.
- Parameters
-
nLevels | Where to store the number. |
- Returns
- GHOST_SUCCESS on success or an error indicator.
ghost_error ghost_machine_numanode |
( |
hwloc_obj_t * |
node, |
|
|
int |
idx |
|
) |
| |
int ghost_machine_simd_width |
( |
| ) |
|
Get the machine's SIMD width.
- Returns
- The SIMD width in bytes.
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
-
topo | Where to store the topology. |
- Returns
- GHOST_SUCCESS on success or an error indicator.