Simple C++ Loop Parallelization

active-dates: early 2008 ext-link: sf.net/projects/quickmp

QuickMP (Quick Multi-Processing) is a simple cross-platform C++ API for generating parallel for loops in shared-memory programs, similar to OpenMP. It provides automatic scalable performance based on the number of available processors.

For example, here is a simple C++ for loop:

// Normal for loop uses only 1 thread.
for (int i = 0; i < 1000000; ++i)

With a few QuickMP macros, the loop becomes parallelized:

// Parallel for loop automatically uses 1 thread per processor.
QMP_PARALLEL_FOR(i, 0, 1000000)

The following plots show performance results on a simple ray tracing program (included in QuickMP source) using various numbers of threads:

Ray tracing benchmark performance plot
Ray tracing benchmark performance plot

The ray tracing program renders a set of randomly-positioned spheres:

Ray tracing benchmark output image