.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/auto_scheduling_with_custom_io_times.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_auto_scheduling_with_custom_io_times.py: ========================================= Automatic scheduling with custom IO times ========================================= It is possible to specify the IO times and provide those to the scheduling. .. GENERATED FROM PYTHON SOURCE LINES 8-19 .. code-block:: Python from b_asic.core_operations import ConstantMultiplication from b_asic.fft_operations import R2Butterfly from b_asic.list_schedulers import HybridScheduler from b_asic.schedule import Schedule from b_asic.scheduler import ALAPScheduler, ASAPScheduler from b_asic.sfg_generators import radix_2_dif_fft points = 8 sfg = radix_2_dif_fft(points=points) .. GENERATED FROM PYTHON SOURCE LINES 20-21 The SFG is: .. GENERATED FROM PYTHON SOURCE LINES 21-23 .. code-block:: Python sfg .. raw:: html
%3 in0 in0 r2bfly0 r2bfly0 in0:e->r2bfly0 0 in1 in1 r2bfly1 r2bfly1 r2bfly0->r2bfly1 0 0 r2bfly2 r2bfly2 r2bfly0->r2bfly2 0 1 r2bfly8 r2bfly8 in1:e->r2bfly8 0 in2 in2 cmul2 cmul2 r2bfly8->cmul2 1 r2bfly7 r2bfly7 r2bfly8->r2bfly7 0 0 r2bfly11 r2bfly11 in2:e->r2bfly11 0 in3 in3 r2bfly11->r2bfly1 1 0 cmul0 cmul0 r2bfly11->cmul0 1 r2bfly6 r2bfly6 in3:e->r2bfly6 0 in4 in4 cmul3 cmul3 r2bfly6->cmul3 1 r2bfly6->r2bfly7 1 0 in4:e->r2bfly0 1 in5 in5 in5:e->r2bfly8 1 in6 in6 in6:e->r2bfly11 1 in7 in7 in7:e->r2bfly6 1 out0 out0 out1 out1 r2bfly9 r2bfly9 r2bfly9->out0:w 0 out4 out4 r2bfly9->out4:w 1 out2 out2 r2bfly3 r2bfly3 r2bfly3->out1:w 0 out5 out5 r2bfly3->out5:w 1 out3 out3 r2bfly10 r2bfly10 r2bfly10->out2:w 0 out6 out6 r2bfly10->out6:w 1 r2bfly4 r2bfly4 r2bfly4->out3:w 0 out7 out7 r2bfly4->out7:w 1 r2bfly1->r2bfly9 0 0 r2bfly1->r2bfly10 0 1 r2bfly2->r2bfly3 0 0 r2bfly2->r2bfly4 0 1 cmul0->r2bfly2 1 cmul1 cmul1 cmul1->r2bfly4 1 r2bfly5 r2bfly5 r2bfly5->r2bfly3 1 0 r2bfly5->cmul1 1 cmul2->r2bfly5 0 cmul3->r2bfly5 1 r2bfly7->r2bfly9 1 0 cmul4 cmul4 r2bfly7->cmul4 1 cmul4->r2bfly10 1


.. GENERATED FROM PYTHON SOURCE LINES 24-25 Set latencies and execution times. .. GENERATED FROM PYTHON SOURCE LINES 25-30 .. code-block:: Python sfg.set_latency_of_type(R2Butterfly, 1) sfg.set_latency_of_type(ConstantMultiplication, 3) sfg.set_execution_time_of_type(R2Butterfly, 1) sfg.set_execution_time_of_type(ConstantMultiplication, 1) .. GENERATED FROM PYTHON SOURCE LINES 31-32 Generate an ASAP schedule for reference with custom IO times. .. GENERATED FROM PYTHON SOURCE LINES 32-37 .. code-block:: Python input_times = {f"in{i}": i for i in range(points)} output_delta_times = {f"out{i}": i for i in range(points)} schedule1 = Schedule(sfg, scheduler=ASAPScheduler(input_times, output_delta_times)) schedule1 .. raw:: html
2026-06-03T14:26:26.493941 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/


.. GENERATED FROM PYTHON SOURCE LINES 38-39 Generate an ALAP schedule for reference with custom IO times.. .. GENERATED FROM PYTHON SOURCE LINES 39-42 .. code-block:: Python schedule_t = Schedule(sfg, scheduler=ALAPScheduler(input_times, output_delta_times)) schedule_t .. raw:: html
2026-06-03T14:26:26.707222 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/


.. GENERATED FROM PYTHON SOURCE LINES 43-45 Generate a non-cyclic Schedule from HybridScheduler with custom IO times, one input and output per time unit and one butterfly/multiplication per time unit. .. GENERATED FROM PYTHON SOURCE LINES 45-56 .. code-block:: Python resources = {R2Butterfly.type_name(): 1, ConstantMultiplication.type_name(): 1} schedule2 = Schedule( sfg, scheduler=HybridScheduler( resources, input_times=input_times, output_delta_times=output_delta_times, ), ) schedule2 .. raw:: html
2026-06-03T14:26:26.928385 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/


.. GENERATED FROM PYTHON SOURCE LINES 57-58 Generate a new Schedule with cyclic scheduling enabled. .. GENERATED FROM PYTHON SOURCE LINES 58-70 .. code-block:: Python schedule3 = Schedule( sfg, scheduler=HybridScheduler( resources, input_times=input_times, output_delta_times=output_delta_times, ), schedule_time=14, cyclic=True, ) schedule3 .. raw:: html
2026-06-03T14:26:27.155395 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/


.. GENERATED FROM PYTHON SOURCE LINES 71-72 Generate a new Schedule with even less scheduling time. .. GENERATED FROM PYTHON SOURCE LINES 72-84 .. code-block:: Python schedule4 = Schedule( sfg, scheduler=HybridScheduler( resources, input_times=input_times, output_delta_times=output_delta_times, ), schedule_time=13, cyclic=True, ) schedule4 .. raw:: html
2026-06-03T14:26:27.387191 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/


.. GENERATED FROM PYTHON SOURCE LINES 85-86 Try scheduling for 12 cycles, which gives full butterfly usage. .. GENERATED FROM PYTHON SOURCE LINES 86-97 .. code-block:: Python schedule5 = Schedule( sfg, scheduler=HybridScheduler( resources, input_times=input_times, output_delta_times=output_delta_times, ), schedule_time=12, cyclic=True, ) schedule5 .. raw:: html
2026-06-03T14:26:27.775411 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/


.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.519 seconds) .. _sphx_glr_download_examples_auto_scheduling_with_custom_io_times.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: auto_scheduling_with_custom_io_times.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: auto_scheduling_with_custom_io_times.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: auto_scheduling_with_custom_io_times.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_