Predict data sharing problems for the annotated tasks. Fix the reported sharing problems.
The Correctness tool performs extensive analysis of your running serial application's executable to predict data sharing problems. Use the Correctness Report window to help you understand and decide how to fix the data sharing problems.
For each data sharing problem, you can:
Modify the sources to fix incidental or accidental data sharing by privatizing shared data use.
Add lock annotations to implement synchronization.
Recognize that the order of the operations cannot change, and consider modifying the tasks.
Understanding the Problems
In a serial program, the exact order of the operations are known. However, in code that executes as multiple parallel tasks, an operation can execute before, after, or simultaneously with an operation in the other task. When parallel tasks access or modify a shared memory location, data sharing problems can occur.
Use the information in the Correctness Report and Correctness Source windows with your knowledge about your program to understand why data accesses in your tasks might conflict with each other. Focus on one problem at a time and view the observations for that problem. You are interested in accesses to memory locations in the task. In addition to the task's code region marked by the task annotations, you must consider any code called from the task's code region as well. That is, you need to understand all the data accesses that might be executed during the execution of the task.
There are several types of sharing problems, where each type usually has a different solution:
Sharing is incidental when tasks use the same memory location, but do not communicate any information about using it. In some cases, this type of sharing may be accidental. For example, if each task accesses a global variable when each task could be using its own private copy of the variable.
Independent updates can occur when multiple tasks contribute to determining the final value of a memory location. Different types of independent updates may require different synchronization strategies to fix the problem. You can fix update sharing problems by synchronizing the execution of the code that updates the same memory locations.
True dependence occurs when shared data access must occur in the original sequential order. This limits the benefits of adding parallelism. In this case, consider modifying the location of the tasks or parallel site, restructure that part of the program, or combine tasks.
Next Steps
For each problem reported in the Correctness Report, you need to carefully examine the source code of the task that causes the problem and read the relevant parts of this help, starting with Understanding Data Sharing Problems. If you modify the sources to fix problems by restructuring code or by adding annotations, rebuild the program and run the Correctness tool again. Once you fix all the problems, run the Suitability tool again.
When accept the placement of parallel tasks and their enclosing parallel sites, proceed to 5. Add Parallel Framework.