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)
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")