15. GAUSSIAN 16
Using OpenACC allowed us to continue
development of our fundamental
algorithms and software capabilities
simultaneously with the GPU-related
work. In the end, we could use the
same code base for SMP, cluster/
network and GPU parallelism. PGI's
compilers were essential to the success
of our efforts.
Mike Frisch, Ph.D.
President and
CEO
Gaussian, Inc.
16. VASP
For VASP, OpenACC is the way
forward for GPU acceleration.
Performance is similar and in some
cases better than CUDA C, and
OpenACC dramatically decreases
GPU development and maintenance
efforts. We’re excited to collaborate
with NVIDIA and PGI as an early
adopter of CUDA Unified Memory.
Prof. Georg Kresse
Computational Materials Physics
University of Vienna
17. GTC
Using OpenACC our scientists
were able to achieve the
acceleration needed for
integrated fusion simulation with
a minimum investment of time
and effort in learning to program
GPUs.
Zhihong Lin
Professor and Principal Investigator
UC Irvine
Head
Shot
34. #pragma acc parallel
{
}
#pragma acc parallel
{
for(int i = 0; i < N; i++)
{
// Do Something
}
}
OPENACC PARALLEL ディレクティブ
並列性の表現
このループは各 gang で
重複して実行される。
gang
gang gang
gang
gang
gang
loop
loop
loop
loop
loop
loop
loop
35. #pragma acc parallel
{
for(int i = 0; i < N; i++)
{
// Do Something
}
}
OPENACC PARALLEL ディレクティブ
並列性の表現
#pragma acc parallel
{
}
つまり、各 gang は
このループ全体を実行する。
gang
gang gang
gang
gang
gang
36. OPENACC PARALLEL ディレクティブ
単一ループの並列化
並列実行したい領域を parallel ディレクティブによって
指定する。
この parallel 領域は、C/C++ では中括弧 { } で、
Fortran では start と end で指定される。
loop ディレクティブは、直後のループの反復計算を、並
列 gang 上で並列実行するようコンパイラに指示する。
C/C++
#pragma acc parallel
{
#pragma acc loop
for(int i = 0; j < N; i++)
a[i] = 0;
}
Fortran
!$acc parallel
!$acc loop
do i = 1, N
a(i) = 0
end do
!$acc end parallel
37. OPENACC PARALLEL ディレクティブ
単一ループの並列化
これら (parallel, loop) は 1行にまとめて使われること
が多い。
この例では、parallel loop ディレクティブは直後のルー
プに適用される。
このディレクティブは、並列実行とループの反復計算を
分散させる領域を一度に指定する。
parallel loop をデータ依存性のあるループに適用する
と、正しく計算されない可能性がある。
C/C++
#pragma acc parallel loop
for(int i = 0; j < N; i++)
a[i] = 0;
Fortran
!$acc parallel loop
do i = 1, N
a(i) = 0
end do
38. #pragma acc parallel
{
for(int i = 0; i < N; i++)
{
// Do Something
}
}
OPENACC PARALLEL ディレクティブ
並列性の表現
#pragma acc parallel
{
#pragma acc loop
for(int i = 0; i < N; i++)
{
// Do Something
}
}
loop ディレクティブは、
並列化されるループを
指示する。
42. REDUCTION クローズのオペレータ
Operator Description Example
+ Addition/Summation reduction(+:sum)
* Multiplication/Product reduction(*:product)
max Maximum value reduction(max:maximum)
min Minimum value reduction(min:minimum)
& Bitwise and reduction(&:val)
| Bitwise or reduction(|:val)
&& Logical and reduction(&&:val)
|| Logical or reduction(||:val)