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
99 integer,
intent(in) :: n1
100 integer,
intent(in) :: n2
101 integer,
intent(in) :: n3
102 character(len=*),
intent(in),
optional :: name
109 call t%alloc(n1, n2, n3)
111 if (
present(name))
then
124 integer,
intent(in) :: n1
125 integer,
intent(in) :: n2
126 integer,
intent(in) :: n3
130 allocate(t%x(n1, n2, n3))
141 call cfill(t%x, 0.0_rp, t%n)
150 if (
allocated(t%x))
then
179 integer,
intent(in) :: memdir
180 logical,
intent(in) :: sync
219 if (
allocated(t%x))
then
223 if (.not.
allocated(t%x))
then
229 allocate(t%x(t%n1, t%n2, t%n3))
252 real(kind=
rp),
intent(in) :: s
254 if (.not.
allocated(t%x))
then
274 type(
tensor3_t),
target,
intent(in) :: ptr
285 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 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