Ejemplo n.º 1
0
def main():
    some_task(mapper=0, tag=0)

    for i in IndexLaunch([2], mapper=0, tag=0):
        some_task()

    index_launch([2], some_task, mapper=0, tag=0)
Ejemplo n.º 2
0
def main():
    global global_var

    global_procs = pygion.Tunable.select(pygion.Tunable.GLOBAL_PYS).get()

    with pygion.MustEpochLaunch():  # implicit launch domain
        for i in range(global_procs):
            hi(i, point=i)
    pygion.execution_fence(block=True)

    assert global_var == 4123

    global_var = 456

    with pygion.MustEpochLaunch([global_procs]):
        for i in range(global_procs):
            hi(i, point=i)
    pygion.execution_fence(block=True)

    assert global_var == 4456

    global_var = 789

    with pygion.MustEpochLaunch([global_procs]):
        pygion.index_launch([global_procs], hi, ID)
    pygion.execution_fence(block=True)

    assert global_var == 4789
Ejemplo n.º 3
0
def main():
    futures = []
    for i in IndexLaunch(10):
        futures.append(hi(i))
    for i, future in enumerate(futures):
        print("got %s" % future.get())
        assert int(future.get()) == i

    # Same in 2 dimensions.
    futures = []
    for point in IndexLaunch([3, 3]):
        futures.append(hi(point))
    for i, point in enumerate(Domain([3, 3])):
        assert futures[i].get() == point

    R = Region([4, 4], {'x': pygion.float64})
    P = Partition.equal(R, [2, 2])
    pygion.fill(R, 'x', 0)

    for i in IndexLaunch([2, 2]):
        hello(R, i)

    for i in IndexLaunch([2, 2]):
        hello(P[i], i)

    # Again, with a more explicit syntax.
    # ID is the name of the (implicit) loop variable.
    futures = index_launch([3, 3], hi, ID)
    for point in Domain([3, 3]):
        assert futures[point].get() == point

    index_launch([2, 2], hello, R, ID)
    index_launch([2, 2], hello, P[ID], ID)
Ejemplo n.º 4
0
def main():
    R = pygion.Region([4], {'x': pygion.float64})
    P = pygion.Partition.equal(R, [4])
    pygion.fill(R, 'x', 0)

    hello2(P[0], 0)

    for i in pygion.IndexLaunch([4]):
        hello2(P[i], i)

    pygion.index_launch([4], hello2, P[ID], ID)

    # FIXME: This is needed in nopaint to avoid a race with region deletion
    pygion.execution_fence()
Ejemplo n.º 5
0
def main():
    R = Region([4, 4], {'x': pygion.float64})
    P = Partition.equal(R, [2, 2])
    pygion.fill(R, 'x', 0)

    trace1 = Trace()
    for t in range(5):
        with trace1:
            for i in IndexLaunch([2, 2]):
                look(R, i)

            for i in IndexLaunch([2, 2]):
                incr(P[i], i)

    trace2 = Trace()
    for t in range(5):
        with trace2:
            index_launch([2, 2], look, R, ID)
            index_launch([2, 2], incr, P[ID], ID)
