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

Device abstraction, common interface for various accelerators. More...

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)
 
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...
 

Detailed Description

Device abstraction, common interface for various accelerators.

Function/Subroutine Documentation

◆ device_alloc()

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

Allocate memory on the device.

Definition at line 150 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 
)

Associate a Fortran rank 1 array to a (allocated) device pointer.

Definition at line 468 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 
)

Associate a Fortran rank 2 array to a (allocated) device pointer.

Definition at line 493 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 
)

Associate a Fortran rank 3 array to a (allocated) device pointer.

Definition at line 518 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 
)

Associate a Fortran rank 4 array to a (allocated) device pointer.

Definition at line 543 of file device.F90.

◆ device_associated_r1()

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

Check if a Fortran rank 1 array is assoicated with a device pointer.

Definition at line 780 of file device.F90.

◆ device_associated_r2()

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

Check if a Fortran rank 2 array is assoicated with a device pointer.

Definition at line 807 of file device.F90.

◆ device_associated_r3()

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

Check if a Fortran rank 3 array is assoicated with a device pointer.

Definition at line 834 of file device.F90.

◆ device_associated_r4()

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

Check if a Fortran rank 4 array is assoicated with a device pointer.

Definition at line 861 of file device.F90.

◆ device_deassociate_r1()

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

Deassociate a Fortran rank 1 array from a device pointer.

Definition at line 568 of file device.F90.

◆ device_deassociate_r2()

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

Deassociate a Fortran rank 2 array from a device pointer.

Definition at line 592 of file device.F90.

◆ device_deassociate_r3()

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

Deassociate a Fortran rank 3 array from a device pointer.

Definition at line 616 of file device.F90.

◆ device_deassociate_r4()

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

Deassociate a Fortran rank 4 array from a device pointer.

Definition at line 640 of file device.F90.

◆ device_event_create()

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

Create a device event queue.

Definition at line 1141 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)

Destroy a device event.

Definition at line 1171 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)  event,
type(c_ptr), intent(in)  stream 
)

Record a device event.

Definition at line 1189 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)  event)

Synchronize an event.

Definition at line 1208 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)

Deallocate memory on the device.

Definition at line 171 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)

Return the device pointer for an associated Fortran rank 1 array.

Definition at line 888 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)

Return the device pointer for an associated Fortran rank 2 array.

Definition at line 916 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)

Return the device pointer for an associated Fortran rank 3 array.

Definition at line 944 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)

Return the device pointer for an associated Fortran rank 4 array.

Definition at line 972 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 
)

Map a Fortran rank 1 array to a device (allocate and associate)

Definition at line 664 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 
)

Map a Fortran rank 2 array to a device (allocate and associate)

Definition at line 693 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 
)

Map a Fortran rank 3 array to a device (allocate and associate)

Definition at line 722 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 
)

Map a Fortran rank 4 array to a device (allocate and associate)

Definition at line 751 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

Copy data between host and device.

Note
For device to device copies, ptr_h is assumed to be the dst device pointer

Definition at line 373 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 
)

Copy data between host and device (or device and device) (c-pointers)

Note
For host-device copies dst is the host pointer and src is the device pointer (regardless of dir)

Definition at line 344 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 
)

Copy data between host and device (rank 1 arrays)

Definition at line 190 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 
)

Copy data between host and device (rank 2 arrays)

Definition at line 228 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 
)

Copy data between host and device (rank 3 arrays)

Definition at line 266 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 
)

Copy data between host and device (rank 4 arrays)

Definition at line 304 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

Start device profiling.

Definition at line 1123 of file device.F90.

Here is the caller graph for this function:

◆ device_profiler_stop()

subroutine, public device::device_profiler_stop

Stop device profiling.

Definition at line 1132 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 
)

Create a device stream/command queue.

Definition at line 1035 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 
)

Create a device stream/command queue with priority.

Definition at line 1068 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)

Destroy a device stream/command queue.

Definition at line 1085 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)  event,
integer  flags 
)

Synchronize a device stream with an event.

Definition at line 1103 of file device.F90.

Here is the caller graph for this function:

◆ device_sync_device()

subroutine device::device_sync_device

Synchronize the device.

Definition at line 1000 of file device.F90.

◆ device_sync_stream()

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

Synchronize a device stream.

Definition at line 1017 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

Table of host to device address mappings.

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.