Skip to content

Commit

Permalink
Add an axpby kernel.
Browse files Browse the repository at this point in the history
  • Loading branch information
semi-h committed Feb 9, 2024
1 parent fbfbe36 commit c1154b7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/cuda/kernels/reorder.f90
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,23 @@ attributes(global) subroutine sum_zintox(u_x, u_z, nz)

end subroutine sum_zintox

attributes(global) subroutine axpby(n, alpha, x, beta, y)
implicit none

integer, value, intent(in) :: n
real(dp), value, intent(in) :: alpha, beta
real(dp), device, intent(in), dimension(:, :, :) :: x
real(dp), device, intent(inout), dimension(:, :, :) :: y

integer :: i, j, b

i = threadIdx%x
b = blockIdx%x

do j = 1, n
y(i, j, b) = alpha*x(i, j, b) + beta*y(i, j, b)
end do

end subroutine axpby

end module m_cuda_kernels_reorder

0 comments on commit c1154b7

Please sign in to comment.