OpenACC Tutorial - Profiling: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
No edit summary
No edit summary
Line 23: Line 23:
What is so important about the hotspots of the code ?  
What is so important about the hotspots of the code ?  
The Amdahl's law says that "Parallelizing the most time-consuming (i.e. the hotspots) routines will have the most impact".
The Amdahl's law says that "Parallelizing the most time-consuming (i.e. the hotspots) routines will have the most impact".
== Build the Sample Code ? ==
For this example we will use a code from the [https://github.com/calculquebec/cq-formation-openacc repositories]. Download the package and change to the '''cpp''' or '''f90''' directory. The point of this exercise is to compile&link the code, obtain executable, and then profile them.
{{Callout
|title=<translate>Which compiler ?</translate>
|content=
<translate>
As of May 2016, compiler support for OpenACC is still relatively scarce. Being pushed by [http://www.nvidia.com/content/global/global.php NVidia], through its [http://www.pgroup.com/ Portland Group] division, as well as by [http://www.cray.com/ Cray], these two lines of compilers offer the most advanced OpenACC support. [https://gcc.gnu.org/wiki/OpenACC GNU Compiler] support for OpenACC exists, but is considered experimental in version 5. It is expected to be officially supported in version 6 of the compiler.
For the purpose of this tutorial, we use version 16.3 of the Portland Group compilers. We note that [http://www.pgroup.com/support/download_pgi2016.php?view=current Portland Group compilers] are free for academic usage.
</translate>
}}
{{Command
|make
|result=
pgc++ -fast  -c -o main.o main.cpp
"vector.h", line 30: warning: variable "vcoefs" was declared but never
      referenced
      double *vcoefs=v.coefs;
                    ^
pgc++ main.o -o cg.x -fast
}}

Revision as of 20:03, 2 June 2016

Other languages:


Learning objectives
  • Understand what profiler is
  • Understand how to use PGPROF profiler.
  • Understand how the code is performing .
  • Understand where to focus your time and re-write most time consuming routines
  • Learn how to ...


What is profiling ?

Gathering a Profile

Why would one needs to gather a profile of a code ? Because it's the only way to understand:

  1. Where time is being spent (Hotspots)
  2. How the code is performing
  3. Where to focus your time

What is so important about the hotspots of the code ? The Amdahl's law says that "Parallelizing the most time-consuming (i.e. the hotspots) routines will have the most impact".

Build the Sample Code ?

For this example we will use a code from the repositories. Download the package and change to the cpp or f90 directory. The point of this exercise is to compile&link the code, obtain executable, and then profile them.

Which compiler ?

As of May 2016, compiler support for OpenACC is still relatively scarce. Being pushed by NVidia, through its Portland Group division, as well as by Cray, these two lines of compilers offer the most advanced OpenACC support. GNU Compiler support for OpenACC exists, but is considered experimental in version 5. It is expected to be officially supported in version 6 of the compiler.

For the purpose of this tutorial, we use version 16.3 of the Portland Group compilers. We note that Portland Group compilers are free for academic usage.


Question.png
[name@server ~]$ make 
pgc++ -fast   -c -o main.o main.cpp
"vector.h", line 30: warning: variable "vcoefs" was declared but never
       referenced
       double *vcoefs=v.coefs;
                    ^

pgc++ main.o -o cg.x -fast