def kkt_get_nthreads(d):
    """Return sorted list of #threads used in the data. Return also the
    corresponding exespace tuples."""
    s = set()
    for es in d.keys():
        s.add((es[1]*es[2], es))
    s = list(s)
    s.sort()
    return [i[0] for i in s], [i[1] for i in s]