Skip to content

Instantly share code, notes, and snippets.

@ivan-pi
Created February 1, 2024 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan-pi/cc5f7b4ef876e8efe54b344fecd50801 to your computer and use it in GitHub Desktop.
Save ivan-pi/cc5f7b4ef876e8efe54b344fecd50801 to your computer and use it in GitHub Desktop.
axpy.fypp
#:block parallel_for(d=1,name="axpy")
#:contains args
a, x, y
#:contains range
n
#:contains params
real, value :: a
real, intent(in) :: x(n)
real, intent(inout) :: y(n)
integer :: i
!$omp declare target (x,y)
!$acc declare present(x,y)
!$cuf attribute(device) :: x, y
#:contains kernel
y(i) = a*x(i) + y(i)
#:endblock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment