the past, present, and future of openacc
TRANSCRIPT
4
WHAT ARE COMPILER DIRECTIVES?
program myscience
... serial code ...
do k = 1,n1
do i = 1,n2
...
enddo
enddo
...
end program myscience
CPU GPU
Your original
Fortran, C, or C++
code
Insert portable compiler directives
Compiler parallelizes code and manages data movement
Programmer optimizes incrementally
Designed for multi-core CPUs, GPUs & many-core Accelerators
program myscience
... serial code ...
!$acc parallel loop
do k = 1,n1
do i = 1,n2
...
enddo
enddo
...
end program myscience
5
WHY USE COMPILER DIRECTIVES?Single Source Code
No need to maintain multiple code paths
High Level
Abstract away device details, focus on expressing the parallelism and data locality
Low Learning Curve
Programmer remains in same language and adds directives to existing code
Rapid Development
Fewer code changes means faster development
6
1,000,000’s
Early AdoptersResearch
UniversitiesSupercomputing Centers
Oil & Gas
WHY SUPPORT COMPILER DIRECTIVES?
100,000’s
2004 Present
Increased Usability, Broader Adoption
CAECFD
FinanceRendering
Data AnalyticsLife Sciences
DefenseWeatherClimate
Plasma Physics
7
3 WAYS TO ACCELERATE APPLICATIONS
Applications
Libraries
“Drop-in”
Acceleration
Programming
LanguagesCompiler
Directives
Maximum
Flexibility
Easily Accelerate
Applications
9
COMPILER DIRECTIVES TODAY
OpenACC
Focused solely on compiler directives for accelerators
Quickly moving
Performance Portability a primary consideration
Descriptive approach to parallel programming
OpenMP
Addresses a broad range of parallel programming challenges
More measured approach
Less focus on performance portability
Prescriptive approach to parallel programming
Choice of two great options
10
OPENACC IMPLEMENTATIONS
OpenACC 2.0
launched
December 2013
OpenACC 2.0
launched
January 2014
OpenACC 2.0
Targeted for
Late 2014
Tremendous interest in academia:
• accULL – U. La Laguna/EPCC
• Omni – U. of Tsukuba
• OpenARC – Oak Ridge NL
• OpenUH – U. of Houston
• RoseACC – U of DE & LLNL
Compilers
Debuggers and Profilers
OpenACC 2.0
Targeted for
2015
11 11
OPENACC 2.NEXT
Deep-Copy
Support for more complex data structures
Improves C++ class support
Tools API
Standard API for profiling tools
Default to present_or behavior for data clauses
Tell us what else you need [email protected]
12
WHAT IS DEEP COPY?
On Host
Shallow Copy
Deep Copy
Deep copy is required for structures with pointer members to work properly, but also useful
where only part of a structure is needed on the device.
• Users can do this today manually, but we want it to be automatic
13
SOLVING DEEP COPY
Inform the compiler of the shape of the data behind the pointer.
struct T1 {int N;float* A;
#pragma acc policy(“shape") \shape( A[0:N] )
};
Develop policies for how the data should be relocated.
struct T1 {int N;float* A;
#pragma acc policy(“shape") \shape( A[0:N] )
#pragma acc policy("boundary") \
update(A[0:1],A[N-1:1)
};
Self-describing Structures Data Policies
*Syntax and functionality subject to change
14
OPENACC & UNIFIED MEMORY
With Unified Memory (or equivalent) shallow copying no longer results in runtime error, so does deep-copy become irrelevant?
Dereferencing the copied pointer no-longer results in error.
Hardware support for Unified Memory would allow for data to migrate on access.
Deep Copy support in OpenACC is still beneficial because
Data can be moved before it’s needed without penalty
Code will be portable to devices without Unified Memory support
17 17
THE “MERGE”
Both specifications bring value to the market
OpenACC – more focused, more agile, descriptive approach
OpenMP – more cautious, more mature overall, prescriptive approach
The specifications are constantly converging, even if they never eventually merge.
Use the best tool available to you today, the restructuring and knowledge from each are portable.
In other words: the syntax isn’t the hard part.
Does having 2 specifications cause confusion?