Exemplo n.º 1
0
def DataFrameFromBundle(bundle):
    """Generates a DataFrame from a datreant bundle."""
    df = pd.DataFrame(
        columns=["module", "nodes", "ns/day", "run time [min]", "gpu", "host", "ncores"]
    )

    for i, sim in enumerate(bundle):
        # older versions wrote a version category. This ensures backwards compatibility
        if "module" in sim.categories:
            module = sim.categories["module"]
        else:
            module = sim.categories["version"]
        # call the engine specific analysis functions
        engine = detect_md_engine(module)
        df.loc[i] = utils.analyze_run(engine=engine, sim=sim)

    if df.empty:
        console.error("There is no data for the given path.")

    # Sort values by `nodes`
    df = df.sort_values(
        ["host", "module", "run time [min]", "gpu", "nodes"]
    ).reset_index(drop=True)

    return df
Exemplo n.º 2
0
def test_analyze_run(sim):
    res = utils.analyze_run(namd, sim)
    assert res[0] == "namd/11"  # version
    assert res[1] == 42  # nodes
    assert np.isnan(res[2])  # ns_day
    assert res[3] == 0  # time
    assert not res[4]  # gpu
    assert res[5] == "draco"  # host
    assert np.isnan(res[6])  # ncores
Exemplo n.º 3
0
def test_analyze_run_backward_compatibility(sim_old):
    res = utils.analyze_run(gromacs, sim_old)
    assert res[0] == "5.1.4"  # version
    assert res[1] == 42  # nodes
    assert np.isnan(res[2])  # ns_day
    assert res[3] == 0  # time
    assert not res[4]  # gpu
    assert res[5] == "draco"  # host
    assert np.isnan(res[6])  # ncores