Neko  0.9.99
A portable framework for high-order spectral element flow simulations
device Module Reference

Device abstraction, common interface for various accelerators.

Data Types

interface  device_memcpy
 Copy data between host and device (or device and device) More...
 
interface  device_map
 Map a Fortran array to a device (allocate and associate) More...
 
interface  device_associate
 Associate a Fortran array to a (allocated) device pointer. More...
 
interface  device_associated
 Check if a Fortran array is assoicated with a device pointer. More...
 
interface  device_deassociate
 Deassociate a Fortran array from a device pointer. More...
 
interface  device_get_ptr
 Return the device pointer for an associated Fortran array. More...
 
interface  device_sync
 Synchronize a device or stream. More...
 

Functions/Subroutines

subroutine, public device_init
 
subroutine, public device_finalize
 
subroutine, public device_name (name)
 
integer function device_count ()
 Return the number of available devices. More...
 
subroutine, public device_alloc (x_d, s)
 Allocate memory on the device. More...
 
subroutine, public device_free (x_d)
 Deallocate memory on the device. More...
 
subroutine device_memcpy_r1 (x, x_d, n, dir, sync, strm)
 Copy data between host and device (rank 1 arrays) More...
 
subroutine device_memcpy_r2 (x, x_d, n, dir, sync, strm)
 Copy data between host and device (rank 2 arrays) More...
 
subroutine device_memcpy_r3 (x, x_d, n, dir, sync, strm)
 Copy data between host and device (rank 3 arrays) More...
 
subroutine device_memcpy_r4 (x, x_d, n, dir, sync, strm)
 Copy data between host and device (rank 4 arrays) More...
 
subroutine device_memcpy_cptr (dst, src, s, dir, sync, strm)
 Copy data between host and device (or device and device) (c-pointers) More...
 
subroutine, private device_memcpy_common (ptr_h, x_d, s, dir, sync_device, stream)
 Copy data between host and device. More...
 
subroutine device_associate_r1 (x, x_d)
 Associate a Fortran rank 1 array to a (allocated) device pointer. More...
 
subroutine device_associate_r2 (x, x_d)
 Associate a Fortran rank 2 array to a (allocated) device pointer. More...
 
subroutine device_associate_r3 (x, x_d)
 Associate a Fortran rank 3 array to a (allocated) device pointer. More...
 
subroutine device_associate_r4 (x, x_d)
 Associate a Fortran rank 4 array to a (allocated) device pointer. More...
 
subroutine device_deassociate_r1 (x)
 Deassociate a Fortran rank 1 array from a device pointer. More...
 
subroutine device_deassociate_r2 (x)
 Deassociate a Fortran rank 2 array from a device pointer. More...
 
subroutine device_deassociate_r3 (x)
 Deassociate a Fortran rank 3 array from a device pointer. More...
 
subroutine device_deassociate_r4 (x)
 Deassociate a Fortran rank 4 array from a device pointer. More...
 
subroutine device_map_r1 (x, x_d, n)
 Map a Fortran rank 1 array to a device (allocate and associate) More...
 
subroutine device_map_r2 (x, x_d, n)
 Map a Fortran rank 2 array to a device (allocate and associate) More...
 
subroutine device_map_r3 (x, x_d, n)
 Map a Fortran rank 3 array to a device (allocate and associate) More...
 
subroutine device_map_r4 (x, x_d, n)
 Map a Fortran rank 4 array to a device (allocate and associate) More...
 
logical function device_associated_r1 (x)
 Check if a Fortran rank 1 array is assoicated with a device pointer. More...
 
logical function device_associated_r2 (x)
 Check if a Fortran rank 2 array is assoicated with a device pointer. More...
 
logical function device_associated_r3 (x)
 Check if a Fortran rank 3 array is assoicated with a device pointer. More...
 
logical function device_associated_r4 (x)
 Check if a Fortran rank 4 array is assoicated with a device pointer. More...
 
type(c_ptr) function device_get_ptr_r1 (x)
 Return the device pointer for an associated Fortran rank 1 array. More...
 
