Esempio n. 1
0
def bind(*nodes):
    nodes = list(set(nodes))
    res = ",".join(list(map(str, nodes)))
    c_string = bytes(res, "ascii")
    bitmask = LIBNUMA.numa_parse_nodestring(c_string)
    LIBNUMA.numa_run_on_node_mask(bitmask)
    LIBNUMA.numa_set_membind(bitmask)
Esempio n. 2
0
def set_membind_nodes(*nodes) -> None:
    nodes = list(set(nodes))
    res = ",".join(list(map(str, nodes)))
    c_string = bytes(res, "ascii")
    bitmask = LIBNUMA.numa_parse_nodestring(c_string)
    op_res = LIBNUMA.numa_set_membind(bitmask)
    if op_res == -1:
        raise Exception(f"set membind nodes {res} failed")
Esempio n. 3
0
def run_on_nodes(*nodes):
    """
    :param nodes: numa node to run
    :return:
    """
    nodes = list(set(nodes))
    if len(nodes) == 0:
        bitmask = LIBNUMA.numa_parse_nodestring(b"all")
        op_res = LIBNUMA.numa_run_on_node_mask(bitmask)
        if op_res == -1:
            raise Exception("attempt to run on all nodes failed")
    else:
        res = ",".join(list(map(str, nodes)))
        c_string = bytes(res, "ascii")
        bitmask = LIBNUMA.numa_parse_nodestring(c_string)
        op_res = LIBNUMA.numa_run_on_node_mask(bitmask)
        if op_res == -1:
            raise Exception(f"attempt to run on {res} failed")