本文整理汇总了C++中hwloc_topology::init_socket_affinity_mask_from_socket方法的典型用法代码示例。如果您正苦于以下问题:C++ hwloc_topology::init_socket_affinity_mask_from_socket方法的具体用法?C++ hwloc_topology::init_socket_affinity_mask_from_socket怎么用?C++ hwloc_topology::init_socket_affinity_mask_from_socket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hwloc_topology
的用法示例。
在下文中一共展示了hwloc_topology::init_socket_affinity_mask_from_socket方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decode_mapping_socket
mask_type decode_mapping_socket(hwloc_topology const& t,
mapping_type& m, std::size_t size, std::size_t thread_index,
error_code& ec)
{
bounds_type b = extract_bounds(m[0], size, ec);
if (ec) return 0;
std::size_t index = std::size_t(-1);
if (m[1].type_ == spec_type::unknown &&
m[2].type_ == spec_type::unknown &&
b.size() > 1)
{
index = thread_index;
}
mask_type mask = 0;
std::size_t socket_index = 0;
for (bounds_type::const_iterator it = b.begin(); it != b.end(); ++it, ++socket_index)
{
if (index == std::size_t(-1) || socket_index == index)
mask |= t.init_socket_affinity_mask_from_socket(*it);
}
std::size_t socket_base_index = *b.begin();
if (thread_index != std::size_t(-1) && b.size() > 1)
socket_base_index += thread_index;
std::size_t base_index = 0;
for (std::size_t i = 0; i != socket_base_index; ++i)
base_index += t.get_number_of_socket_cores(i);
return decode_mapping0_unknown(t, m, size, mask, base_index,
thread_index, ec);
}
示例2:
std::vector<mask_info>
extract_socket_masks(hwloc_topology const& t, bounds_type const& b)
{
std::vector<mask_info> masks;
for (std::int64_t index : b)
{
masks.push_back(util::make_tuple(
index, t.init_socket_affinity_mask_from_socket(index)
));
}
return masks;
}