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 :: n4 = 0
53 integer,
private :: n = 0
62 generic :: init => init_dims
109 integer,
intent(in) :: n1
110 integer,
intent(in) :: n2
111 integer,
intent(in) :: n3
112 integer,
intent(in) :: n4
113 character(len=*),
intent(in),
optional :: name
120 call t%alloc(n1, n2, n3, n4)
122 if (
present(name))
then
136 integer,
intent(in) :: n1
137 integer,
intent(in) :: n2
138 integer,
intent(in) :: n3
139 integer,
intent(in) :: n4
143 allocate(t%x(n1, n2, n3, n4))
155 call cfill(t%x, 0.0_rp, t%n)
164 if (
allocated(t%x))
then
194 integer,
intent(in) :: memdir
195 logical,
intent(in) :: sync
242 if (
allocated(t%x))
then
246 if (.not.
allocated(t%x))
then
253 allocate(t%x(t%n1, t%n2, t%n3, t%n4))
276 real(kind=
rp),
intent(in) :: s
278 if (.not.
allocated(t%x))
then
298 type(
tensor4_t),
target,
intent(in) :: ptr
309 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 tensor4_ptr_free(this)
Destructor. Just nullifies the pointer.
subroutine tensor4_copy_from(t, memdir, sync)
Easy way to copy between host and device.
pure integer function tensor4_size(t)
Returns the number of entries in the tensor.
subroutine tensor4_init(t, n1, n2, n3, n4, name)
Initialise a tensor of size n1*n2*n3*n4.
subroutine tensor4_allocate(t, n1, n2, n3, n4)
Allocate a tensor of size n1*n2*n3*n4.
subroutine tensor4_free(t)
Deallocate a tensor.
pure integer function tensor4_n3(t)
Returns the size of the third dimension.
subroutine tensor4_ptr_init(this, ptr)
Constructor. Just assigns the pointer.
pure integer function tensor4_n4(t)
Returns the size of the fourth dimension.
pure integer function tensor4_n2(t)
Returns the size of the second dimension.
pure integer function tensor4_n1(t)
Returns the size of the first dimension.
subroutine tensor4_assign_tensor4(t, w)
Assignment .
subroutine tensor4_assign_scalar(t, s)
Assignment .
integer, parameter, public neko_varname_len