dataflow domain
using a dataflow domain, you can model and simulate a computationally intensive signal processing or multirate signal processing system. dataflow domains simulate using a model of computation synchronous dataflow, which is data-driven and statically scheduled.
there are two primary reasons to use a dataflow domain in your model.
improve simulation throughput with multithreaded execution.
a dataflow domain leverages the multicore cpu architecture of the host computer and can improve simulation speed significantly. the domain automatically partitions your model and simulates the system using multiple threads. by adding latency to your system, you can further increase concurrency and improve the simulation throughput of your model.
automatically infer signal sizes for frame-based multirate models.
when the automatic frame-size calculation parameter is enabled, dataflow domains automatically calculate frame sizes and insert buffers into your model, avoiding signal size propagation errors in multirate signal processing systems.
specifying dataflow domains
to create a dataflow domain, use the block. the domain of the dataflow subsystem block is preconfigured.
to convert an existing subsystem into a dataflow subsystem:
in the execution tab of the property inspector, select the set execution domain check box.
if the property inspector is not visible, in the modeling tab, under design, select property inspector. for more information on the property inspector, see (simulink).
with the subsystem selected, set the domain to
dataflow
.
inside the subsystem, in the lower left corner of the model canvas, there is now a icon, which indicates that the subsystem is a dataflow subsystem.
note
dataflow domains are supported only at the subsystem level. you cannot set the
domain of a top-level model to
dataflow
.
simulation of dataflow domains
simulation of dataflow domains leverages the multicore cpu architecture of the host computer. it automatically partitions your model and simulates the subsystem using multiple threads.
the first time you simulate a dataflow domain, the simulation is single threaded. during this simulation, the software performs a cost analysis. the next time the model compiles, the software automatically partitions the system for multithreaded execution.
each time you make a change inside the dataflow domain, the next simulation may be single threaded to allow the software to perform a new cost analysis. following a cost analysis simulation, the next time the model compiles, the software repartitions the domain and subsequent simulations are multithreaded.
some blocks and language features are not supported for multithreaded simulation. if a dataflow subsystem contains blocks or language features that do not support multithreaded simulation, simulink® issues a warning and the subsystem always simulates in a single thread.
the (simulink) block and signal logging inside a block support multithreaded simulation. however, during multi-threaded execution, the output of the to workspace block or logged signal data may be different than the single-threaded execution. this is because of the distribution of the pipeline delays inside the block for multithreading. these delays impact the output due to the latencies in the model. you can visualize these delays and the relationship between the output of the to workspace block or the logged signals and the delays.
if a dataflow subsystem contains blocks or language features that are not supported inside a dataflow subsystem, simulink generates an error. for more information, see unsupported simulink software features in dataflow domains.
dataflow parameters
latency
to increase the throughput of a system, it can be advantageous to increase the latency of a system. specify the latency value in the execution tab of the property inspector.
when latency is introduced into a dataflow domain, the output of the dataflow subsystem is marked with a delay icon on the model canvas. changes to the model within the dataflow subsystem may require a cost analysis and repartition.
to find the optimal latency settings for the dataflow subsystems in your model, open the performance advisor. in the performance advisor > simulation > checks that require simulation to run folder, run the check dataflow domain settings check.
for more information on types of parallelism in dataflow domains, see .
you can also use the following settings for the optimal simulation performance. these settings are also provided in the toolstrip when you perform multicore analysis, see .
set (simulink) to
optimizations on (faster runs)
.set_param(gcs, 'simcompileroptimization', 'on')
disable the (simulink) parameter.
set_param(gcs, 'simctrlc', 'off')
set (simulink) to
none
.set_param(gcs, 'integeroverflowmsg', 'none')
set (simulink) to
none
.set_param(gcs, 'integersaturationmsg', 'none')
to further improve the simulation performance, follow the steps presented in .
automatic frame size calculation
simulink can automatically calculate the frame sizes needed for each block in a frame-based signal processing system, and insert buffers where needed. to enable automatic frame size calculation in a dataflow subsystem, select automatic frame size calculation in the execution tab of the property inspector.
features supported for automatic frame size calculation. automatic frame size calculation is supported only for signals whose data types are one of the numeric types (built-in integer, double, single, or fixed-point). signals using an enumerated type or whose data type is a bus are not supported.
frame size calculation supports only two-dimensional signals.
unsupported simulink software features in dataflow domains
dataflow subsystems do not support the following simulink software features.
not supported | description |
---|---|
referenced models | (simulink) blocks are not supported in dataflow domains. |
nonvirtual simulink subsystems, including (simulink), (simulink), and atomic subsystems | only virtual subsystems are supported in dataflow domains. |
blocks with non-constant or non-inherited sample times | all sample times inside dataflow subsystems must be inherited
(-1 ), or constant (inf ). |
continuous blocks | blocks in the (simulink) library are not supported in dataflow domains. simulink indicates in the model canvas at edit-time that these blocks are not supported by highlighting the block in orange. |
data store blocks | data store memory, data store read, and data store write blocks are not supported inside dataflow subsystems. |
subset of simulink blocks | if a dataflow subsystem contains blocks or language features that are not supported, simulink generates an error when the model compiles. for some blocks, such as scope blocks, simulink indicates in the model canvas at edit-time that they are not supported by highlighting the block in orange. |
stateflow® charts | stateflow charts are not supported inside dataflow subsystems. |
simevents® blocks | simevents blocks are not supported inside dataflow subsystems. |
hdl code generation | only c/c code generation is supported for models with dataflow subsystems. |