# Guided Auto Parallelism

### Note

This feature is only available for ifort.

The Guided Auto Parallelism (GAP) feature of the Intel® Fortran Compiler is a tool that offers selective advice to improve the performance of serially-coded applications by suggesting changes that take advantage of the compiler’s ability to automatically vectorize and parallelize code and improve the efficiency of data operations. Despite having the words “auto parallelism” in the name, this tool does not require a threaded code implementation to improve the execution performance of the code, or require that the code is already threaded or parallel.

Advanced optimization techniques, such as inter-procedural analysis or profile-guided feedback, are not needed to use this feature. Using the [Q]guide set of options in addition to the compiler options normally used is sufficient to enable the GAP feature, with the requirement that you must compile with O2 or higher optimization levels. The compiler does not generate any object files or executables during the GAP run.

In debug mode (/Zi on Windows*, -g on Linux*), the compiler's optimization level defaults to /Od (on Windows*) or -O0 (on Linux* and macOS); thus O2 (or a higher level optimization) must be specified explicitly on the command-line.

### Note

Use the [Q]diag-disable option along with the [Q]guide option to direct the compiler to suppress specific diagnostic messages.

For example, the options `-guide, -diag-disable:30534` (Linux) or `/Qguide, /Qdiag-disable:30534` (Windows) tell the compiler not to emit the 30534 diagnostic. The [Q]diag-disable mechanism works the same way as it does for compiler-warnings.

If you decide to follow the advice offered by the GAP tool by making the suggested code changes and/or using the suggested compiler options, you must then recompile the program without the [Q]guide option.

Any advice generated by the compiler when using the GAP tool is optional; it can be implemented or rejected. The advice typically falls under three broad categories:

- Advice for source modifications: The compiler advises you to make source changes that are localized to a loop-nest or a routine. For example, the tool may recommend that you use a local-variable for the upper-bound of a loop, or that you should initialize a local variable unconditionally at the top of the loop-body, .
- Advice to apply directives: The compiler advises you to apply a new directive on a certain loop-level if the directive semantics can be satisfied (you must verify this). In many cases, you may be able to apply the directive (thus implicitly asserting new program/loop properties) that the compiler can take advantage of to perform enhanced optimizations.
- Advice to add compiler options: The compiler advises you to add command-line options that assert new properties. These suggested compiler options apply to the entire file. It is your responsibility to check that the properties asserted by these options are valid for the entire file, and not just the loop in question.

If you use GAP options along with option [Q]parallel, the compiler may suggest options to further parallelize your application. The compiler may also offer advice on enabling other optimizations of your application, including vectorization.

If you use the GAP options without enabling auto parallelism (without using the [Q]parallel option), the compiler may only suggest enabling optimizations such as vectorization for your application. This approach is recommended when you wish to improve the performance of a single-threaded code without the use of parallelization or when you want to improve the performance of threaded applications that do not rely on the compiler for auto parallelism.

Parent topic: Optimization and Programming

- Using Guided Auto Parallelism
- Guided Auto Parallelism Messages

## See Also

Using Guided Auto Parallelism
diag compiler option
g compiler option