Ejemplo n.º 6
0
def main():
    print_once('Running stencil.py')

    conf = parse_args(pygion.input_args(True))

    nbloated = np.array([conf.nx, conf.ny])
    nt = np.array([conf.ntx, conf.nty])
    init = conf.init

    n = nbloated - 2 * RADIUS
    assert np.all(n >= nt), "grid too small"

    grid = Ispace(n + nt * 2 * RADIUS)
    tiles = Ispace(nt)

    point = Fspace(OrderedDict([
        ('input', DTYPE),
        ('output', DTYPE),
    ]))

    points = Region(grid, point)

    private = make_private_partition(points, tiles, n, nt)
    interior = make_interior_partition(points, tiles, n, nt)
    exterior = make_exterior_partition(points, tiles, n, nt)

    xm = Region([nt[0] * RADIUS, n[1]], point)
    xp = Region([nt[0] * RADIUS, n[1]], point)
    ym = Region([n[0], nt[1] * RADIUS], point)
    yp = Region([n[0], nt[1] * RADIUS], point)
    pxm_in = make_ghost_x_partition(xm, tiles, n, nt, -1)
    pxp_in = make_ghost_x_partition(xp, tiles, n, nt, 1)
    pym_in = make_ghost_y_partition(ym, tiles, n, nt, -1)
    pyp_in = make_ghost_y_partition(yp, tiles, n, nt, 1)
    pxm_out = make_ghost_x_partition(xm, tiles, n, nt, 0)
    pxp_out = make_ghost_x_partition(xp, tiles, n, nt, 0)
    pym_out = make_ghost_y_partition(ym, tiles, n, nt, 0)
    pyp_out = make_ghost_y_partition(yp, tiles, n, nt, 0)

    init = conf.init

    for r in [points, xm, xp, ym, yp]:
        for f in ['input', 'output']:
            pygion.fill(r, f, init)

    tsteps = conf.tsteps + 2 * conf.tprune
    tprune = conf.tprune

    trace = Trace()
    for t in range(tsteps):
        if t == tprune:
            pygion.execution_fence(block=True)
            start_time = pygion.c.legion_get_current_time_in_nanos()
        with trace:
            if _constant_time_launches:
                index_launch(tiles, stencil, private[ID], interior[ID],
                             pxm_in[ID], pxp_in[ID], pym_in[ID], pyp_in[ID],
                             False)
                index_launch(tiles, increment, private[ID], exterior[ID],
                             pxm_out[ID], pxp_out[ID], pym_out[ID],
                             pyp_out[ID], False)
            else:
                for i in IndexLaunch(tiles):
                    stencil(private[i], interior[i], pxm_in[i], pxp_in[i],
                            pym_in[i], pyp_in[i], False)
                for i in IndexLaunch(tiles):
                    increment(private[i], exterior[i], pxm_out[i], pxp_out[i],
                              pym_out[i], pyp_out[i], False)
        if t == tsteps - tprune - 1:
            pygion.execution_fence(block=True)
            stop_time = pygion.c.legion_get_current_time_in_nanos()

    if _constant_time_launches:
        index_launch(tiles, check, private[ID], interior[ID], tsteps, init)
    else:
        for i in IndexLaunch(tiles):
            check(private[i], interior[i], tsteps, init)

    print_once('ELAPSED TIME = %7.3f s' % ((stop_time - start_time) / 1e9))
