Multicore coding standards aim to ease programming
- 30 March, 2011 05:03
The Multicore Association is establishing specifications for a programming model that will reduce the complexity involved in writing software for multicore chips used in smartphones, tablets and other embedded systems.
The association is putting together a cohesive set of foundation APIs (application programming interfaces) to standardize communication, resource sharing and virtualization spanning cores on the same or different chips, said Markus Levy, the group's president.
Chip makers are adding CPUs, sensors and accelerators to chips as an energy-efficient way to boost application performance on devices. But multicore chips have also created a challenge for programmers, who have to write applications that scale across multiple cores and synchronize correctly to ensure calculations are executed in a certain order to get the correct output.
The low-level APIs provide a consistent multicore programming model from which applications can be tailored to run across chip architectures, operating systems and specialized hardware, Levy said. The Multicore Association has completed the MCAPI (multicore communication API) and MRAPI (multicore resource management API) for communication and resource management, respectively, and has working groups to create new tools and APIs related to virtualization.
"There are many beneficiaries of establishing these APIs. But the primary goal for all parties is to establish portability," Levy said. A consistent programming model makes it easier to reuse the application across different multicore platforms. Prior to these APIs, most designs used proprietary mechanisms that lacked portability, Levy said.
A smartphone may be designed using multiple processor cores running different operating systems, with each core providing different functionality, said Colin Walls, an embedded software technologist at Mentor Graphics, which makes the Nucleus real-time operating system that ships in around 400 million handsets each year. MCAPI provides a straightforward means for the software on the two cores to communicate, Walls said.
In some devices, one core could run an OS, like Android or Linux, to manage much of the user interface, execution of user applications, file and data management and communications. The other core could be somewhat invisible to the user and manage low-level phone activities such as establishing and maintaining a cellular network connection and handling calls.
"By using MCAPI, the embedded applications code does not need to be aware of the inter-core communications method. The code is portable between operating systems and chip architectures," Walls said.
MCAPI allows programmers to enable applications for multicore once and reuse that same code on multiple products in a product line and for next-generation devices, thereby improving engineering productivity, said Sven Brehmer, CEO of PolyCore Software, which provides development tools and runtime software for multicore and multichip communication.
MCAPI is being used most in the telecom and datacom infrastructures and in multimedia devices, Brehmer said. Other areas of interest include medical devices, high-performance computing and military and aeronautics equipment such as radar.
The API allows the establishment of domains for specific implementations, such as communication between cores on a given chip or over specific areas in a chip's topology. This gives designers better control over the routing and security of their messages, Levy said.
"One aspect of the MCAPI infrastructure involves the specification of a network of communication nodes, where a node can be a process, thread, instance of an operating system, hardware accelerator, or processor core," Levy said.
MCAPI is designed to work with MRAPI, an API for application-level resource management capabilities that coordinate power management and virtualization on multicore chips. Chips contain functions and features that change dynamically, and on some multicore chips it is hard for a single OS to track and control all resources, Levy said. MRAPI provides low-level support for system-level event notification such as power-savings states, device failures and hypervisor repartitioning.
For example, Linux-based devices with symmetric multiprocessing do not support a facility to notify applications when the operating environment or resources have changed, Levy said. To accommodate the deficiency, MRAPI provides programmers with implementation mechanisms to manage resource sharing and respond to changes in the resource availability.
"Utilizing MRAPI, system developers can write portable application programs that will scale throughout current and future generations of multicore processors and architectures, benefitting application, middleware, processor and system developers," Levy said.
This standardization will allow chip vendors and third-party tool providers to take over the resource management, so programmers can focus on high-level applications, Levy said.
The organization is also developing APIs for users of embedded virtualization products, which could enable interoperatibility of applications and middleware across different virtualization environments. But a larger focus is on developing standardized tools that take advantage of the APIs. Some backers of the new APIs such as Mentor, Intel, Freescale and Texas Instruments, for example, all had developed their own debug and tracing tools, Levy said.
"The net result for tool vendors is that as much as they would like to be a one-stop shop, it is impossible. No single vendor can offer everything that their customers require, and yet customers must be able to develop for and understand this diverse system," Levy said.
There are other multicore programming models such as OpenMP and OpenCL, but they are all designed to be "synergistic" rather than competitive, Polycore's Brehmer said. The OpenMP API is designed to write machine-level parallel applications, while OpenCL is a programming framework for parallel execution of tasks across multicore processors including CPUs and graphics processors.
The Multicore Association members also include IBM, Samsung and Advanced Micro Devices.