Why Dataflow Programming Languages are Ideal for Programming Parallel Hardware


This document is part of the
Multicore Programming Fundamentals Whitepaper Series

Multicore Programming Fundamentals Whitepaper Series

Multicore Programming Fundamentals Whitepaper Series

View this whitepaper to learn about dataflow programming languages and why they are an ideal choice for programming parallel hardware.


Dataflow Programming Overview

Dataflow programming models contrast to the control flow model implemented in languages such as C.

Because of the top-down sequential programming approach, applications written in C have inherent limitations when mapping to parallel hardware. In contrast, with a dataflow model, nodes on a block diagram are connected to one another to express the logical execution flow, and they can be used to easily express parallelism. When a block diagram node receives all required inputs, it produces output data and passes that data to the next node in the dataflow path. The movement of data through the nodes determines the execution order of the functions on the block diagram.

Example of Creating a Parallel Task in LabVIEW

Task parallelism is often created inherently when writing a program in LabVIEW. The following example takes advantage of the LabVIEW multithreaded execution system. This example has two parallel tasks, one task is an event-driven UI task, and the other performs an acquisition from a peripheral device. LabVIEW recognizes that it can execute the two loops independently, and in a multiprocessing or hyperthreaded environment, often simultaneously.

Figure 1 - Implicit Parallelism in LabVIEW

Notice that these the above example does not include code for explicit thread management. The LabVIEW dataflow programming paradigm allows the LabVIEW execution system to run the two loops in different threads. In many text-based programming languages, you must explicitly create and handle threads.

LabVIEW also offers special structures that will map code to parallel hardware resources for explicit threading. For example, one such structure is the Timed Loop. When code that is contained in a Timed Loop is run on a dual-core or multicore system, a unique thread will be created. Figure 1 below demonstrates how two Timed Loops will create two unique threads which can be balanced across two separate cores of a multicore system.

Figure 2 - Explicit Parallelism in LabVIEW

In the case of FPGAs, the concept of threading does not exist, so loop structures instead reserve real-estate on the fabric of the FPGA and execute as a unique processor cores.

In summary, since dataflow programming languages are inherently parallel in nature, developers can create applications that are implicitly parallel. This characteristic of a programming language signifies that developers don't need to be experts in the low-level intricacies of parallel hardware such as multicore processors and FPGAs in order to reap the performance benefits -- the language itself helps parallelize the code.

Was this information helpful?