Memory Conflicts in Functional-Decomposition Problems


Challenge

Identify memory conflicts in a functional-decomposition problem to identify data-restructuring requirements. This procedure is part of the design phase for threaded applications that is necessary in order to identify issues that could cause performance degradation.


Solution

Use OpenMP* in conjunction with Intel® Compilers and Intel® Thread Checker to identify all memory conflicts in the identified code path. Encompass the code path that is to be threaded in a function and use OpenMP pragmas around the created function. The following code snippet shows the above-described methodology:

    // Global data to the OpenMP threads

    //

    Buffer data;

    #pragma omp parallel sections

    {

       //

       // Operate on the data

       //

       #pragma omp section FunctionThread(

       #pragma omp section FunctionThread(

    }

 

Catching all the global memory accesses in the least amount of time reduces development time considerably. By surrounding the function to be threaded with #pragma omp sections, the OpenMP runtime library creates the default number of threads for the system and executes the function call FunctionThread() twice in parallel.

By using Intel Thread Checker on this sample, the memory conflicts that arise with multiple threads accessing global data will be captured and presented as a list. These errors can then be examined carefully for any data restructuring that may be required. The task that could take anywhere between a few hours to days can now be accomplished in a matter of minutes with the use of Intel's threading tools.

The use of OpenMP pragmas is for identifying the memory conflicts only. During the implementation phase, these pragmas will be removed and replaced by the appropriate threading calls.


Source

Threading Methodology: Principles and Practices

 


For more complete information about compiler optimizations, see our Optimization Notice.