Channels ▼
RSS

Design

QuickThread: A New C++ Multicore Library



NUMA (short for "Non-Uniform Memory Access") architectures are becoming popular in high-performance computing (HPC) scenarios. Therefore, it is very important to work with efficient and optimized memory allocators. QuickThread is a new commercial C++ multicore programming library loaded with many optimizations for NUMA architectures, bringing a new option to create high-performance parallelized code.

A few months ago, Jim Dempsey, CEO and Chief Architect of QuickThread Programming, invited me to offer him some feedback about QuickThread's beta versions. I've accepted his offer as I'm always attracted to new development tools, languages, libraries and paradigms related to multicore programming. Thus, I've been able to have early access to many of the features found in its first official release.

One of the most interesting features found in QuickThread is its design to take full advantage of the underlying hardware, considering all the cache levels (L1; L2 and L3) and the NUMA nodes. The developer can experience with different configurations in order to maximize the performance offered by certain algorithms running on very complex and heterogeneous hardware.

QuickThread extends the concept of thread affinity to a new level. It offers developers more control than other libraries because it considers more low-level details of the underlying hardware. For example, it allows a developer to allocate data objects from a particular NUMA node.

Besides, QuickThread focuses on offering developers a simple way to refactor their existing serial code without needing to create additional classes. Developers can work on the same code base and add parallelism replacing existing code snippets. However, as always, it is necessary to consider all the new complexities introduced by concurrent code. QuickThread makes it simpler to replace an existing loop to create a parallelized loop. Nonetheless, the developer has to create code capable of running concurrently without generated undesired side-effects.

Most of the optimizations found in QuickThread are optimal using Intel C++ Compiler Professional Edition for Windows. As it is a C++ library, it can also take advantage of many of the tools offered by Intel Parallel Studio to optimize parallelized code. It competes with Intel Threading Building Blocks, also known as TBB, because it offers a different alternative to parallelize existing C++ code.

QuickThread allows developers to create both 32-bits (x86-32) and 64-bits (x86-64 or EM64T) applications and it supports the following affinity schemes:

  • Thread affinity.
  • Data binding affinity.
  • NUMA-aware affinity.

It provides a tasking system using thread pools with the goal of producing a minimal overhead mechanism for distributing work in multicore and manycore systems. The reduced overhead and the efficient allocator are two of the most impressive features found in this library and can make a big difference compared to other less efficient libraries. In fact, QuickThread can optimize the scheduler at run-time when many different cache organizations and levels appear.

The reduced overhead and the efficient scheduler are even more important when the parallelized code runs in multi-socket configurations with multiple cores in each socket. I do believe QuickThread has many interested features for these environments.

QuickThread offers the following parallel constructs:

  • parallel_distribute: Schedules a task team to work on different portions of the same task.
  • parallel_for: Schedules a task team to run across an iteration space divided up evenly to team members or chunked up to team members). It offers a classic for loop parallelization without the need to write an additional class.
  • parallel_for_each: Schedules a task team across an iteration space divided upon demand by each team member number.
  • parallel_invoke: Invokes multiple different tasks provided by C++0x Lambda functions.
  • parallel_list: Schedules a task team to process a single linked list of objects.
  • parallel_pipeline: Schedules a task team to process a sequence of steps contained within a vector.
  • parallel_reduce: Schedules a task team across an iteration space divided upon demand by each team member number whilst performing a reduction operation.
  • parallel_task: Schedules a single task for its execution.

In its first official version, QuickThread offers support for Lambda functions (C++0x). It also offers support to FORTRAN. However, it is not fully implemented in its first official release. One of its main drawbacks is that the comparative analysis with Intel Threading Building Blocks documentation is prepared for developers with previous TBB experience, without an introduction for beginners. Therefore, if you haven't worked with TBB before, you will likely find that it's a bit difficult to understand. If this is your case, you can read QuickThread programmer's reference instead.

The library offers and outstanding performance. Therefore, it is a very interesting option when you're looking for high-performance in C++ with simple code.

If you're interested in the features offered by QuickThread, you can read its "Programmers Reference Guide" and "A Comparative Analysis with Intel Threading Building Blocks"


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 

Video