Esempio n. 1
0
File: io.py Progetto: spieseba/gpt
s_slice_2 = res["sdomain"].slice(res["S"], 3)
eps2 = 0.0
for a, b in zip(s_slice, s_slice_2):
    eps2 += g.norm2(a - b)
assert eps2 < 1e-25


# check load out2 with fixed mpi
res = g.load(f"{work_dir}/out2", paths="/U/*")
for i in range(4):
    eps2 = g.norm2(res["U"][i] - U[i])
    g.message("Test second restore of U[%d]:" % i, eps2)
    assert eps2 < 1e-25

# checkpointer save
ckpt = g.checkpointer(f"{work_dir}/ckpt")
alpha = 0.125
ckpt.save([U[0], alpha])

# checkpointer load
ckpt = g.checkpointer(f"{work_dir}/ckpt")
ckpt.grid = U[0].grid
alpha = 0.125
U0_test = g.lattice(U[0])
assert ckpt.load([U0_test, alpha])
assert abs(alpha - 0.125) < 1e-25
assert g.norm2(U0_test - U[0]) == 0.0

# corr-io
corr = [rng.normal().real for i in range(32)]
w = g.corr_io.writer(f"{work_dir}/head.dat")
Esempio n. 2
0
    #    "maxapply" : 100
})

# start vector
path_to_evec = "/hpcgpfs01/scratch/clehner/openQCD/evec"
try:
    evec, ev = g.load(path_to_evec, {"grids": w.F_grid_eo})
except g.LoadError:
    start = g.vspincolor(w.F_grid_eo)
    start[:] = g.vspincolor([[1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1]])

    # generate eigenvectors
    evec, ev_cheby = irl(
        c(eo(w).NDagN),
        start,
        g.checkpointer("/hpcgpfs01/scratch/clehner/openQCD/checkpoint"),
    )
    ev = g.algorithms.eigen.evals(eo(w).Mpc, evec, check_eps2=1e-8, real=True)

    # save eigenvectors
    g.save(path_to_evec, [evec, ev])

# build solver
inv = g.algorithms.inverter
dcg = inv.sequence(inv.deflate(evec, ev), inv.cg({
    "eps": 1e-6,
    "maxiter": 1000
}))
slv = w.propagator(inv.preconditioned(eo, dcg))

# propagator