Shared memory parallelization

XL C/C++ supports application development for multiprocessor system architectures.

You can use any of the following methods to develop your parallelized applications with XL C/C++:
  • Directive-based shared memory parallelization (OpenMP, SMP)
  • Instructing the compiler to automatically generate shared memory parallelization
  • Message-passing-based shared or distributed memory parallelization (MPI)

The parallel programming facilities are based on the concept of threads. Parallel programming exploits the advantages of multiprocessor systems while maintaining a full binary compatibility with existing uniprocessor systems. This means that a multithreaded program that works on a uniprocessor system can take advantage of a multiprocessor system without recompiling.

For more information, see Parallelizing your programs.

OpenMP directives

OpenMP directives are a set of API-based commands supported by XL C/C++ and many other IBM® and non-IBM C, C++, and Fortran compilers.

You can use OpenMP directives to instruct the compiler how to parallelize a particular block of code. The existence of the directives in the source removes the need for the compiler to perform any dependence analysis on the parallel code. OpenMP directives require the presence of Pthread libraries to provide the necessary infrastructure for parallelization.

OpenMP directives address the following important issues of parallelizing an application:
  1. Clauses and directives are available for scoping variables. Generally, variables should not be shared; that is, each thread should have its own copy of the variable. You cannot declare the scope of C99 variable length array (VLA) variables in list of the private(list) clause to be private to each thread.
  2. Work sharing directives specify how the work contained in a parallel region of code should be distributed across the threads.
  3. Directives are available to control synchronization between threads.

As of IBM XL C/C++ for Linux 13.1.2, XL C/C++ supports OpenMP API Version 3.1 and selected features of the OpenMP API Version 4.0 specification. For details, see OpenMP support.

For more information about program performance optimization, see the following topics:


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us