Main Content

Implicit and Explicit Partitioning of Models

When implementing multicore programming for your application in Simulink®, there are two ways to partition your model for running on individual processing nodes. If you are new to multicore programming in Simulink, use the default (implicit partitioning) for your first iteration of implementing multicore programming.

The automated way of creating tasks and mapping them to your processing nodes is called implicit partitioning. Simulink partitions your model based on the sample time of blocks at the root level. Each sample time in your model corresponds to a partition, and all blocks of a single rate or sample time belong to the same partition. Simulink maps these partitions to tasks that run on your processor. Implicit partitioning assumes your architecture to be a single multicore CPU. The CPU task scheduler handles all the partitioned tasks.

If you want to specify how to partition your model, use explicit partitioning. In explicit partitioning, you create partitions in the root-level model by using referenced models, MATLAB® system blocks, MATLAB Function blocks, Stateflow® charts, and Simulink subsystems. For example, if your model has data acquisition and a controller, partition your model by putting these components in two referenced models at the model root-level. Each sample time of the blocks in the model corresponds to a partition. You can add tasks to run on processing nodes in the Concurrent Execution dialog box and assign your partitions to these tasks. If some partitions are left unassigned, Simulink automatically assigns them to tasks.

In explicit partitioning, you can specify your own architecture. The default architecture is a multicore CPU, the same as the assumed architecture in implicit partitioning. Explicit partitioning has more restrictions on your root-level model than implicit partitioning. For more information, see Limitations with Multicore Programming in Simulink.

Partitioning Guidelines

There are multiple ways to partition your model for concurrent execution in Simulink. Rate-based and model-based approaches give you primarily graphical means to represent concurrency for systems that are represented using Simulink and Stateflow blocks. You can partition MATLAB code using the MATLAB System block and the MATLAB Function block. You can also partition models of physical systems using multisolver methods.

Each method has additional considerations to help you decide which to use.

GoalValid Partitioning MethodsConsiderations

Increase the performance of a simulation on the host computer.

No partitioning method

Simulink tries to optimize the host computer performance regardless of the modeling method you use. For more information on the ways that Simulink helps you to improve performance, see Optimize Performance.

Increase the performance of a plant simulation in a multicore HIL (hardware-in-the-loop) system.

You can use any of the partitioning methods and their combinations.

The processing characteristics of the HIL system and the embedded processing system can vary greatly. Consider partitioning your system into more units of work than there are number of processing elements in the HIL or embedded system. This convention allows flexibility in the mapping process.

Create a valid model of a multirate concurrent system to take advantage of a multicore processing system.

You can use any of the partitioning methods and their combinations.

Partitioning can introduce signal delays to represent the data transfer requirements for concurrent execution. For more information, see Configure Data Transfer Settings Between Concurrent Tasks.

Create a valid model of a heterogeneous system to take advantage of multicore and FPGA processing.

  • Multicore processing: Use any of the partitioning methods.

  • FPGA processing: Partition your model using Model blocks.

Consider partitioning for FPGA processing where your computations have bottlenecks that could be reduced using fine-grained hardware parallelism.

Related Examples

More About