Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28441 Discussions

GAP with Intel Fortran and Visual Studio not working as expected.

OptiAndrew1
Beginner
763 Views

I am starting to introduce myself to Fortran parallelism and am attempting to use Guided Auto Parallelism. Per my research, I thought I wrote a simple program that the analysis runner would have no trouble making some suggestions for, but no suggestions are made. The program is...

      program main
C     two arrays of 10k slots each
      real v1(10000),v2(10000)
C     set the first array to a "counter"
      do i=1,10000
         v1(i)=i*1.0
      enddo
C     multiply each slot of the first array by 100
C     and store it in the second
      do i=1,10000
         v2(i)=v1(i)*100.0
      enddo
      end

 I'm using both the "Maximize Speed" (/O2) and Parallelization (/Qparallel) optimizations, I right-click my file from VS, Intel Compiler, Guided Auto Parallelism, Run Analysis on the file "main.f", set the analysis level to "Simple", and click Run Analysis.
I was expecting to get suggestions on both of my DO loops, but all I see is "Number of advice-messages emitted for this compilation session: 0". I get the same results if I crank the level up to "Extreme".
Are my DO loops SO simple that the /O2 optimizer is already optimizing them, or am I missing something? Thanks in advance for any assistance.

 

VS specs are as follows:

Microsoft Visual Studio Professional 2019
Version 16.9.2
VisualStudio.16.Release/16.9.2+31112.23
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Professional

Visual C++ 2019 00435-20050-62751-AA112
Microsoft Visual C++ 2019

ASP.NET and Web Tools 2019 16.9.688.6828
ASP.NET and Web Tools 2019

Azure App Service Tools v3.0.0 16.9.688.6828
Azure App Service Tools v3.0.0

C# Tools 3.9.0-6.21160.10+59eedc33d35754759994155ea2f4e1012a9951e3
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Cookiecutter 16.9.21026.1
Provides tools for finding, instantiating and customizing templates in cookiecutter format.

Intel® Fortran Compiler Package ID: w_oneAPI_2021.1.2.148
Intel® Fortran Compiler – toolkit version: 2021.1.2, extension version 19.2.0061.16, Package ID: w_oneAPI_2021.1.2.148, Copyright © 2002-2020 Intel Corporation. All rights reserved.
* Other names and brands may be claimed as the property of others.

IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.40218.1

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package

NuGet Package Manager 5.9.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Python 16.9.21026.1
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Python - Conda support 16.9.21026.1
Conda support for Python projects.

Python - Django support 16.9.21026.1
Provides templates and integration for the Django web framework.

Python - IronPython support 16.9.21026.1
Provides templates and integration for IronPython-based projects.

Python - Profiling support 16.9.21026.1
Profiling support for Python projects.

Python - VC Project Support 16.1.19129.1
Provides support for launching C++ projects with Python debugging enabled.

Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.

TypeScript Tools 16.0.30201.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.9.0-6.21160.10+59eedc33d35754759994155ea2f4e1012a9951e3
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
742 Views

I'm a bit astonished that GAP is still described as a feature, as it had effectively been abandoned before I retired six years ago. You might want to take a look at Design Code for Parallelism and Offloading with Intel® Advisor, part of the Base Toolkit.

View solution in original post

0 Kudos
4 Replies
Steve_Lionel
Honored Contributor III
743 Views

I'm a bit astonished that GAP is still described as a feature, as it had effectively been abandoned before I retired six years ago. You might want to take a look at Design Code for Parallelism and Offloading with Intel® Advisor, part of the Base Toolkit.

0 Kudos
OptiAndrew1
Beginner
731 Views

Will do. Thanks for the link!

0 Kudos
jimdempseyatthecove
Honored Contributor III
725 Views

I would suggest you learn to use OpenMP as opposed to relying on the compiler to perform auto-parallelism.

Auto-parallelism may be suitable for relatively simple programs. It also may parallelize code that it ought not.

Your sample code:

 

      do i=1,10000
         v2(i)=v1(i)*100.0
      enddo

 

Would likely not benefit with parallelism. The amount of work is not sufficient to overcome the overhead of forming a thread team to perform slices of the do loop. 

You do have directives to selectively address this issue such as: !DIR$ NOPARALLEL

Be aware that the Intel compiler directives (!DIR$ ...) are Intel specific.

 

I am aware that you are just trying to get some sample code going through the GAP tool. But as Steve mentioned, using Intel Advisor is more current and much better.

 

      use omp_lib
      ...
      sum = 0.0
      !$OMP PARALLEL DO REDUCTION(+:sum)
      do i=1,10000
         v2(i)=v1(i)*100.0
         sum = sum + v2(i)
      enddo
      !$OMP END PARALLEL DO

 

The above loop, without the !$OMP .and. with auto-parellelism enabled would likely not parallelize due to the sum=... That, said, the Intel compiler writers are very smart. The code optimization might synthesize the reduction and auto-parallelize such a loop.

Also, the OpenMP directives are vendor independent.

Jim Dempsey

EDIT: You also need to set the compiler option to process the OpenMP directives (and Link the OpenMP runtime system).

 

0 Kudos
OptiAndrew1
Beginner
720 Views

Awesome. Thanks for the info!

0 Kudos
Reply