Programming/OpenACC

From HPC
Revision as of 14:41, 24 October 2018 by Pysdlb (talk | contribs) (Created page with "==Introduction to openACC== ===Example openACC C/C++ code=== <pre> #pragma acc kernels { for (int i=0; i<N; i++) { x[i] = 1.0; y[i] = 2.0; } for (int i=0;...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation , search

Introduction to openACC

Example openACC C/C++ code


#pragma acc kernels
{
  for (int i=0; i<N; i++)
  {
    x[i] = 1.0;
    y[i] = 2.0;
  }

  for (int i=0; i<N; i++)
  {
    y[i] = a * x[i] + y[i];
  }
}

Example openACC Fortran code


!$acc kernels
  do i=1,N
    x(i) = 1.0
    y(i) = 2.0
  end do
  
  y(:) = a*x(:) + y(:)
!$acc end kernels