The simulation and the analysis of advanced systems such as robots require an increased design power, which sequential processors are far from satisfying. Parallel computing is a solution to reduce the execution times. By using independent processors together, we can increase our capacity of calculation and answer such requirements thereafter. In this project, made in collaboration with Opal-rt technologies and the Canadian Space Agency, we propose a practical solution to automate the parallelization of simulations developed under the Matlab/Simulink environment. The solution was developed in two phases: generation of the task graph, then the task assignment to the processors. Our feasibility study is conclusive and a little research work remains to be performed before launching our software on the market.
Under Matlab/Simulink, we can develop simulations using a functional bloc-diagram language. The logic of this kind of language already allows a well-structured code. However, to automate parallelization, it is necessary to formalize the model in the form of a graph to make sure that the tasks are well identified and that the constraints of precedence and communication delays are well defined. That is why we generate a directed acyclic graph (DAG). The generation of such a graph is a big challenge. Firstly, the real model contains cycles and the blocks are gathered in a hierarchical way with various levels. Secondly, it is necessary to make this procedure automatic for any kind of models. The solution that we developed is based on the Matlab tools. We created Simulink compiler which surfs the model to detect all its components. This compiler allows, for a given level of details or for a “ desired granularity ”, to determine in an automatic way the tasks and their links. Moreover a good characterization of the loops in the model enables us to
avoid the cycles in the generated graph.
Once the DAG is generated, we must assign the tasks to the different CPUs with respect to the communication delays and the precedence constraints while aiming the shortest possible execution time over all CPUs - which means the objective is to minimize the makespan. We performed a literature review on this subject. There are several methods of resolving this problem but, due to the nature of our project - a feasibility study - we began with what is simplest and rather sure, a priority-based heuristic and a “Clustering” algorithm. We do not allow task duplication but we explore it. We applied these types of heuristic to our problem. Adapting these algorithms to our situation was more difficult than expected. The implementation of the code gave, after many improvements, good results - as good as we had planned.
To validate our results we performed several tests. On the one hand, a group of tests relates to a realistic example of a robot simulation. This test aims to validate our method in a real context and to ensure the accuracy of the results after the automation of the whole process. In other words, these tests prove the feasibility of the project. On the other hand, another group of tests use a group of representative graphs to test the robustness, the stability and the performance of our heuristics in cases when there is no practical control of the scheduler. The results of these tests are conclusive. Our heuristics provides good solutions and the best schedules in a controlled context are still the best when the scheduler is not under control, which is the case of the Rt-lab environment.
This proves that the automation of the parallelization of a schematic model, the type of the Simulink/Matlab models, is possible. The heuristics give acceptable results. However, due to the fact that we obtain worse solutions when the DAG is generated with a finer granularity, we suspect that metaheuristics could increase the quality of the solutions. Also, while the report is conclusive on the practical level, it is necessary to continue the research tasks before delivering the product to the market.
Keywords: distributed simulation, parallel computing, Simulink, scheduling, priority-based heuristic, clustering, communication delays.