All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Serial Execution
Previous: OpenMP Parallelization     Next: Vector Serialization


Sometimes it may be necessary to enforce the serial execution of specific operations. For this purpose, the Blaze library offers two possible options.

The first option is the temporary and local enforcement of a serial execution via the BLAZE_SERIAL_SECTION:

// ... Resizing and initialization
// Parallel execution
// If possible and beneficial for performance the following operation is executed in parallel.
x = A * b;
// Serial execution
// All operations executed within the serial section are guaranteed to be executed in
// serial (even if a parallel execution would be possible and/or beneficial).
{
y = A * c;
z = A * d;
}
// Parallel execution continued
// ...

Within the scope of the BLAZE_SERIAL_SECTION, all operations are guaranteed to run in serial. Outside the scope of the serial section, all operations are run in parallel (if beneficial for the performance).

The second option is the general deactivation of the parallel execution (even in case OpenMP is enabled on the command line). This can be achieved via the ./blaze/config/SMP.h configuration file: In case the BLAZE_ENABLE_PARALLEL_EXECUTION switch is set to 0, the shared-memory parallelization is deactivated altogether.


Previous: OpenMP Parallelization     Next: Vector Serialization