예제 #1
0
파일: __init__.py 프로젝트: spieseba/gpt
def next(root, jobs, max_weight=None, stale_seconds=None):
    if g.rank() == 0:
        j = get_next_name(root, jobs, max_weight,
                          stale_seconds).encode("utf-8")
    else:
        j = bytes()

    j_name = g.broadcast(0, j).decode("utf-8")
    for j in jobs:
        if j.name == j_name:
            g.message(f"""
--------------------------------------------------------------------------------
   Start job {j.name}
--------------------------------------------------------------------------------
""")
            t0 = g.time()
            j(root)
            t1 = g.time()
            g.message(f"""
--------------------------------------------------------------------------------
   Completed {j.name} in {t1-t0} seconds
--------------------------------------------------------------------------------
""")
            return j
    return None
예제 #2
0
    def global_sum(self):
        me = str([self.basis.to_array(), self[:]]).encode("utf-8")

        r = tensor(basis([]), self.n_parallel)

        for i in range(gpt.ranks()):
            b, t = eval(gpt.broadcast(i, me).decode("utf-8"))
            ti = tensor(basis(b), self.n_parallel)
            ti[:] = t
            r = r + ti

        return r
예제 #3
0
파일: gpt_io.py 프로젝트: ssolbUR/gpt
 def read_numpy(self, start, end):
     if gpt.rank() == 0:
         self.glb.seek(start, 0)
         crc32_compare = int.from_bytes(self.glb.read(4),
                                        byteorder='little')
         data = self.glb.read(end - start - 4)
     else:
         data = None
         crc32_compare = None
     data = gpt.broadcast(0, data)
     crc32_computed = gpt.crc32(memoryview(data))
     if not crc32_compare is None:
         assert (crc32_computed == crc32_compare)
     return numpy.load(io.BytesIO(data))
예제 #4
0
    return None


if g.rank() == 0:
    first_job = get_job()
    run_jobs = str(
        list(
            filter(
                lambda x: x is not None,
                [first_job] +
                [get_job(first_job[2]) for i in range(1, jobs_per_run)],
            ))).encode("utf-8")
else:
    run_jobs = bytes()
run_jobs = eval(g.broadcast(0, run_jobs).decode("utf-8"))

# every node now knows what to do
g.message("""
================================================================================
       HVP connected run on summit ;  this run will attempt:
================================================================================
""")
for group, job, conf, jid, n in run_jobs:
    g.message(f"""

    Job {jid} / {n} :  configuration {conf}, job tag {job}

""")

# configuration needs to be the same for all jobs, so load eigenvectors and configuration