.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/scheduling/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_scheduling_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 .. image-sg:: /examples/scheduling/images/sphx_glr_auto_scheduling_with_custom_io_times_001.png :alt: auto scheduling with custom io times :srcset: /examples/scheduling/images/sphx_glr_auto_scheduling_with_custom_io_times_001.png :class: sphx-glr-single-img .. 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 .. image-sg:: /examples/scheduling/images/sphx_glr_auto_scheduling_with_custom_io_times_002.svg :alt: auto scheduling with custom io times :srcset: /examples/scheduling/images/sphx_glr_auto_scheduling_with_custom_io_times_002.svg :class: sphx-glr-single-img .. 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 .. image-sg:: /examples/scheduling/images/sphx_glr_auto_scheduling_with_custom_io_times_003.svg :alt: auto scheduling with custom io times :srcset: /examples/scheduling/images/sphx_glr_auto_scheduling_with_custom_io_times_003.svg :class: sphx-glr-single-img .. 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 .. image-sg:: /examples/scheduling/images/sphx_glr_auto_scheduling_with_custom_io_times_004.svg :alt: auto scheduling with custom io times :srcset: /examples/scheduling/images/sphx_glr_auto_scheduling_with_custom_io_times_004.svg :class: sphx-glr-single-img .. 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 .. image-sg:: /examples/scheduling/images/sphx_glr_auto_scheduling_with_custom_io_times_005.svg :alt: auto scheduling with custom io times :srcset: /examples/scheduling/images/sphx_glr_auto_scheduling_with_custom_io_times_005.svg :class: sphx-glr-single-img .. 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 .. image-sg:: /examples/scheduling/images/sphx_glr_auto_scheduling_with_custom_io_times_006.svg :alt: auto scheduling with custom io times :srcset: /examples/scheduling/images/sphx_glr_auto_scheduling_with_custom_io_times_006.svg :class: sphx-glr-single-img .. 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 .. image-sg:: /examples/scheduling/images/sphx_glr_auto_scheduling_with_custom_io_times_007.svg :alt: auto scheduling with custom io times :srcset: /examples/scheduling/images/sphx_glr_auto_scheduling_with_custom_io_times_007.svg :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.286 seconds) .. _sphx_glr_download_examples_scheduling_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 `_