Kokkos Core Kernels Package Version of the Day
Loading...
Searching...
No Matches
Kokkos_hwloc.hpp
1//@HEADER
2// ************************************************************************
3//
4// Kokkos v. 4.0
5// Copyright (2022) National Technology & Engineering
6// Solutions of Sandia, LLC (NTESS).
7//
8// Under the terms of Contract DE-NA0003525 with NTESS,
9// the U.S. Government retains certain rights in this software.
10//
11// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
12// See https://kokkos.org/LICENSE for license information.
13// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
14//
15//@HEADER
16
17#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
18#include <Kokkos_Macros.hpp>
19static_assert(false,
20 "Including non-public Kokkos header files is not allowed.");
21#endif
22#ifndef KOKKOS_HWLOC_HPP
23#define KOKKOS_HWLOC_HPP
24
25#include <Kokkos_Macros.hpp>
26
27#include <utility>
28
29namespace Kokkos {
30
43namespace hwloc {
44
46bool available();
47
53
59
63
64} /* namespace hwloc */
65} /* namespace Kokkos */
66
67//----------------------------------------------------------------------------
68//----------------------------------------------------------------------------
69// Internal functions for binding persistent spawned threads.
70
71namespace Kokkos {
72namespace hwloc {
73
83unsigned thread_mapping(const char* const label, const bool allow_async,
84 unsigned& thread_count, unsigned& use_numa_count,
85 unsigned& use_cores_per_numa,
86 std::pair<unsigned, unsigned> threads_coord[]);
87
97std::pair<unsigned, unsigned> get_this_thread_coordinate();
98
100bool bind_this_thread(const std::pair<unsigned, unsigned>);
101
104
109unsigned bind_this_thread(const unsigned coordinate_count,
110 std::pair<unsigned, unsigned> coordinate[]);
111
114
115} /* namespace hwloc */
116} /* namespace Kokkos */
117
118//----------------------------------------------------------------------------
119//----------------------------------------------------------------------------
120
121#endif /* #define KOKKOS_HWLOC_HPP */
bool bind_this_thread(const std::pair< unsigned, unsigned >)
Bind the current thread to a core.
unsigned get_available_cores_per_numa()
Query number of available cores per NUMA regions. This will be less than the hardware capacity if the...
unsigned get_available_numa_count()
Query number of available NUMA regions. This will be less than the hardware capacity if the MPI proce...
unsigned thread_mapping(const char *const label, const bool allow_async, unsigned &thread_count, unsigned &use_numa_count, unsigned &use_cores_per_numa, std::pair< unsigned, unsigned > threads_coord[])
Recommend mapping of threads onto cores.
bool unbind_this_thread()
Unbind the current thread back to the original process binding.
bool available()
Query if hwloc is available.
std::pair< unsigned, unsigned > get_this_thread_coordinate()
Query core-coordinate of the current thread with respect to the core_topology.
bool can_bind_threads()
Can hwloc bind threads?
unsigned get_available_threads_per_core()
Query number of available "hard" threads per core; i.e., hyperthreads.