java.lang.Object
uk.ac.manchester.tornado.api.TornadoDeviceMap
Data structure to query and filter the TornadoVM Drivers and TornadoVM Devices that the TornadoVM Runtime can access.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a list with all backends that are accessible from the TornadoVM Runtime.getBackendsWithDevicePredicate(Predicate<? super TornadoDevice> predicate) Return a list of backends that corresponds to a filter applied to a predicate that queries and filters devices within each backend.getBackendsWithPredicate(Predicate<? super TornadoBackend> predicate) Returns a list of backends that correspond to a filter given by a predicate.getDevicesByName(String deviceName) Obtain a device object with a specific name.getDevicesByType(TornadoDeviceType deviceType) Obtain a device object from a specific type (GPU, Accelerator, CPU).intMethod to return the total number of backends that are accessible from the TornadoVM Runtime.
-
Constructor Details
-
TornadoDeviceMap
public TornadoDeviceMap()
-
-
Method Details
-
getNumBackends
public int getNumBackends()Method to return the total number of backends that are accessible from the TornadoVM Runtime.- Returns:
- int
-
getAllBackends
Returns a list with all backends that are accessible from the TornadoVM Runtime.- Returns:
List<TornadoBackend>
-
getBackendsWithPredicate
Returns a list of backends that correspond to a filter given by a predicate.- Parameters:
predicate-predicate- Returns:
List<TornadoBackend>
-
getBackendsWithDevicePredicate
public List<TornadoBackend> getBackendsWithDevicePredicate(Predicate<? super TornadoDevice> predicate) Return a list of backends that corresponds to a filter applied to a predicate that queries and filters devices within each backend.Examples of queries: - Return all backends which devices have more than 4GB. - Return all backends that can access to an NVIDIA or Intel device.
- Parameters:
predicate-predicate- Returns:
List<TornadoBackend>
-
getDevicesByName
Obtain a device object with a specific name. This function returns a Stream of all devices that meet the criteria. The device objects could be from different backends. For example, if we have multiple backends installed, and we request a device name with "NVIDIA" in it. In this case, this function can return a stream with multiple devices from different backends pointing to the same device (e.g., an NVIDIA GPU using the OpenCL backend, and an NVIDIA GPU using the PTX backend).- Parameters:
deviceName- Name of the device.- Returns:
- Stream of devices that meet the criteria. Otherwise, an empty stream.
-
getDevicesByType
Obtain a device object from a specific type (GPU, Accelerator, CPU). This function returns a Stream of all devices that meet the criteria. The device objects could be from different backends. For example, if we have multiple backends installed, and we request any GPU device, this function will return all GPU devices (GPU-OpenCL, GPU-SPIR-V, GPU-PTX), even if they point to the exact same device.- Parameters:
deviceType-TornadoDeviceType- Returns:
- Stream of devices that meet the criteria. Otherwise, an empty stream.
-