Esempio n. 1
0
                        f'DEBUG {implement} {grid_points} {frac} {time[implement][frac][float(grid_points)]}'
                    )
            else:
                print('Running ', grid_points, 'gridpoints with ', 100 * frac,
                      '% sea_ice')
                elapsed_time = np.empty(ITER)
                for i in range(ITER):
                    if implement == 'gtcuda' and grid_points >= 32768 * 128:
                        elapsed_time[i] = np.nan
                    else:
                        in_dict = init_dict(grid_points, frac)
                        if implement == 'python':
                            elapsed_time[i] = 1.0
                            out_data, elapsed_time[i] = si_py.run(in_dict)
                        else:
                            out_data, elapsed_time[i] = si_gt4py.run(
                                in_dict, backend=implement)
                time[implement][frac][float(grid_points)] = np.median(
                    elapsed_time)
                pickle.dump(time, open('time.p', 'wb'))

for implement in BACKEND:
    sorted_time = sorted(time[implement].items())
    ys = []
    plt.figure(figsize=(8, 6))
    for key in sorted_time:
        lists = sorted(key[1].items())
        x, y = zip(*lists)
        ys.append(y)
    colors = cm.rainbow(np.linspace(0, 1, len(ys)))
    for y, c, k in zip(ys, colors, sorted_time):
        plt.scatter(x, y, label=str(k[0]), s=8, color=c)
Esempio n. 2
0
            if sp.name != SELECT_SP["savepoint"] and sp.name != SELECT_SP[
                    "savepoint"].replace("-in-", "-out-"):
                continue

        if sp.name.startswith("sfc_sice-in"):

            if isready:
                raise Exception("out-of-order data enountered: " + sp.name)

            print("> running ", f"tile-{tile}", sp)

            # read serialized input data
            in_data = data_dict_from_var_list(IN_VARS, serializer, sp)

            # run Python version
            out_data, elapsed_time = si.run(in_data, backend=BACKEND)

            isready = True

        if sp.name.startswith("sfc_sice-out"):

            if not isready:
                raise Exception("out-of-order data encountered: " + sp.name)

            print("> validating ", f"tile-{tile}", sp)

            # read serialized output data
            ref_data = data_dict_from_var_list(OUT_VARS, serializer, sp)

            # check result
            compare_data(out_data, ref_data)
Esempio n. 3
0
                # read serialized input data
                in_data = data_dict_from_var_list(IN_VARS, serializer, sp)

                if args.parameterization == "lsm":
                    serializer2 = ser.Serializer(ser.OpenModeKind.Read,
                                                 args.data_dir + "/dump",
                                                 "Serialized")

                    in_data_extra = data_dict_from_var_list(
                        IN_VARS_FPVS, serializer2,
                        serializer2.savepoint_list()[0])

                    in_data.update(in_data_extra)

                out_data = phy.run(in_data, timings)

                isready = True

            if sp.name.startswith(prefix + "-out"):

                if not isready:
                    raise Exception("out-of-order data encountered: " +
                                    sp.name)

                print("> validating ", f"tile-{tile}", sp)

                # read serialized output data
                ref_data = data_dict_from_var_list(OUT_VARS, serializer, sp)

                # check result
Esempio n. 4
0
    num_sea_ice = int(num_gridp * frac_gridp)
    for var in IN_VARS:
        if var in SCALAR_VARS:
            d[var] = sea_ice_point[var]
        elif var in TWOD_VARS:
            d[var] = np.empty((num_gridp, 4))
            d[var][:num_sea_ice, :] = sea_ice_point[var]
            d[var][num_sea_ice:, :] = land_point[var]
        elif var in BOOL_VARS:
            d[var] = np.ones(num_gridp, dtype=bool)
            d[var][:num_sea_ice] = sea_ice_point[var]
            d[var][num_sea_ice:] = land_point[var]
        elif var in INT_VARS:
            d[var] = np.ones(num_gridp, dtype=np.int32)
            d[var][:num_sea_ice] = sea_ice_point[var]
            d[var][num_sea_ice:] = land_point[var]
        else:
            d[var] = np.empty(num_gridp)
            d[var][:num_sea_ice] = sea_ice_point[var]
            d[var][num_sea_ice:] = land_point[var]

    d['im'] = num_gridp

    return d


print('Running ', grid_points, 'gridpoints with ', 100 * frac, '% sea_ice')
for i in range(ITER):
    in_dict = init_dict(grid_points, frac)
    out_data, elapsed_time = si_gt4py.run(in_dict, backend=backend)
                    "savepoint"].replace("-in-", "-out-"):
                continue

        if sp.name.startswith("sfc_sice-in"):

            if isready:
                raise Exception("out-of-order data enountered: " + sp.name)

            print("> running ", f"tile-{tile}", sp)

            # read serialized input data
            in_data = data_dict_from_var_list(IN_VARS, serializer, sp)

            # run Python version
            # out_data = si.run(in_data)
            out_data = si.run(in_data, "gtx86")
            isready = True

        if sp.name.startswith("sfc_sice-out"):

            if not isready:
                raise Exception("out-of-order data encountered: " + sp.name)

            print("> validating ", f"tile-{tile}", sp)

            # read serialized output data
            ref_data = data_dict_from_var_list(OUT_VARS, serializer, sp)

            # check result
            compare_data(out_data, ref_data)