Binds the current thread and its children to the nodes specified in nodemask.
    They will only run on the CPUs of the specified nodes and only be able to allocate memory from them.

    @param nodemask: node mask
    @type nodemask: C{set}

def bind(nodemask):
    """
    Binds the current thread and its children to the nodes specified in nodemask.
    They will only run on the CPUs of the specified nodes and only be able to allocate memory from them.

    @param nodemask: node mask
    @type nodemask: C{set}
    """
    mask = set_to_numa_nodemask(nodemask)
    bitmask = libnuma.numa_allocate_nodemask()
    libnuma.copy_nodemask_to_bitmask(byref(mask), bitmask)
    libnuma.numa_bind(bitmask)
    libnuma.numa_bitmask_free(bitmask)