40 use,
intrinsic :: iso_c_binding
48 type(c_ptr) :: x_d = c_null_ptr
50 integer,
private :: n = 0
66 generic ::
assignment(=) => assign
76 integer,
intent(in) :: size
79 call neko_error(
'Device array cannot be initialized when ' // &
80 'NEKO_BCKND_DEVICE is not set to 1')
84 call this%allocate(size)
95 if (c_associated(this%x_d))
call device_free(this%x_d)
104 integer,
intent(in) :: size
105 integer(c_size_t) :: c_size
110 c_size =
size * int(4, c_size_t)
112 c_size =
size * int(8, c_size_t)
127 if (.not. source%is_allocated())
then
130 else if (source%size() .ne. this%size())
then
132 call this%allocate(source%size())
153 is_alloc = c_associated(this%x_d)
Module containing device only array type.
pure integer function device_array_size(this)
Return the size of the device array.
subroutine device_array_assign(this, source)
Assignment with deep-copy ownership semantics.
subroutine device_array_init(this, size)
Initialize a device array of size size.
subroutine device_array_free(this)
Free a device array.
subroutine device_array_allocate(this, size)
Allocate a device array (used by init and assignment).
pure logical function device_array_is_allocated(this)
Check whether the device array is allocated.
subroutine, public device_rzero(a_d, n, strm)
Zero a real vector.
subroutine, public device_copy(a_d, b_d, n, strm)
Copy a vector .
Device abstraction, common interface for various accelerators.
subroutine, public device_free(x_d)
Deallocate memory on the device.
subroutine, public device_alloc(x_d, s)
Allocate memory on the device.
integer, parameter neko_bcknd_device
integer, parameter, public dp
integer, parameter, public sp
integer, parameter, public rp
Global precision used in computations.
Device-only temporary array.