42 use,
intrinsic :: iso_c_binding
48 real(kind=
rp),
allocatable :: x(:)
50 type(c_ptr) :: x_d = c_null_ptr
99 integer,
intent(in) :: n
119 if (
allocated(v%x))
then
123 if (c_associated(v%x_d))
then
143 if (
allocated(v%x))
then
147 if (.not.
allocated(v%x))
then
169 real(kind=
rp),
intent(in) :: s
171 if (.not.
allocated(v%x))
then
178 call cfill(v%x, s, v%n)
188 if (a%n .ne. b%n)
call neko_error(
"Vectors must be the same length!")
200 call add3(v%x, a%x, b%x, v%n)
208 real(kind=
rp),
intent(in) :: c
221 call cadd2(v%x, a%x, c, v%n)
228 real(kind=
rp),
intent(in) :: c
241 if (a%n .ne. b%n)
call neko_error(
"Vectors must be the same length!")
253 call sub3(v%x, a%x, b%x, v%n)
261 real(kind=
rp),
intent(in) :: c
274 call cadd2(v%x, a%x, -1.0_rp*c, a%n)
281 real(kind=
rp),
intent(in) :: c
298 real(kind=
rp),
intent(in) :: c
311 call cmult2(v%x, a%x, c, v%n)
318 real(kind=
rp),
intent(in) :: c
Map a Fortran array to a device (allocate and associate)
subroutine, public device_cmult2(a_d, b_d, c, n)
Multiplication by constant c .
subroutine, public device_cmult(a_d, c, n)
Multiplication by constant c .
subroutine, public device_sub3(a_d, b_d, c_d, n)
Vector subtraction .
subroutine, public device_add3(a_d, b_d, c_d, n)
Vector addition .
subroutine, public device_cadd2(a_d, b_d, c, n)
Add a scalar to vector .
subroutine, public device_copy(a_d, b_d, n)
Copy a vector .
subroutine, public device_cfill(a_d, c, n)
Set all elements to a constant c .
Device abstraction, common interface for various accelerators.
subroutine, public device_free(x_d)
Deallocate memory on the device.
subroutine, public cmult2(a, b, c, n)
Multiplication by constant c .
subroutine, public cadd2(a, b, s, n)
Add a scalar to vector .
subroutine, public add3(a, b, c, n)
Vector addition .
subroutine, public sub3(a, b, c, n)
Vector subtraction .
subroutine, public cfill(a, c, n)
Set all elements to a constant c .
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
subroutine vector_init(v, n)
Initialise a vector of size n.
subroutine vector_assign_scalar(v, s)
Assignment .
type(vector_t) function vector_add_scalar_right(c, a)
Scalar-vector addition .
integer function vector_size(v)
Return the number of entries in the vector.
type(vector_t) function vector_cmult_left(a, c)
Vector-scalar multiplication .
subroutine vector_free(v)
Deallocate a vector.
type(vector_t) function vector_add_scalar_left(a, c)
Vector-scalar addition .
type(vector_t) function vector_sub_scalar_right(c, a)
Scalar-vector subtraction .
type(vector_t) function vector_add_vector(a, b)
Vector-vector addition .
type(vector_t) function vector_sub_scalar_left(a, c)
Vector-scalar subtraction .
type(vector_t) function vector_cmult_right(c, a)
Scalar-vector multiplication .
type(vector_t) function vector_sub_vector(a, b)
Vector-vector subtraction .
subroutine vector_assign_vector(v, w)
Assignment .