41 use,
intrinsic :: iso_c_binding
46 real(kind=
rp),
allocatable :: x(:,:,:)
47 character(len=NEKO_VARNAME_LEN) :: name =
""
48 type(c_ptr) :: x_d = c_null_ptr
49 integer,
private :: n1 = 0
50 integer,
private :: n2 = 0
51 integer,
private :: n3 = 0
52 integer,
private :: n = 0
101 integer,
intent(in) :: n1
102 integer,
intent(in) :: n2
103 integer,
intent(in) :: n3
104 character(len=*),
intent(in),
optional :: name
111 call t%alloc(n1, n2, n3)
113 if (
present(name))
then
126 integer,
intent(in) :: n1
127 integer,
intent(in) :: n2
128 integer,
intent(in) :: n3
132 allocate(t%x(n1, n2, n3))
143 call cfill(t%x, 0.0_rp, t%n)
152 if (
allocated(t%x))
then
181 integer,
intent(in) :: memdir
182 logical,
intent(in) :: sync
219 dims = [t%n1, t%n2, t%n3]
229 if (
allocated(t%x))
then
233 if (.not.
allocated(t%x))
then
239 allocate(t%x(t%n1, t%n2, t%n3))
262 real(kind=
rp),
intent(in) :: s
264 if (.not.
allocated(t%x))
then
284 type(
tensor3_t),
target,
intent(in) :: ptr
295 if (
associated(this%ptr))
then
Map a Fortran array to a device (allocate and associate)
Copy data between host and device (or device and device)
Synchronize a device or stream.
Unmap a Fortran array from a device (deassociate and free)
subroutine, public device_copy(a_d, b_d, n, strm)
Copy a vector .
subroutine, public device_cfill(a_d, c, n, strm)
Set all elements to a constant c .
Device abstraction, common interface for various accelerators.
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 tensor3_ptr_free(this)
Destructor. Just nullifies the pointer.
subroutine tensor3_init(t, n1, n2, n3, name)
Initialise a tensor of size n1*n2*n3.
pure integer function tensor3_n3(t)
Returns the size of the third dimension.
pure integer function, dimension(3) tensor3_get_dims(t)
Returns the dimensions of the tensor.
pure integer function tensor3_n2(t)
Returns the size of the second dimension.
subroutine tensor3_assign_scalar(t, s)
Assignment .
subroutine tensor3_ptr_init(this, ptr)
Constructor. Just assigns the pointer.
pure integer function tensor3_size(t)
Returns the number of entries in the tensor.
subroutine tensor3_copy_from(t, memdir, sync)
Easy way to copy between host and device.
pure integer function tensor3_n1(t)
Returns the size of the first dimension.
subroutine tensor3_assign_tensor3(t, w)
Assignment .
subroutine tensor3_allocate(t, n1, n2, n3)
Allocate a tensor of size n1*n2*n3.
subroutine tensor3_free(t)
Deallocate a tensor.
integer, parameter, public neko_varname_len