Devices Interface

The devices interface lets you specify where computations should run for a specific object.

Any object that is meant to run on a specific device should implement the get_device method to make use of this interface.

ParallelKDE.Devices.get_deviceMethod
get_device(device::Any)

Obtain the device object for a given device type.

If the method is called with an unsupported type, it returns a DeviceNotSpecified object.

Additionally, a device may have one or more methods that it has available for use as well default methods when the user does not specify one. Furthermore, a Symbol may be used to identify a device type. These methods are registered in dictionaries in the Devices.jl module.

This dictionaries can be used to query the validity of a selected method for a device.

ParallelKDE.Devices.ensure_valid_implementationFunction
ensure_valid_implementation(device::AbstractDevice, implementation::Symbol)

Ensure that the specified implementation is valid for the given device.

If the implementation is not valid, an ArgumentError is thrown.

Since GPU devices may work more efficiently with single-precision numbers, the package provides a method to convert double precision numbers to single precision when possible.

ParallelKDE.Devices.convert32Function
convert32(x)

Converts into a 32-bit representation if x is a Float64, CuArray{Float64}, or Array{Float64}.

convert32(args...; kwargs...)

If multiple arguments are provided, converts each argument to a 32-bit representation if applicable, and returns a tuple of the converted arguments and a dictionary of converted keyword arguments.