Package foundry.veil.api.opencl
Class VeilOpenCL
java.lang.Object
foundry.veil.api.opencl.VeilOpenCL
- All Implemented Interfaces:
AutoCloseable
,org.lwjgl.system.NativeResource
Veil implementation of OpenCL.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
Information about a device on an OpenCL platform.static final record
Information about a platform that can run OpenCL. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkCLError
(int errcode) Checks if the specified error code was notCL10.CL_SUCCESS
static void
checkCLError
(IntBuffer errcode) IntBuffer implementation ofcheckCLError(int)
void
free()
static VeilOpenCL
get()
static int
getDeviceInfoInt
(long device, int param) Retrieves the specified integer parameter from the specified device.static long
getDeviceInfoLong
(long device, int param) Retrieves the specified long parameter from the specified device.static String
getDeviceInfoString
(long device, int param) Retrieves the specified string parameter from the specified device.@Nullable CLEnvironment
@Nullable CLEnvironment
getEnvironment
(CLEnvironmentOptions options) Retrieves an environment that follows the specified requirements.@Nullable CLEnvironment
getEnvironment
(VeilOpenCL.DeviceInfo deviceInfo) Retrieves the environment for the specified device.static String
getPlatformInfoString
(long platform, int param) Retrieves the specified string parameter from the specified platform.static String
getProgramBuildInfo
(long program, long device, int param) Retrieves the specified program build info string from the specified program and device.static void
tryFree()
Attempts to release all OpenCL resources without initializing OpenCL.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.lwjgl.system.NativeResource
close
-
Field Details
-
LOGGER
public static final org.slf4j.Logger LOGGER
-
-
Method Details
-
getEnvironment
- Returns:
- The default OpenCL environment or
null
if no device was found
-
getEnvironment
Retrieves an environment that follows the specified requirements.- Parameters:
options
- The requirements for the requested environment- Returns:
- The environment for a device with those properties or
null
if no device was found
-
getEnvironment
Retrieves the environment for the specified device.- Parameters:
deviceInfo
- The device to retrieve the environment for- Returns:
- The environment for that device or
null
if no device was found ornull
if no device was found
-
getPlatforms
- Returns:
- All platforms OpenCL can be run on
-
getPriorityDevices
- Returns:
- All devices for all platforms sorted by compute priority
-
free
@Internal public void free()- Specified by:
free
in interfaceorg.lwjgl.system.NativeResource
-
tryFree
@Internal public static void tryFree()Attempts to release all OpenCL resources without initializing OpenCL. -
get
- Returns:
- The static Veil OpenCL implementation
-
checkCLError
IntBuffer implementation ofcheckCLError(int)
- Throws:
CLException
-
checkCLError
Checks if the specified error code was notCL10.CL_SUCCESS
- Parameters:
errcode
- The error code to validate- Throws:
CLException
- If the error code was not success
-
getProgramBuildInfo
Retrieves the specified program build info string from the specified program and device.- Parameters:
program
- The program to get the build info fordevice
- The device the program was built onparam
- The parameter to get- Returns:
- The program build info string
- Throws:
CLException
- If any error occurred while trying to get the string
-
getPlatformInfoString
Retrieves the specified string parameter from the specified platform.- Parameters:
platform
- The platform to get the string fromparam
- The parameter to get- Returns:
- The platform info string
- Throws:
CLException
- If any error occurred while trying to get the string
-
getDeviceInfoString
Retrieves the specified string parameter from the specified device.- Parameters:
device
- The device to get the string fromparam
- The parameter to get- Returns:
- The device info string
- Throws:
CLException
- If any error occurred while trying to get the string
-
getDeviceInfoInt
Retrieves the specified integer parameter from the specified device.- Parameters:
device
- The device to get the int fromparam
- The parameter to get- Returns:
- The device info int
- Throws:
CLException
- If any error occurred while trying to get the int
-
getDeviceInfoLong
Retrieves the specified long parameter from the specified device.- Parameters:
device
- The device to get the long fromparam
- The parameter to get- Returns:
- The device info long
- Throws:
CLException
- If any error occurred while trying to get the long
-