Parallelizing your programs

The compiler offers you the following methods of implementing shared memory program parallelization:
  • Automatic parallelization of countable program loops, which are defined in Countable loops. An overview of the compiler's automatic parallelization capabilities is provided in Enabling automatic parallelization.
  • Explicit parallelization of C and C++ program code using pragma directives compliant to the OpenMP Application Program Interface specification. An overview of the OpenMP directives is provided in Using OpenMP directives.

All methods of program parallelization are enabled when the -qsmp compiler option is in effect without the omp suboption. You can enable strict OpenMP compliance with the -qsmp=omp compiler option, but doing so will disable automatic parallelization.

Parallel regions of program code are executed by multiple threads, possibly running on multiple processors. The number of threads created is determined by environment variables and calls to library functions. Work is distributed among available threads according to scheduling algorithms specified by the environment variables. For any of the methods of parallelization, you can use the XLSMPOPTS environment variable and its suboptions to control thread scheduling; for more information about this environment variable, see XLSMPOPTS in the XL C/C++ Compiler Reference. If you are using OpenMP constructs, you can use the OpenMP environment variables to control thread scheduling; for information about OpenMP environment variables, see OpenMP environment variables for parallel processing in the XL C/C++ Compiler Reference. For more information about OpenMP built-in functions, see Built-in functions for parallel processing in the XL C/C++ Compiler Reference.

For details about the OpenMP constructs, environment variables, and runtime routines, refer to the OpenMP Application Program Interface Specification, available at http://www.openmp.org.



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