コード例 #1
0
    mask_type decode_mapping(hwloc_topology const& t,
        mapping_type& m, std::vector<mask_type>& affinities,
        std::size_t thread_index, error_code& ec)
    {
        std::size_t size = affinities.size();
        mask_type mask;
        switch (m[0].type_) {
        case spec_type::socket:
            // requested top level is a socket
            mask = decode_mapping_socket(t, m, size, thread_index, ec);
            break;

        case spec_type::numanode:
            // requested top level is a NUMA node
            mask = decode_mapping_numanode(t, m, size, thread_index, ec);
            break;

        case spec_type::unknown:
            // no top level is requested
            mask = decode_mapping0_unknown(t, m, size,
                t.get_machine_affinity_mask(), 0, thread_index, ec);
            break;

        default:
            HPX_THROWS_IF(ec, bad_parameter, "decode_mapping",
                boost::str(boost::format("unexpected specification type at "
                    "index zero: %x (%s)") %
                        static_cast<unsigned>(m[0].type_) %
                        spec_type::type_name(m[0].type_)));
            return mask_type();
        }
        return mask;
    }
コード例 #2
0
 mask_cref_type extract_machine_mask(hwloc_topology const& t, error_code& ec)
 {
     return t.get_machine_affinity_mask(ec);
 }