type(c_ptr) function device_get_ptr_r2 (x)
 Return the device pointer for an associated Fortran rank 2 array. More...
 
type(c_ptr) function device_get_ptr_r3 (x)
 Return the device pointer for an associated Fortran rank 3 array. More...
 
type(c_ptr) function device_get_ptr_r4 (x)
 Return the device pointer for an associated Fortran rank 4 array. More...
 
subroutine device_sync_device ()
 Synchronize the device. More...
 
subroutine, public device_sync_stream (stream)
 Synchronize a device stream. More...
 
subroutine, public device_stream_create (stream, flags)
 Create a device stream/command queue. More...
 
subroutine device_stream_create_with_priority (stream, flags, prio)
 Create a device stream/command queue with priority. More...
 
subroutine, public device_stream_destroy (stream)
 Destroy a device stream/command queue. More...
 
subroutine, public device_stream_wait_event (stream, event, flags)
 Synchronize a device stream with an event. More...
 
subroutine, public device_profiler_start ()
 Start device profiling. More...
 
subroutine, public device_profiler_stop ()
 Stop device profiling. More...
 
subroutine, public device_event_create (event, flags)
 Create a device event queue. More...
 
subroutine, public device_event_destroy (event)
 Destroy a device event. More...
 
subroutine, public device_event_record (event, stream)
 Record a device event. More...
 
subroutine, public device_event_sync (event)
 Synchronize an event. More...
 

Variables

integer, parameter, public host_to_device = 1
 
integer, parameter, public device_to_host = 2
 
integer, parameter, public device_to_device = 3
 
type(htable_cptr_t), private device_addrtbl
 Table of host to device address mappings. More...
 

Function/Subroutine Documentation

◆ device_alloc()

subroutine, public device::device_alloc ( type(c_ptr), intent(inout)  x_d,
integer(c_size_t)  s 
)

Definition at line 163 of file device.F90.

Here is the caller graph for this function:

◆ device_associate_r1()

subroutine device::device_associate_r1 ( class(*), dimension(:), intent(inout), target  x,
type(c_ptr), intent(inout)  x_d 
)

Definition at line 487 of file device.F90.

◆ device_associate_r2()

subroutine device::device_associate_r2 ( class(*), dimension(:,:), intent(inout), target  x,
type(c_ptr), intent(inout)  x_d 
)

Definition at line 512 of file device.F90.

◆ device_associate_r3()

subroutine device::device_associate_r3 ( class(*), dimension(:,:,:), intent(inout), target  x,
type(c_ptr), intent(inout)  x_d 
)

Definition at line 537 of file device.F90.

◆ device_associate_r4()

subroutine device::device_associate_r4 ( class(*), dimension(:,:,:,:), intent(inout), target  x,
type(c_ptr), intent(inout)  x_d 
)

Definition at line 562 of file device.F90.

◆ device_associated_r1()

logical function device::device_associated_r1 ( class(*), dimension(:), intent(inout), target  x)

Definition at line 799 of file device.F90.

◆ device_associated_r2()

logical function device::device_associated_r2 ( class(*), dimension(:,:), intent(inout), target  x)

Definition at line 826 of file device.F90.

◆ device_associated_r3()

logical function device::device_associated_r3 ( class(*), dimension(:,:,:), intent(inout), target  x)

Definition at line 853 of file device.F90.

◆ device_associated_r4()

logical function device::device_associated_r4 ( class(*), dimension(:,:,:,:), intent(inout), target  x)

Definition at line 880 of file device.F90.

◆ device_count()

integer function device::device_count

Definition at line 150 of file device.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ device_deassociate_r1()

subroutine device::device_deassociate_r1 ( class(*), dimension(:), intent(inout), target  x)

Definition at line 587 of file device.F90.

◆ device_deassociate_r2()

subroutine device::device_deassociate_r2 ( class(*), dimension(:,:), intent(inout), target  x)

Definition at line 611 of file device.F90.

