Example #1
0
def main():
    # No explicit type specified, value is pickled
    f = Future([1, 2, 3])
    print("value of f.get() is %s" % f.get())
    assert f.get() == [1, 2, 3]

    # Explicit type specified, value not pickled
    g = Future(123, legion.int64)
    print("value of g.get() is %s" % g.get())
    assert g.get() == 123

    # Using a buffer object to pass raw bytes
    h = Future.from_buffer('asdf'.encode('utf-8'))
    h_value = codecs.decode(h.get_buffer(), 'utf-8')
    print("value of h.get_raw() is %s" % h_value)
    assert h_value == 'asdf'

    i = Future(return_void(), value_type=legion.void)
    print("value of i.get() is %s" % i.get())

    show(f)
    show(g)
    show_buffer(h)

    show_nested(f)

    for i in legion.IndexLaunch([3]):
        show_index(i, f)
Example #2
0
def main():
    # No explicit type specified, value is pickled
    f = Future([1, 2, 3])
    print("value of f.get() is %s" % f.get())
    assert f.get() == [1, 2, 3]

    # Explicit type specified, value not pickled
    g = Future(123, legion.int64)
    print("value of g.get() is %s" % g.get())
    assert g.get() == 123

    # Using a buffer object to pass raw bytes
    h = Future.from_buffer('asdf'.encode('utf-8'))
    h_value = codecs.decode(h.get_buffer(), 'utf-8')
    print("value of h.get_raw() is %s" % h_value)
    assert h_value == 'asdf'

    i = Future(return_void(), value_type=legion.void)
    print("value of i.get() is %s" % i.get())

    j = return_void()
    print("value of j.get() is %s" % j.get())

    show(f)
    show(g)
    show_buffer(h)

    show_nested(f)

    for i in legion.IndexLaunch([3]):
        show_index(i, f)
Example #3
0
def main():
    myvalue_root = legion.ffi.new('mystruct *')
    myvalue = myvalue_root[0]
    myvalue.x = 123
    myvalue.y = 3.14
    myvalue.z = 65

    # Make a future with the custom struct type.
    g = Future(myvalue, mystruct)
    print("value of g.get() is %s" % g.get())
    assert g.get().x == 123

    # Make a region with the custom struct type.
    R = Region([4], {'myvalue': mystruct})
    region_with_struct(R)
Example #4
0
def main():
    # No explicit type specified, value is pickled
    f = Future([1, 2, 3])
    print("value of f.get() is %s" % f.get())
    assert f.get() == [1, 2, 3]

    # Explicit type specified, value not pickled
    g = Future(123, legion.int64)
    print("value of f.get() is %s" % g.get())
    assert g.get() == 123

    # Using a buffer object to pass raw bytes
    h = Future.from_buffer('asdf'.encode('utf-8'))
    h_value = codecs.decode(h.get_buffer(), 'utf-8')
    print("value of h.get_raw() is %s" % h_value)
    assert h_value == 'asdf'

    show(f)
    show(g)
    show_buffer(h)
Example #5
0
def main():
    print_once('Running pennant.py')

    conf = read_config().get()

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

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

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

    zones = Region([conf.nz], zone)
    points = Region([conf.np], point)
    sides = Region([conf.ns], side)

    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])

    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, legion.float64)
    dthydro = conf.dtmax
    while cycle < cstop and time < conf.tstop:
        if cycle == conf.prune:
            legion.execution_fence(block=True)
            start_time = legion.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)

            future = index_launch(pieces,
                                  calc_dt_hydro,
                                  zones_part[ID],
                                  dt,
                                  conf.dtmax,
                                  conf.cfl,
                                  conf.cflv,
                                  True,
                                  reduce='min')

            dthydro = conf.dtmax
            dthydro = min_task(dthydro, future)
        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:
            legion.execution_fence(block=True)
            stop_time = legion.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))
Example #6
0
def main():
    print_once('Running pennant_fast.py')

    conf = read_config().get()

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

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

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

    span = Fspace(
        OrderedDict([
            ('start', legion.int64),
            ('stop', legion.int64),
            ('internal', legion.bool_),
        ]))

    zones = Region([conf.nz], zone)
    points = Region([conf.np], point)
    sides = Region([conf.ns], side)

    assert conf.par_init, 'parallel initialization required'

    old_seq_init = conf.seq_init
    if conf.seq_init:
        print('Warning: Sequential initialization not supported, skipping')
        # Since we aren't actually doing sequential intialization, we
        # have to turn this off or the verification in parallel
        # initialization will fail.
        conf.seq_init = False

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

    conf.nspans_zones = partitions.nspans_zones
    conf.nspans_points = partitions.nspans_points

    pieces = Ispace([conf.npieces])

    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)

    zone_spans = Region([conf.npieces * conf.nspans_zones], span)
    zone_spans_part = Partition.equal(zone_spans, pieces)

    private_spans = Region([conf.npieces * conf.nspans_points], span)
    private_spans_part = Partition.equal(private_spans, pieces)

    shared_spans = Region([conf.npieces * conf.nspans_points], span)
    shared_spans_part = Partition.equal(shared_spans, pieces)

    side_spans = Region([conf.npieces * conf.nspans_zones], span)
    side_spans_part = Partition.equal(side_spans, pieces)

    for region in [zone_spans, private_spans, shared_spans, side_spans]:
        for field in ['start', 'stop']:
            legion.fill(region, field, 0)

    if old_seq_init:
        # FIXME: These fields are actually never used, fill them here
        # just to avoid validation errors later.
        legion.fill(points, 'pap_x', 0)
        legion.fill(points, 'pap_y', 0)
        legion.fill(sides, 'svolp', 0)
        legion.fill(sides, 'svol', 0)
        legion.fill(sides, 'ssurfp_x', 0)
        legion.fill(sides, 'ssurfp_y', 0)

    if conf.par_init:
        for i in IndexLaunch(pieces):
            initialize_topology(conf, int(i), zones_part[i], private_part[i],
                                shared_part[i], ghost_part[i], sides_part[i])

        for i in IndexLaunch(pieces):
            initialize_spans(conf, int(i), zone_spans_part[i],
                             private_spans_part[i], shared_spans_part[i],
                             side_spans_part[i])

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

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

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

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

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

    for i in IndexLaunch(pieces):
        init_hydro(zones_part[i], zone_spans_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], private_spans_part[i],
                             conf.uinitradial)

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

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

        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], private_spans_part[i], dt, True,
                         False)

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

        for i in IndexLaunch(pieces):
            calc_everything(zones_part[i], private_part[i], ghost_part[i],
                            sides_part[i], zone_spans_part[i],
                            side_spans_part[i], conf.alfa, conf.gamma,
                            conf.ssmin, dt, conf.q1, conf.q2, True)

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

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

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

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

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

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

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

    if old_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))