Finding Bugs in OpenMP* and Serial Code

To determine whether a bug is caused by concurrency or whether it occurs within an algorithm, it is useful to serialize execution for OpenMP* parallel code regions and to restrict execution of these code regions to a single thread per region. You can serialize the code regions dynamically, so you do not need to recompile or restart the OpenMP* application.

Note iconNote

When you enable serialization while the program is executing a parallel region, this region is not serialized — only subsequent regions are. When you disable serialization, only regions subsequent to the current location are set back to parallel. To serialize a selected region, it is useful to set breakpoints before and after the region. This helps you to enable serialization before the selected region is executed, and disable it before other parallel regions are executed. With this selective serialization, the rest of the application can remain parallel, which reduces execution time.

To serialize an OpenMP* parallel region:

  1. Go to the code region you want to serialize.
  2. Set a breakpoint at the line preceding the region and another breakpoint at the line following the region. This step helps you to serialize this particular code region.
  3. Run or rerun the application. The application stops at the first breakpoint.
  4. Enable serialization: Select Parallel > Serialize Execution. Alternatively, enter idb set openmp-serialization on.
  5. Continue debugging. The application stops at the next breakpoint. Only a single thread executed the region.
  6. Disable serialization: Select Parallel > Serialize Execution. Alternatively, enter idb set openmp-serialization off. All subsequent OpenMP* parallel regions are executed by multiple threads until you enable serialization again.

Note iconNote

You must enable serialization at the first breakpoint and disable serialization at the second breakpoint each time you want to run this same region serially.

See Also



Submit feedback on this help topic

Copyright © 2001-2011, Intel Corporation. All rights reserved.