Ejemplo n.º 7
0
def main():
    print_once('Running pennant.py')

    conf = read_config().get()

    zone = Fspace(
        OrderedDict([
            ('zxp_x', pygion.float64),
            ('zxp_y', pygion.float64),
            ('zx_x', pygion.float64),
            ('zx_y', pygion.float64),
            ('zareap', pygion.float64),
            ('zarea', pygion.float64),
            ('zvol0', pygion.float64),
            ('zvolp', pygion.float64),
            ('zvol', pygion.float64),
            ('zdl', pygion.float64),
            ('zm', pygion.float64),
            ('zrp', pygion.float64),
            ('zr', pygion.float64),
            ('ze', pygion.float64),
            ('zetot', pygion.float64),
            ('zw', pygion.float64),
            ('zwrate', pygion.float64),
            ('zp', pygion.float64),
            ('zss', pygion.float64),
            ('zdu', pygion.float64),
            ('zuc_x', pygion.float64),
            ('zuc_y', pygion.float64),
            ('z0tmp', pygion.float64),
            ('znump', pygion.uint8),
        ]))

    point = Fspace(
        OrderedDict([
            ('px0_x', pygion.float64),
            ('px0_y', pygion.float64),
            ('pxp_x', pygion.float64),
            ('pxp_y', pygion.float64),
            ('px_x', pygion.float64),
            ('px_y', pygion.float64),
            ('pu0_x', pygion.float64),
            ('pu0_y', pygion.float64),
            ('pu_x', pygion.float64),
            ('pu_y', pygion.float64),
            ('pap_x', pygion.float64),
            ('pap_y', pygion.float64),
            ('pf_x', pygion.float64),
            ('pf_y', pygion.float64),
            ('pmaswt', pygion.float64),
            ('has_bcx', pygion.bool_),
            ('has_bcy', pygion.bool_),
        ]))

    side = Fspace(
        OrderedDict([
            ('mapsz', pygion.int1d),
            ('mapsp1', pygion.int1d),
            ('mapsp1_r', pygion.uint8),
            ('mapsp2', pygion.int1d),
            ('mapsp2_r', pygion.uint8),
            ('mapss3', pygion.int1d),
            ('mapss4', pygion.int1d),
            ('sareap', pygion.float64),
            ('sarea', pygion.float64),
            ('svolp', pygion.float64),
            ('svol', pygion.float64),
            ('ssurfp_x', pygion.float64),
            ('ssurfp_y', pygion.float64),
            ('smf', pygion.float64),
            ('sfp_x', pygion.float64),
            ('sfp_y', pygion.float64),
            ('sft_x', pygion.float64),
            ('sft_y', pygion.float64),
            ('sfq_x', pygion.float64),
            ('sfq_y', pygion.float64),
            ('exp_x', pygion.float64),
            ('exp_y', pygion.float64),
            ('ex_x', pygion.float64),
            ('ex_y', pygion.float64),
            ('elen', pygion.float64),
            ('carea', pygion.float64),
            ('cevol', pygion.float64),
            ('cdu', pygion.float64),
            ('cdiv', pygion.float64),
            ('ccos', pygion.float64),
            ('cqe1_x', pygion.float64),
            ('cqe1_y', pygion.float64),
            ('cqe2_x', pygion.float64),
            ('cqe2_y', pygion.float64),
        ]))

    izones = Ispace([conf.nz], name="zones")
    ipoints = Ispace([conf.np], name="points")
    isides = Ispace([conf.ns], name="sides")

    zones = Region(izones, zone, name="zones")
    points = Region(ipoints, point, name="points")
    sides = Region(isides, side, name="sides")

    assert conf.seq_init or conf.par_init, 'enable one of sequential or parallel initialization'

    if conf.seq_init:
        colorings = read_input_sequential(zones, points, sides, conf).get()

    assert conf.par_init
    partitions = read_partitions(zones, points, sides, conf).get()

    pieces = Ispace([conf.npieces], name="pieces")

    zones_part = create_partition(True, zones, partitions.rz_all_p, pieces)

    points_part = create_partition(True, points, partitions.rp_all_p, [2])
    private = points_part[0]
    ghost = points_part[1]

    private_part = create_partition(True, private, partitions.rp_all_private_p,
                                    pieces)
    ghost_part = create_partition(False, ghost, partitions.rp_all_ghost_p,
                                  pieces)
    shared_part = create_partition(True, ghost, partitions.rp_all_shared_p,
                                   pieces)

    sides_part = create_partition(True, sides, partitions.rs_all_p, pieces)

    if conf.par_init:
        if _constant_time_launches:
            c = Future(conf, value_type=config)
            index_launch(pieces, initialize_topology, c, ID, zones_part[ID],
                         private_part[ID], shared_part[ID], ghost_part[ID],
                         sides_part[ID])
        else:
            for i in IndexLaunch(pieces):
                initialize_topology(conf, i, zones_part[i], private_part[i],
                                    shared_part[i], ghost_part[i],
                                    sides_part[i])

    if _constant_time_launches:
        index_launch(pieces, init_pointers, zones_part[ID], private_part[ID],
                     ghost_part[ID], sides_part[ID])

        index_launch(pieces, init_mesh_zones, zones_part[ID])

        index_launch(pieces, calc_centers_full, zones_part[ID],
                     private_part[ID], ghost_part[ID], sides_part[ID], True)

        index_launch(pieces, calc_volumes_full, zones_part[ID],
                     private_part[ID], ghost_part[ID], sides_part[ID], True)

        index_launch(pieces, init_side_fracs, zones_part[ID], private_part[ID],
                     ghost_part[ID], sides_part[ID])

        index_launch(pieces, init_hydro, zones_part[ID], conf.rinit,
                     conf.einit, conf.rinitsub, conf.einitsub,
                     conf.subregion[0], conf.subregion[1], conf.subregion[2],
                     conf.subregion[3])

        index_launch(pieces, init_radial_velocity, private_part[ID],
                     conf.uinitradial)

        index_launch(pieces, init_radial_velocity, shared_part[ID],
                     conf.uinitradial)
    else:
        for i in IndexLaunch(pieces):
            init_pointers(zones_part[i], private_part[i], ghost_part[i],
                          sides_part[i])

        for i in IndexLaunch(pieces):
            init_mesh_zones(zones_part[i])

        for i in IndexLaunch(pieces):
            calc_centers_full(zones_part[i], private_part[i], ghost_part[i],
                              sides_part[i], True)

        for i in IndexLaunch(pieces):
            calc_volumes_full(zones_part[i], private_part[i], ghost_part[i],
                              sides_part[i], True)

        for i in IndexLaunch(pieces):
            init_side_fracs(zones_part[i], private_part[i], ghost_part[i],
                            sides_part[i])

        for i in IndexLaunch(pieces):
            init_hydro(zones_part[i], conf.rinit, conf.einit, conf.rinitsub,
                       conf.einitsub, conf.subregion[0], conf.subregion[1],
                       conf.subregion[2], conf.subregion[3])

        for i in IndexLaunch(pieces):
            init_radial_velocity(private_part[i], conf.uinitradial)

        for i in IndexLaunch(pieces):
            init_radial_velocity(shared_part[i], conf.uinitradial)

    cycle = 0
    cstop = conf.cstop + 2 * conf.prune
    time = 0.0
    dt = Future(conf.dtmax, pygion.float64)
    dthydro = conf.dtmax
    while cycle < cstop and time < conf.tstop:
        if cycle == conf.prune:
            pygion.execution_fence(block=True)
            start_time = pygion.c.legion_get_current_time_in_nanos()

        if _constant_time_launches:
            index_launch(pieces, init_step_points, private_part[ID], True)

            index_launch(pieces, init_step_points, shared_part[ID], True)

            index_launch(pieces, init_step_zones, zones_part[ID], True)

            dt = calc_global_dt(dt, conf.dtfac, conf.dtinit, conf.dtmax,
                                dthydro, time, conf.tstop, cycle)

            index_launch(pieces, adv_pos_half, private_part[ID], dt, True)

            index_launch(pieces, adv_pos_half, shared_part[ID], dt, True)

            index_launch(pieces, calc_centers, zones_part[ID],
                         private_part[ID], ghost_part[ID], sides_part[ID],
                         True)

            index_launch(pieces, calc_volumes, zones_part[ID],
                         private_part[ID], ghost_part[ID], sides_part[ID],
                         True)

            index_launch(pieces, calc_char_len, zones_part[ID],
                         private_part[ID], ghost_part[ID], sides_part[ID],
                         True)

            index_launch(pieces, calc_rho_half, zones_part[ID], True)

            index_launch(pieces, sum_point_mass, zones_part[ID],
                         private_part[ID], ghost_part[ID], sides_part[ID],
                         True)

            index_launch(pieces, calc_state_at_half, zones_part[ID],
                         conf.gamma, conf.ssmin, dt, True)

            index_launch(pieces, calc_force_pgas_tts, zones_part[ID],
                         private_part[ID], ghost_part[ID], sides_part[ID],
                         conf.alfa, conf.ssmin, True)

            index_launch(pieces, qcs_zone_center_velocity, zones_part[ID],
                         private_part[ID], ghost_part[ID], sides_part[ID],
                         True)

            index_launch(pieces, qcs_corner_divergence, zones_part[ID],
                         private_part[ID], ghost_part[ID], sides_part[ID],
                         True)

            index_launch(pieces, qcs_qcn_force, zones_part[ID],
                         private_part[ID], ghost_part[ID], sides_part[ID],
                         conf.gamma, conf.q1, conf.q2, True)

            index_launch(pieces, qcs_force, zones_part[ID], private_part[ID],
                         ghost_part[ID], sides_part[ID], True)

            index_launch(pieces, qcs_vel_diff, zones_part[ID],
                         private_part[ID], ghost_part[ID], sides_part[ID],
                         conf.q1, conf.q2, True)

            index_launch(pieces, sum_point_force, zones_part[ID],
                         private_part[ID], ghost_part[ID], sides_part[ID],
                         True)

            index_launch(pieces, apply_boundary_conditions, private_part[ID],
                         True)

            index_launch(pieces, apply_boundary_conditions, shared_part[ID],
                         True)

            index_launch(pieces, adv_pos_full, private_part[ID], dt, True)

            index_launch(pieces, adv_pos_full, shared_part[ID], dt, True)

            index_launch(pieces, calc_centers_full, zones_part[ID],
                         private_part[ID], ghost_part[ID], sides_part[ID],
                         True)

            index_launch(pieces, calc_volumes_full, zones_part[ID],
                         private_part[ID], ghost_part[ID], sides_part[ID],
                         True)

            index_launch(pieces, calc_work, zones_part[ID], private_part[ID],
                         ghost_part[ID], sides_part[ID], dt, True)

            index_launch(pieces, calc_work_rate_energy_rho_full,
                         zones_part[ID], dt, True)

            dthydro = index_launch(pieces,
                                   calc_dt_hydro,
                                   zones_part[ID],
                                   dt,
                                   conf.dtmax,
                                   conf.cfl,
                                   conf.cflv,
                                   True,
                                   reduce='min')
        else:
            for i in IndexLaunch(pieces):
                init_step_points(private_part[i], True)

            for i in IndexLaunch(pieces):
                init_step_points(shared_part[i], True)

            for i in IndexLaunch(pieces):
                init_step_zones(zones_part[i], True)

            dt = calc_global_dt(dt, conf.dtfac, conf.dtinit, conf.dtmax,
                                dthydro, time, conf.tstop, cycle)

            for i in IndexLaunch(pieces):
                adv_pos_half(private_part[i], dt, True)

            for i in IndexLaunch(pieces):
                adv_pos_half(shared_part[i], dt, True)

            for i in IndexLaunch(pieces):
                calc_centers(zones_part[i], private_part[i], ghost_part[i],
                             sides_part[i], True)

            for i in IndexLaunch(pieces):
                calc_volumes(zones_part[i], private_part[i], ghost_part[i],
                             sides_part[i], True)

            for i in IndexLaunch(pieces):
                calc_char_len(zones_part[i], private_part[i], ghost_part[i],
                              sides_part[i], True)

            for i in IndexLaunch(pieces):
                calc_rho_half(zones_part[i], True)

            for i in IndexLaunch(pieces):
                sum_point_mass(zones_part[i], private_part[i], ghost_part[i],
                               sides_part[i], True)

            for i in IndexLaunch(pieces):
                calc_state_at_half(zones_part[i], conf.gamma, conf.ssmin, dt,
                                   True)

            for i in IndexLaunch(pieces):
                calc_force_pgas_tts(zones_part[i], private_part[i],
                                    ghost_part[i], sides_part[i], conf.alfa,
                                    conf.ssmin, True)

            for i in IndexLaunch(pieces):
                qcs_zone_center_velocity(zones_part[i], private_part[i],
                                         ghost_part[i], sides_part[i], True)

            for i in IndexLaunch(pieces):
                qcs_corner_divergence(zones_part[i], private_part[i],
                                      ghost_part[i], sides_part[i], True)

            for i in IndexLaunch(pieces):
                qcs_qcn_force(zones_part[i], private_part[i], ghost_part[i],
                              sides_part[i], conf.gamma, conf.q1, conf.q2,
                              True)

            for i in IndexLaunch(pieces):
                qcs_force(zones_part[i], private_part[i], ghost_part[i],
                          sides_part[i], True)

            for i in IndexLaunch(pieces):
                qcs_vel_diff(zones_part[i], private_part[i], ghost_part[i],
                             sides_part[i], conf.q1, conf.q2, True)

            for i in IndexLaunch(pieces):
                sum_point_force(zones_part[i], private_part[i], ghost_part[i],
                                sides_part[i], True)

            for i in IndexLaunch(pieces):
                apply_boundary_conditions(private_part[i], True)

            for i in IndexLaunch(pieces):
                apply_boundary_conditions(shared_part[i], True)

            for i in IndexLaunch(pieces):
                adv_pos_full(private_part[i], dt, True)

            for i in IndexLaunch(pieces):
                adv_pos_full(shared_part[i], dt, True)

            for i in IndexLaunch(pieces):
                calc_centers_full(zones_part[i], private_part[i],
                                  ghost_part[i], sides_part[i], True)

            for i in IndexLaunch(pieces):
                calc_volumes_full(zones_part[i], private_part[i],
                                  ghost_part[i], sides_part[i], True)

            for i in IndexLaunch(pieces):
                calc_work(zones_part[i], private_part[i], ghost_part[i],
                          sides_part[i], dt, True)

            for i in IndexLaunch(pieces):
                calc_work_rate_energy_rho_full(zones_part[i], dt, True)

            futures = []
            for i in IndexLaunch(pieces):
                futures.append(
                    calc_dt_hydro(zones_part[i], dt, conf.dtmax, conf.cfl,
                                  conf.cflv, True))

            dthydro = conf.dtmax
            dthydro = min(dthydro, *list(map(lambda x: x.get(), futures)))

        cycle += 1
        time += dt.get()

        if cycle == cstop - conf.prune:
            pygion.execution_fence(block=True)
            stop_time = pygion.c.legion_get_current_time_in_nanos()

    if conf.seq_init:
        validate_output_sequential(zones, points, sides, conf)
    else:
        print_once("Warning: Skipping sequential validation")

    print_once("ELAPSED TIME = %7.3f s" % ((stop_time - start_time) / 1e9))
