MTAPI library adds patterns for heterogeneous multicore
Siemens has published version 1.0 of its task-management library Embedded Multicore Building Blocks (EMB2) to Github. The latest major release of the open-source library introduces C++ wrappers, plugins for GPU programming, and a variety of design patterns to speed up the development of heterogeneous multicore applications for embedded systems.
Initially released in autumn 2014 in its version 0.2 form following internal development by the Siemens Corporate Technology team, EMB2 uses the Multicore Task Management Application Programming Interface (MTAPI) developed by the Multicore Association as a standarized way to divide tasks across different types of processor in manycore systems and coordinate them.
Tobias Schüle, project manager at Siemens Corporate Technology, said one of the motivations for basing EMB2 on MTAPI was to overcome the problem of porting applications from one manycore platform to another even with different memory hierarchies.
“MTAPI was designed with heterogeneous embedded systems in mind,” Schüle said. “It does not just use shared memory and compute nodes can have different instruction-set architectures. All the passing of parameters and getting results from tasks is completely hidden in the library. It greatly simplifies the programming of such systems from a developer’s perspective.”
Design patterns
MTAPI’s approach splits workloads into groups: tasks and queues. “Queues were a requirement for telecom network routers and so on, where you have streams of data to process in a certain order.”
To further help with application-specific requirements, the EMB2 developers created a set of design patterns to reflect common multiprocessing situations “and release developers from the burden of thread management synchronization and so on”, Schüle said.
The team placed a strong emphasis on lock-free synchronization schemes to improve overall performance. “We don’t want to use blocking synchronization structures like mutexes,” Schüle said. “We also wanted resource awareness and determinism. For safety-critical systems you are able to avoid the use of dynamic memory allocation.”
The EMB2 library supports the ability to dynamically schedule and allocate tasks to different processes. “Each job has actions such as an FFT. That FFT could be implemented on GPU, hardware, FPGA or just a CPU. As an application developer you don’t have to care about where the task is executed. You can leave the decision up to the scheduler,” Schüle claimed, noting that the application will need variants compiled of the FFT task that are suitable for each of the compute resources that can be used. But with the binaries available, “you can do load balancing dynamically”.
EMB2 has a default scheduler based on resource availability that can be swapped for a different scheme, such as one that takes into account power-management considerations. “We have a plug-in architecture so you can write your own to support special hardware such as custom processors in FPGAs,” he added. The group has added readymade plugins for environments such as CUDA for GPU programming.
Schüle said the C++ wrappers in the latest release make it easier to use the C-based MTAPI API in the object-oriented language.