◆ device_deassociate_r3()

subroutine device::device_deassociate_r3 ( class(*), dimension(:,:,:), intent(inout), target  x)

Definition at line 635 of file device.F90.

◆ device_deassociate_r4()

subroutine device::device_deassociate_r4 ( class(*), dimension(:,:,:,:), intent(inout), target  x)

Definition at line 659 of file device.F90.

◆ device_event_create()

subroutine, public device::device_event_create ( type(c_ptr), intent(inout)  event,
integer, optional  flags 
)

Definition at line 1163 of file device.F90.

Here is the caller graph for this function:

◆ device_event_destroy()

subroutine, public device::device_event_destroy ( type(c_ptr), intent(inout)  event)

Definition at line 1193 of file device.F90.

Here is the caller graph for this function:

◆ device_event_record()

subroutine, public device::device_event_record ( type(c_ptr), intent(in), target  event,
type(c_ptr), intent(in)  stream 
)

Definition at line 1209 of file device.F90.

Here is the caller graph for this function:

◆ device_event_sync()

subroutine, public device::device_event_sync ( type(c_ptr), intent(in), target  event)

Definition at line 1228 of file device.F90.

Here is the caller graph for this function:

◆ device_finalize()

subroutine, public device::device_finalize

Definition at line 121 of file device.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ device_free()

subroutine, public device::device_free ( type(c_ptr), intent(inout)  x_d)

Definition at line 184 of file device.F90.

Here is the caller graph for this function:

◆ device_get_ptr_r1()

type(c_ptr) function device::device_get_ptr_r1 ( class(*), dimension(:), intent(in), target  x)

Definition at line 907 of file device.F90.

Here is the caller graph for this function:

◆ device_get_ptr_r2()

type(c_ptr) function device::device_get_ptr_r2 ( class(*), dimension(:,:), intent(in), target  x)

Definition at line 935 of file device.F90.

Here is the caller graph for this function:

◆ device_get_ptr_r3()

type(c_ptr) function device::device_get_ptr_r3 ( class(*), dimension(:,:,:), intent(in), target  x)

Definition at line 963 of file device.F90.

Here is the caller graph for this function:

◆ device_get_ptr_r4()

type(c_ptr) function device::device_get_ptr_r4 ( class(*), dimension(:,:,:,:), intent(in), target  x)

Definition at line 991 of file device.F90.

Here is the caller graph for this function:

◆ device_init()

subroutine, public device::device_init

Definition at line 106 of file device.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ device_map_r1()

subroutine device::device_map_r1 ( class(*), dimension(:), intent(inout), target  x,
type(c_ptr), intent(inout)  x_d,
integer, intent(in)  n 
)

Definition at line 683 of file device.F90.

◆ device_map_r2()

subroutine device::device_map_r2 ( class(*), dimension(:,:), intent(inout), target  x,
type(c_ptr), intent(inout)  x_d,
integer, intent(in)  n 
)

Definition at line 712 of file device.F90.

◆ device_map_r3()

subroutine device::device_map_r3 ( class(*), dimension(:,:,:), intent(inout), target  x,
type(c_ptr), intent(inout)  x_d,
integer, intent(in)  n 
)

Definition at line 741 of file device.F90.

◆ device_map_r4()

subroutine device::device_map_r4 ( class(*), dimension(:,:,:,:), intent(inout), target  x,
type(c_ptr), intent(inout)  x_d,
integer, intent(in)  n 
)

Definition at line 770 of file device.F90.

◆ device_memcpy_common()

subroutine, private device::device_memcpy_common ( type(c_ptr), intent(inout)  ptr_h,
type(c_ptr), intent(inout)  x_d,
integer(c_size_t), intent(in)  s,
integer, intent(in), value  dir,
logical, intent(in)  sync_device,
type(c_ptr), intent(inout)  stream 
)
private
Note
For device to device copies, ptr_h is assumed to be the dst device pointer

Definition at line 386 of file device.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ device_memcpy_cptr()