Ejemplo n.º 8
0
def main():
    print_once('Running circuit_sparse.py')

    conf = parse_args(pygion.input_args(True))

    assert conf.num_pieces % conf.pieces_per_superpiece == 0, "pieces should be evenly distributed to superpieces"
    conf.shared_nodes_per_piece = int(
        math.ceil(conf.nodes_per_piece * conf.pct_shared_nodes / 100.0))
    print_once(
        "circuit settings: loops=%d prune=%d pieces=%d (pieces/superpiece=%d) nodes/piece=%d (nodes/piece=%d) wires/piece=%d pct_in_piece=%d seed=%d"
        % (conf.num_loops, conf.prune, conf.num_pieces,
           conf.pieces_per_superpiece, conf.nodes_per_piece,
           conf.shared_nodes_per_piece, conf.wires_per_piece,
           conf.pct_wire_in_piece, conf.random_seed))

    num_pieces = conf.num_pieces
    num_superpieces = conf.num_pieces // conf.pieces_per_superpiece
    num_circuit_nodes = num_pieces * conf.nodes_per_piece
    num_circuit_wires = num_pieces * conf.wires_per_piece

    node = Fspace(
        OrderedDict([
            ('node_cap', pygion.float32),
            ('leakage', pygion.float32),
            ('charge', pygion.float32),
            ('node_voltage', pygion.float32),
        ]))
    wire = Fspace(
        OrderedDict([
            ('in_ptr', pygion.int64),
            ('in_ptr_r', pygion.uint8),
            ('out_ptr', pygion.int64),
            ('out_ptr_r', pygion.uint8),
            ('inductance', pygion.float32),
            ('resistance', pygion.float32),
            ('wire_cap', pygion.float32),
        ] + [('current_%d' % i, pygion.float32)
             for i in range(WIRE_SEGMENTS)] +
                    [('voltage_%d' % i, pygion.float32)
                     for i in range(WIRE_SEGMENTS - 1)]))

    all_nodes = Region([num_circuit_nodes], node)
    all_wires = Region([num_circuit_wires], wire)

    node_size = np.dtype(list(
        map(lambda x: (x[0], x[1].numpy_type), node.field_types.items())),
                         align=True).itemsize
    wire_size = np.dtype(list(
        map(lambda x: (x[0], x[1].numpy_type), wire.field_types.items())),
                         align=True).itemsize
    print_once("Circuit memory usage:")
    print_once("  Nodes : %10d * %4d bytes = %12d bytes" %
               (num_circuit_nodes, node_size, num_circuit_nodes * node_size))
    print_once("  Wires : %10d * %4d bytes = %12d bytes" %
               (num_circuit_wires, wire_size, num_circuit_wires * wire_size))
    total = ((num_circuit_nodes * node_size) + (num_circuit_wires * wire_size))
    print_once("  Total                             %12d bytes" % total)

    snpp = conf.shared_nodes_per_piece
    pnpp = conf.nodes_per_piece - conf.shared_nodes_per_piece
    pps = conf.pieces_per_superpiece
    num_shared_nodes = num_pieces * snpp

    privacy_coloring = Region([2], {'rect': pygion.rect1d})
    np.copyto(privacy_coloring.rect,
              np.array([(num_shared_nodes, num_circuit_nodes - 1),
                        (0, num_shared_nodes - 1)],
                       dtype=privacy_coloring.rect.dtype),
              casting='no')
    privacy_part = Partition.restrict(privacy_coloring, [2], np.eye(1), [1],
                                      disjoint_complete)
    all_nodes_part = Partition.image(all_nodes, privacy_part, 'rect', [2],
                                     disjoint_complete)

    all_private = all_nodes_part[0]
    all_shared = all_nodes_part[1]

    launch_domain = Ispace([num_superpieces])

    private_part = Partition.restrict(all_private, launch_domain,
                                      np.eye(1) * pnpp * pps,
                                      Domain([pnpp * pps], [num_shared_nodes]),
                                      disjoint_complete)
    shared_part = Partition.restrict(all_shared, launch_domain,
                                     np.eye(1) * snpp * pps, [snpp * pps],
                                     disjoint_complete)

    wires_part = Partition.equal(all_wires, launch_domain)

    ghost_ranges = Region([num_superpieces],
                          OrderedDict([('rect', pygion.rect1d)]))
    ghost_ranges_part = Partition.equal(ghost_ranges, launch_domain)

    if _constant_time_launches:
        c = Future(conf[0], value_type=Config)
        index_launch(launch_domain, init_piece, ID, c, ghost_ranges_part[ID],
                     private_part[ID], shared_part[ID], all_shared,
                     wires_part[ID])
    else:
        for i in IndexLaunch(launch_domain):
            init_piece(i, conf[0], ghost_ranges_part[i], private_part[i],
                       shared_part[i], all_shared, wires_part[i])

    ghost_part = Partition.image(all_shared, ghost_ranges_part, 'rect',
                                 launch_domain)

    if _constant_time_launches:
        index_launch(launch_domain, init_pointers, private_part[ID],
                     shared_part[ID], ghost_part[ID], wires_part[ID])
    else:
        for i in IndexLaunch(launch_domain):
            init_pointers(private_part[i], shared_part[i], ghost_part[i],
                          wires_part[i])

    steps = conf.steps
    prune = conf.prune
    num_loops = conf.num_loops + 2 * prune

    trace = Trace()
    for j in range(num_loops):
        if j == prune:
            pygion.execution_fence(block=True)
            start_time = pygion.c.legion_get_current_time_in_nanos()
        with trace:
            if _constant_time_launches:
                index_launch(launch_domain, calculate_new_currents, False,
                             steps, private_part[ID], shared_part[ID],
                             ghost_part[ID], wires_part[ID])
                index_launch(launch_domain, distribute_charge,
                             private_part[ID], shared_part[ID], ghost_part[ID],
                             wires_part[ID])
                index_launch(launch_domain, update_voltages, False,
                             private_part[ID], shared_part[ID])
            else:
                for i in IndexLaunch(launch_domain):
                    calculate_new_currents(False, steps, private_part[i],
                                           shared_part[i], ghost_part[i],
                                           wires_part[i])
                for i in IndexLaunch(launch_domain):
                    distribute_charge(private_part[i], shared_part[i],
                                      ghost_part[i], wires_part[i])
                for i in IndexLaunch(launch_domain):
                    update_voltages(False, private_part[i], shared_part[i])
        if j == num_loops - prune - 1:
            pygion.execution_fence(block=True)
            stop_time = pygion.c.legion_get_current_time_in_nanos()

    sim_time = (stop_time - start_time) / 1e9
    print_once('ELAPSED TIME = %7.3f s' % sim_time)

    # Compute the floating point operations per second
    num_circuit_nodes = conf.num_pieces * conf.nodes_per_piece
    num_circuit_wires = conf.num_pieces * conf.wires_per_piece
    # calculate currents
    operations = num_circuit_wires * (WIRE_SEGMENTS * 6 +
                                      (WIRE_SEGMENTS - 1) * 4) * conf.steps
    # distribute charge
    operations += (num_circuit_wires * 4)
    # update voltages
    operations += (num_circuit_nodes * 4)
    # multiply by the number of loops
    operations *= conf.num_loops

    # Compute the number of gflops
    gflops = (1e-9 * operations) / sim_time
    print_once("GFLOPS = %7.3f GFLOPS" % gflops)