Skip to content

mnnuahg/NestedLoopTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Outline

In programming models such as OpenMP or OpenACC, programmers can just implement a sequential program and annotate which loops can be executed in parallel. To test the correctness of the implementation, we may execute the loop iterations in random order since a parallel loop should not have dependencies among its iterations. This project contains two macros LOOP_BEGIN and LOOP_END, which can be used to enclose loops in C++ code, and the iterations of the enclosed loops will be executed in random order. The loops can also be nested. Nested loop iterations will be executed in random order while respecting the fork-join dependencies. The execution is still sequential, just the execution order is randomized.

Compiler requirement

This project makes use of C++ lambda function, which is supported by g++ 4.5 or higher.

Files

testLoop.h

The main file of this project. The C++ source file should include testLoop.h to use the two macros LOOP_BEGIN and LOOP_END. Note testLoop.h also contains implementations of some class member functions, so there will be problems if two c++ source files including testLoop.h are linked together.

simpleTest.cpp

A simple demo to show how to use the two macros LOOP_BEGIN and LOOP_END. The execution result also shows how the fork-join dependencies are respected.

quicksortTest.cpp

A QuickSort demo. After partitioning, the two sub-arrays are processed in random order. This demo also shows the capability of this project to handle loops in (recursive) function calls.

build.sh

Build script of simpleTest.cpp and quicksortTest.cpp

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published