subroutine device::device_memcpy_cptr ( type(c_ptr), intent(inout)  dst,
type(c_ptr), intent(inout)  src,
integer(c_size_t), intent(in)  s,
integer, intent(in), value  dir,
logical, optional  sync,
type(c_ptr), optional  strm 
)
Note
For host-device copies dst is the host pointer and src is the device pointer (regardless of dir)

Definition at line 357 of file device.F90.

◆ device_memcpy_r1()

subroutine device::device_memcpy_r1 ( class(*), dimension(:), intent(inout), target  x,
type(c_ptr), intent(inout)  x_d,
integer, intent(in)  n,
integer, intent(in), value  dir,
logical  sync,
type(c_ptr), optional  strm 
)

Definition at line 203 of file device.F90.

◆ device_memcpy_r2()

subroutine device::device_memcpy_r2 ( class(*), dimension(:,:), intent(inout), target  x,
type(c_ptr), intent(inout)  x_d,
integer, intent(in)  n,
integer, intent(in), value  dir,
logical  sync,
type(c_ptr), optional  strm 
)

Definition at line 241 of file device.F90.

◆ device_memcpy_r3()

subroutine device::device_memcpy_r3 ( class(*), dimension(:,:,:), intent(inout), target  x,
type(c_ptr), intent(inout)  x_d,
integer, intent(in)  n,
integer, intent(in), value  dir,
logical  sync,
type(c_ptr), optional  strm 
)

Definition at line 279 of file device.F90.

◆ device_memcpy_r4()

subroutine device::device_memcpy_r4 ( class(*), dimension(:,:,:,:), intent(inout), target  x,
type(c_ptr), intent(inout)  x_d,
integer, intent(in)  n,
integer, intent(in), value  dir,
logical  sync,
type(c_ptr), optional  strm 
)

Definition at line 317 of file device.F90.

◆ device_name()

subroutine, public device::device_name ( character(len=*), intent(inout)  name)

Definition at line 137 of file device.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ device_profiler_start()

subroutine, public device::device_profiler_start

Definition at line 1145 of file device.F90.

Here is the caller graph for this function:

◆ device_profiler_stop()

subroutine, public device::device_profiler_stop

Definition at line 1154 of file device.F90.

Here is the caller graph for this function:

◆ device_stream_create()

subroutine, public device::device_stream_create ( type(c_ptr), intent(inout)  stream,
integer, optional  flags 
)

Definition at line 1054 of file device.F90.

◆ device_stream_create_with_priority()

subroutine device::device_stream_create_with_priority ( type(c_ptr), intent(inout)  stream,
integer, intent(in)  flags,
integer, intent(in)  prio 
)

Definition at line 1087 of file device.F90.

Here is the caller graph for this function:

◆ device_stream_destroy()

subroutine, public device::device_stream_destroy ( type(c_ptr), intent(inout)  stream)

Definition at line 1104 of file device.F90.

Here is the caller graph for this function:

◆ device_stream_wait_event()

subroutine, public device::device_stream_wait_event ( type(c_ptr), intent(in)  stream,
type(c_ptr), intent(in), target  event,
integer  flags 
)

Definition at line 1122 of file device.F90.

Here is the caller graph for this function:

◆ device_sync_device()

subroutine device::device_sync_device

Definition at line 1019 of file device.F90.

◆ device_sync_stream()

subroutine, public device::device_sync_stream ( type(c_ptr), intent(in)  stream)

Definition at line 1036 of file device.F90.

Here is the caller graph for this function:

Variable Documentation

◆ device_addrtbl

type(htable_cptr_t), private device::device_addrtbl
private

Definition at line 92 of file device.F90.

◆ device_to_device

integer, parameter, public device::device_to_device = 3

Definition at line 47 of file device.F90.

◆ device_to_host

integer, parameter, public device::device_to_host = 2

Definition at line 47 of file device.F90.

◆ host_to_device

integer, parameter, public device::host_to_device = 1

Definition at line 47 of file device.F90.