cputopology.hpp 2.99 KB
/*--------------------------------------------------------*/

/*
@file
@author Ravi Reddy Manumachu <ravi.manumachu@ucd.ie>
@version 1.0
*/

/*-----------------------------------------------------------*/

#ifndef _HCL_CPUTOPOLOGY_HPP_
#define _HCL_CPUTOPOLOGY_HPP_

/*-----------------------------------------------------------*/

namespace hcl {

namespace topology {

/*-----------------------------------------------------------*/

/**
 * Returns the sibling for a CPU.
 *
 * @param sibling Sibling for a CPU.
 *
 * @return HCL_SUCCESS if the query is successful.
 */
int
getSibling(
   const unsigned int cpu,
   std::vector<unsigned int>& siblings
);

/*-----------------------------------------------------------*/

/**
 * Returns the total number of threads per core.
 *
 * @param numTPerCore The number of threads per core.
 *
 * @return HCL_SUCCESS if the query is successful.
 */
int
getNumThreadsPerCore(
   unsigned int* numTPerCore
);

/*-----------------------------------------------------------*/

/**
 * Returns the total number of logical cores.
 *
 * @param numLogicalCPUs The number of logical CPUs.
 *
 * @return HCL_SUCCESS if the query is successful.
 */
int
getNumLogicalCpus(
   unsigned int* numLogicalCPUs
);

/*-----------------------------------------------------------*/

/**
 * Returns the total number of physical cores.
 *
 * @param numPhysicalCPUs The number of physical CPUs.
 *
 * @return HCL_SUCCESS if the query is successful.
 */
int
getNumPhysicalCpus(
   unsigned int* numPhysicalCPUs
);

/*-----------------------------------------------------------*/

/**
 * Returns the number of CPUs in a NUMA node.
 *
 * @param numaNode The NUMA node identifier.
 * @param numCPUs The number of CPUs.
 *
 * @return HCL_SUCCESS if the query is successful.
 */
int
getNumCpus(
   const unsigned int numaNode,
   unsigned int* numCPUs
);

/*-----------------------------------------------------------*/

/**
 * Returns the CPUs in a NUMA node.
 *
 * @param numaNode The NUMA node identifier.
 * @param cpus The number of CPUs.
 *
 * @return HCL_SUCCESS if the query is successful.
 */
int
getCpus(
   const unsigned int numaNode,
   std::vector<unsigned int>& cpus
);

/*-----------------------------------------------------------*/

/**
 * Returns the number of CPU NUMA nodes.
 *
 * @param numNUMAs The number of CPU NUMA nodes.
 *
 * @return HCL_SUCCESS if the query is successful.
 */
int
getNumCpuNumaNodes(
   unsigned int* numNUMAs
);

/*-----------------------------------------------------------*/

/**
 * Returns the CPU NUMA node that has the cpu.
 *
 * @param cpu The cpu.
 * @param numaNode The numa node containing the cpu returned.
 *
 * @return HCL_SUCCESS if the query is successful.
 */
int
getCpuNumaNode(
   const unsigned int cpu,
   unsigned int* numaNode
);

/*-----------------------------------------------------------*/

}

}

/*-----------------------------------------------------------*/

#endif /*_HCL_CPUTOPOLOGY_HPP_ */

/*-------------------------------------------------------------------------*/