Main Content

Implement Data Parallelism in Simulink

This example shows how to model data parallelism for a system to be deployed on a multicore processor. This model consists of an input, a functional component that applies to each input, and a concatenated output. For more information on data parallelism, see Types of Parallelism.

Set up this model for concurrent execution.

  1. Convert areas in this model to referenced models. Use the same referenced model to replace each of the functional components that process the input. The figure shows a sample configuration.

  2. Open the model configuration parameters for the top level model. Clear the MAT-file logging check box.

  3. On the Solver pane, set Type to Fixed-step and click Apply. Also ensure that the Periodic sample time constraint is set to Unconstrained. Under Additional options, select Allow tasks to execute concurrently on target and click Configure Tasks.

  4. In the Concurrent Execution dialog box, in the right pane, select the Enable explicit model partitioning for concurrent behavior check box. With explicit partitioning, you can partition your model manually.

  5. In the selection pane, select CPU. Click Add task four times to add four new tasks.

  6. In the selection pane, select Tasks and Mapping. On the Map block to tasks pane:

    • Under Block: Input, click select task and select Periodic: Task.

    • Under Block: Function 1, select Periodic: Task1.

    • Under Block: Function 2, select Periodic: Task2.

    • Under Block: Function 3, select Periodic: Task3.

    • Under Block: Output, select Periodic: Task.

    This maps your partitions to the tasks you created. The Input and Output model blocks are on one task. Each functional component is assigned a separate task.

  7. In the selection pane, select Data transfer. In the Data Transfer Options pane, set the parameter Periodic signals to Ensure deterministic transfer (minimum delay). Click Apply and close the Concurrent Execution dialog box.

  8. Apply these configuration parameters to all referenced models. For more information, see Share a Configuration with Multiple Models.

Update your model to see the tasks mapped to individual model blocks.

Related Examples

More About