Example #1
0
def test_bdf3():
    with open(join(dirname(__file__), "eddy_uv.json")) as f:
        base = json.load(f)
    base["prefix"] = "test_bdf3"
    base["torder"] = 3
    sweep = {"courant": [0.5, 0.25, 0.125]}
    overrides = list(outer_product(sweep))
    for ov in overrides:
        ov["name"] = work_name(base["prefix"], ov)

    workdir = join(base_dir, base["prefix"])
    configs = [
        configure(base, ov, join(base_dir, ov["name"])) for ov in overrides
    ]
    res = [series(config, tusr) for config in configs]
    run_all(res, base)

    errs = {}
    for config in configs:
        with open(join(config["workdir"],
                       "{}-0.stdout".format(config["name"]))) as f:
            test = f.readlines()
        errs[config["courant"]] = np.max(
            np.abs(grep_log(test, "X err", pos=2)[10:]))

    assert errs[.5] / errs[.25] > 6
    assert errs[.5] / errs[.25] < 12
    assert errs[.25] / errs[.125] > 6
    assert errs[.25] / errs[.125] < 12

    return
Example #2
0
def test_bdf4():
    with open(join(dirname(__file__), "eddy_uv.json")) as f:
        base = json.load(f)
    base["prefix"] = "test_bdf4"
    base["torder"] = 4
    sweep = {"courant" : [0.5, 0.25, 0.125]}
    overrides = list(outer_product(sweep))
    for ov in overrides:
        ov["name"] = work_name(base["prefix"], ov)

    workdir = join(base_dir, base["prefix"])
    configs = [configure(base, ov, join(base_dir, ov["name"])) for ov in overrides]
    res = [series(config, tusr) for config in configs]
    run_all(res, base)

    errs = {}
    for config in configs:
        with open(join(config["workdir"], "{}-0.stdout".format(config["name"]))) as f:
            test = f.readlines()    
        errs[config["courant"]] =  np.max(np.abs(grep_log(test, "X err", pos=2)[10:]))

    assert errs[.5] / errs[.25] > 12
    assert errs[.5] / errs[.25] < 24
    assert errs[.25] / errs[.125] > 12
    assert errs[.25] / errs[.125] < 24

    return
Example #3
0
def test_sweep():

    with open(join(dirname(__file__), "LST.json"), "r") as f:
        base = json.load(f)

    with open(join(dirname(__file__), "LST.sweep"), "r") as f:
        sweeps = json.load(f)

    with open(join(dirname(__file__), "LST.tusr"), "r") as f:
        tusr = f.read()

    base["prefix"] = sweeps["prefix"]
    del sweeps["prefix"]

    overrides = list(outer_product(sweeps))
    for ov in overrides:
        ov["name"] = work_name(base["prefix"], ov)

    workdirs = [join(getcwd(), x["name"]) for x in overrides]
    configs = [configure(base, override, workdir) for override, workdir in zip(overrides, workdirs)]
    res = [series(config, tusr, job_step = 25) for config in configs]

    final = run_all(res, base)
Example #4
0
def test_sweep():

    with open(join(dirname(__file__), "LST.json"), "r") as f:
        base = json.load(f)

    with open(join(dirname(__file__), "LST.sweep"), "r") as f:
        sweeps = json.load(f)

    with open(join(dirname(__file__), "LST.tusr"), "r") as f:
        tusr = f.read()

    base["prefix"] = sweeps["prefix"]
    del sweeps["prefix"]

    overrides = list(outer_product(sweeps))
    for ov in overrides:
        ov["name"] = work_name(base["prefix"], ov)

    workdirs = [join(getcwd(), "s", x["name"]) for x in overrides]
    configs = [configure(base, override, workdir) for override, workdir in zip(overrides, workdirs)]
    res = [series(config, tusr, job_step = 25) for config in configs]

    final = run_all(res, base)
Example #5
0
base["prefix"] = 'gb' 

job_sizes=[1,2,4,8,16,32,64,128,256,512,1024,2048,3072]

# Take simple outer product of contents of sweep file
#candidates = [{"nodes" : 2**x} for x in range(6)]
candidates = [{"nodes" : x} for x in job_sizes]

# Filter out the cases we don't want
overrides = []
for c in candidates:
    overrides.append(c)

# Tune the remaining cases
for ov in overrides:
    ov["name"] = work_name(base["prefix"], ov)
    ov["job_name"] = ov["name"] + "-0" 
    span_size = 16
    nelm = ov["nodes"] * 2048
    aspect = nelm*4 / span_size**3
    ov["shape_mesh"] = [span_size, span_size, int(aspect / 4 * span_size)]
    ov["extent_mesh"] = [0.5, 0.5, 1.0 * aspect]
    ov["procs"] = 64*ov["nodes"]
    ov["io_files"] = -ov["nodes"]

from os.path import join
results = []
for ov in overrides:
    workdir = join(getcwd(), ov["name"])
    config = configure(base, ov, workdir)
    input_files = prepare(config, tusr)
with open(argv[2], "r") as f:
    tusr = f.read()

base["prefix"] = 'swp'

# Take simple outer product of contents of sweep file
candidates = [{"nodes": 2**x} for x in range(3)]

# Filter out the cases we don't want
overrides = []
for c in candidates:
    overrides.append(c)

# Tune the remaining cases
for ov in overrides:
    ov["name"] = work_name(base["prefix"], ov)
    ov["job_name"] = ov["name"] + "-0"
    span_size = 16
    nelm = ov["nodes"] * 2048
    aspect = nelm * 4 / span_size**3
    ov["shape_mesh"] = [span_size, span_size, int(aspect / 4 * span_size)]
    ov["extent_mesh"] = [0.5, 0.5, 1.0 * aspect]
    ov["procs"] = 64 * ov["nodes"]
    ov["io_files"] = -ov["nodes"]

from os.path import join
results = []
for ov in overrides:
    workdir = join(getcwd(), ov["name"])
    config = configure(base, ov, workdir)
    input_files = prepare(config, tusr)