JOCL v2.6.0-rc-20250722
JOCL, OpenCL® API Binding for Java™ (public API).
com.jogamp.opencl.CLPlatform Class Reference

CLPlatfrorm representing a OpenCL implementation (e.g. More...

Collaboration diagram for com.jogamp.opencl.CLPlatform:

Public Member Functions

CLDevice[] listCLDevices ()
 Lists all physical devices available on this platform. More...
 
CLDevice[] listCLDevices (final CLDevice.Type... types)
 Lists all physical devices available on this platform matching the given CLDevice.Type. More...
 
CLDevice[] listCLDevices (final Filter< CLDevice >... filters)
 Lists all physical devices available on this platform matching the given Filter. More...
 
CLDevice getMaxFlopsDevice ()
 Returns the device with maximal FLOPS from this platform. More...
 
CLDevice getMaxFlopsDevice (final CLDevice.Type... types)
 Returns the device with maximal FLOPS and the specified type from this platform. More...
 
CLDevice getMaxFlopsDevice (final Filter< CLDevice >... filter)
 Returns the device with maximal FLOPS and the specified type from this platform. More...
 
String getName ()
 Returns the platform name. More...
 
CLVersion getVersion ()
 Returns the OpenCL version supported by this platform. More...
 
String getSpecVersion ()
 Returns the OpenCL Specification version supported by this platform. More...
 
boolean isAtLeast (final CLVersion other)
 
boolean isAtLeast (final int major, final int minor)
 
String getProfile ()
 Returns the platform profile. More...
 
String getVendor ()
 Returns the platform vendor. More...
 
boolean isVendorAMD ()
 
boolean isVendorIntel ()
 
String getICDSuffix ()
 Returns the ICD suffix. More...
 
boolean isExtensionAvailable (final String extension)
 Returns true if the extension is supported on this platform. More...
 
synchronized Set< String > getExtensions ()
 Returns all platform extension names as unmodifiable Set. More...
 
Map< String, String > getProperties ()
 Returns a Map of platform properties with the enum names as keys. More...
 
final String getInfoString (final int key)
 Returns a info string in exchange for a key (CL_PLATFORM_*). More...
 
final CLPlatformInfoAccessor getCLAccessor ()
 
String toString ()
 
boolean equals (final Object obj)
 
int hashCode ()
 

Static Public Member Functions

static boolean isAvailable ()
 
static void initialize () throws JogampRuntimeException
 Eagerly initializes JOCL. More...
 
static CLPlatform getDefault ()
 Returns the default OpenCL platform or null when no platform found. More...
 
static CLPlatform getDefault (final Filter< CLPlatform >... filter)
 Returns the default OpenCL platform or null when no platform found. More...
 
static CLPlatform[] listCLPlatforms ()
 Lists all available OpenCL implementations. More...
 
static CLPlatform[] listCLPlatforms (final Filter< CLPlatform >... filter)
 Lists all available OpenCL implementations. More...
 
static CL getLowLevelCLInterface ()
 Returns the low level binding interface to the OpenCL APIs. More...
 
static CL getLowLevelCLInterfaceForDevice (final long device)
 Returns the low level binding interface to the OpenCL APIs for the specified device. More...
 
static void unloadCompiler ()
 Hint to allow the implementation to release the resources allocated by the OpenCL compiler. More...
 

Public Attributes

final long ID
 OpenCL platform id for this platform. More...
 
final CLVersion version
 Version of this OpenCL platform. More...
 

Protected Member Functions

 CLPlatform (final long id, final CLAccessorFactory factory)
 
CLDevice createDevice (final long id)
 
CL getCLBinding ()
 

Protected Attributes

final CLPlatformInfoAccessor info
 

Static Protected Attributes

static CL cl
 

Detailed Description

CLPlatfrorm representing a OpenCL implementation (e.g.

graphics driver).

optional eager initialization:

    if( !CLPlatform.isAvailable() ) {
       return; // abort
    }
    try{
         CLPlatform.initialize();
    }catch(JogampRuntimeException ex) {
         throw new RuntimeException("could not load Java OpenCL Binding");
    }

</p

Example initialization:

    if( !CLPlatform.isAvailable() ) {
       return; // abort
    }
    CLPlatform platform = CLPlatform.getDefault(type(GPU));

    if(platform == null) {
         throw new RuntimeException("please update your graphics drivers");
    }

    CLContext context = CLContext.create(platform.getMaxFlopsDevice());
    try {
         // use it
    }finally{
         context.release();
    }

</p

concurrency:
CLPlatform is threadsafe.

Author
Michael Bien, et al.
See also
isAvailable()
initialize()
getDefault()
listCLPlatforms()

Definition at line 99 of file CLPlatform.java.

Constructor & Destructor Documentation

◆ CLPlatform()

com.jogamp.opencl.CLPlatform.CLPlatform ( final long  id,
final CLAccessorFactory  factory 
)
protected

Definition at line 123 of file CLPlatform.java.

Here is the call graph for this function:

Member Function Documentation

◆ createDevice()

CLDevice com.jogamp.opencl.CLPlatform.createDevice ( final long  id)
protected

Definition at line 335 of file CLPlatform.java.

Here is the caller graph for this function:

◆ equals()

boolean com.jogamp.opencl.CLPlatform.equals ( final Object  obj)

Definition at line 556 of file CLPlatform.java.

◆ getCLAccessor()

final CLPlatformInfoAccessor com.jogamp.opencl.CLPlatform.getCLAccessor ( )

Definition at line 539 of file CLPlatform.java.

◆ getCLBinding()

CL com.jogamp.opencl.CLPlatform.getCLBinding ( )
protected

Definition at line 543 of file CLPlatform.java.

Here is the caller graph for this function:

◆ getDefault() [1/2]

static CLPlatform com.jogamp.opencl.CLPlatform.getDefault ( )
static

Returns the default OpenCL platform or null when no platform found.

Definition at line 179 of file CLPlatform.java.

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

◆ getDefault() [2/2]

static CLPlatform com.jogamp.opencl.CLPlatform.getDefault ( final Filter< CLPlatform >...  filter)
static

Returns the default OpenCL platform or null when no platform found.

Definition at line 187 of file CLPlatform.java.

Here is the call graph for this function:

◆ getExtensions()

synchronized Set< String > com.jogamp.opencl.CLPlatform.getExtensions ( )

Returns all platform extension names as unmodifiable Set.

Definition at line 503 of file CLPlatform.java.

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

◆ getICDSuffix()

String com.jogamp.opencl.CLPlatform.getICDSuffix ( )

Returns the ICD suffix.

Definition at line 488 of file CLPlatform.java.

Here is the call graph for this function:

◆ getInfoString()

final String com.jogamp.opencl.CLPlatform.getInfoString ( final int  key)

Returns a info string in exchange for a key (CL_PLATFORM_*).

Definition at line 531 of file CLPlatform.java.

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

◆ getLowLevelCLInterface()

static CL com.jogamp.opencl.CLPlatform.getLowLevelCLInterface ( )
static

Returns the low level binding interface to the OpenCL APIs.

This interface is always for OpenCL 1.1.

Definition at line 245 of file CLPlatform.java.

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

◆ getLowLevelCLInterfaceForDevice()

static CL com.jogamp.opencl.CLPlatform.getLowLevelCLInterfaceForDevice ( final long  device)
static

Returns the low level binding interface to the OpenCL APIs for the specified device.

This interface is the newest one the device supports.

Definition at line 254 of file CLPlatform.java.

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

◆ getMaxFlopsDevice() [1/3]

CLDevice com.jogamp.opencl.CLPlatform.getMaxFlopsDevice ( )

Returns the device with maximal FLOPS from this platform.

The device speed is estimated by calculating the product of MAX_COMPUTE_UNITS and MAX_CLOCK_FREQUENCY.

See also
getMaxFlopsDevice(com.jogamp.opencl.CLDevice.Type...)

Definition at line 395 of file CLPlatform.java.

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

◆ getMaxFlopsDevice() [2/3]

CLDevice com.jogamp.opencl.CLPlatform.getMaxFlopsDevice ( final CLDevice.Type...  types)

Returns the device with maximal FLOPS and the specified type from this platform.

The device speed is estimated by calculating the product of MAX_COMPUTE_UNITS and MAX_CLOCK_FREQUENCY.

Definition at line 404 of file CLPlatform.java.

Here is the call graph for this function:

◆ getMaxFlopsDevice() [3/3]

CLDevice com.jogamp.opencl.CLPlatform.getMaxFlopsDevice ( final Filter< CLDevice >...  filter)

Returns the device with maximal FLOPS and the specified type from this platform.

The device speed is estimated by calculating the product of MAX_COMPUTE_UNITS and MAX_CLOCK_FREQUENCY.

Definition at line 413 of file CLPlatform.java.

Here is the call graph for this function:

◆ getName()

String com.jogamp.opencl.CLPlatform.getName ( )

Returns the platform name.

Definition at line 421 of file CLPlatform.java.

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

◆ getProfile()

String com.jogamp.opencl.CLPlatform.getProfile ( )

Returns the platform profile.

Definition at line 458 of file CLPlatform.java.

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

◆ getProperties()

Map< String, String > com.jogamp.opencl.CLPlatform.getProperties ( )

Returns a Map of platform properties with the enum names as keys.

See also
CLUtil::obtainPlatformProperties(com.jogamp.opencl.CLPlatform)

Definition at line 524 of file CLPlatform.java.

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

◆ getSpecVersion()

String com.jogamp.opencl.CLPlatform.getSpecVersion ( )

Returns the OpenCL Specification version supported by this platform.

Definition at line 436 of file CLPlatform.java.

Here is the call graph for this function:

◆ getVendor()

String com.jogamp.opencl.CLPlatform.getVendor ( )

Returns the platform vendor.

Definition at line 466 of file CLPlatform.java.

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

◆ getVersion()

CLVersion com.jogamp.opencl.CLPlatform.getVersion ( )

Returns the OpenCL version supported by this platform.

Definition at line 429 of file CLPlatform.java.

Here is the caller graph for this function:

◆ hashCode()

int com.jogamp.opencl.CLPlatform.hashCode ( )

Definition at line 571 of file CLPlatform.java.

◆ initialize()

static void com.jogamp.opencl.CLPlatform.initialize ( ) throws JogampRuntimeException
static

Eagerly initializes JOCL.

Subsequent calls do nothing.

Exceptions
JogampRuntimeExceptionif something went wrong in the initialization (e.g. OpenCL lib not found).
See also
isAvailable()

Definition at line 146 of file CLPlatform.java.

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

◆ isAtLeast() [1/2]

boolean com.jogamp.opencl.CLPlatform.isAtLeast ( final CLVersion  other)
See also
CLVersion::isAtLeast(com.jogamp.opencl.CLVersion)

Definition at line 443 of file CLPlatform.java.

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

◆ isAtLeast() [2/2]

boolean com.jogamp.opencl.CLPlatform.isAtLeast ( final int  major,
final int  minor 
)
See also
CLVersion::isAtLeast(int, int)

Definition at line 450 of file CLPlatform.java.

Here is the call graph for this function:

◆ isAvailable()

static boolean com.jogamp.opencl.CLPlatform.isAvailable ( )
static
Returns
true if OpenCL is available on this machine, i.e. all native libraries could be loaded (CL and CL/JNI).

Definition at line 139 of file CLPlatform.java.

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

◆ isExtensionAvailable()

boolean com.jogamp.opencl.CLPlatform.isExtensionAvailable ( final String  extension)

Returns true if the extension is supported on this platform.

Definition at line 495 of file CLPlatform.java.

Here is the call graph for this function:

◆ isVendorAMD()

boolean com.jogamp.opencl.CLPlatform.isVendorAMD ( )
Returns
true if the vendor is AMD.

Definition at line 473 of file CLPlatform.java.

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

◆ isVendorIntel()

boolean com.jogamp.opencl.CLPlatform.isVendorIntel ( )
Returns
true if the vendor is Intel.

Definition at line 480 of file CLPlatform.java.

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

◆ listCLDevices() [1/3]

CLDevice[] com.jogamp.opencl.CLPlatform.listCLDevices ( )

Lists all physical devices available on this platform.

See also
listCLDevices(com.jogamp.opencl.CLDevice.Type...)

Definition at line 283 of file CLPlatform.java.

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

◆ listCLDevices() [2/3]

CLDevice[] com.jogamp.opencl.CLPlatform.listCLDevices ( final CLDevice.Type...  types)

Lists all physical devices available on this platform matching the given CLDevice.Type.

Definition at line 295 of file CLPlatform.java.

Here is the call graph for this function:

◆ listCLDevices() [3/3]

CLDevice[] com.jogamp.opencl.CLPlatform.listCLDevices ( final Filter< CLDevice >...  filters)

Lists all physical devices available on this platform matching the given Filter.

Definition at line 318 of file CLPlatform.java.

Here is the call graph for this function:

◆ listCLPlatforms() [1/2]

static CLPlatform[] com.jogamp.opencl.CLPlatform.listCLPlatforms ( )
static

Lists all available OpenCL implementations.

Exceptions
CLExceptionif something went wrong initializing OpenCL

Definition at line 210 of file CLPlatform.java.

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

◆ listCLPlatforms() [2/2]

static CLPlatform[] com.jogamp.opencl.CLPlatform.listCLPlatforms ( final Filter< CLPlatform >...  filter)
static

Lists all available OpenCL implementations.

The platforms returned must pass all filters.

Parameters
filterAcceptance filter for the returned platforms.
Exceptions
CLExceptionif something went wrong initializing OpenCL

Definition at line 219 of file CLPlatform.java.

Here is the call graph for this function:

◆ toString()

String com.jogamp.opencl.CLPlatform.toString ( )

Definition at line 548 of file CLPlatform.java.

Here is the call graph for this function:

◆ unloadCompiler()

static void com.jogamp.opencl.CLPlatform.unloadCompiler ( )
static

Hint to allow the implementation to release the resources allocated by the OpenCL compiler.

Calls to CLProgram#build() after unloadCompiler will reload the compiler if necessary.

Definition at line 273 of file CLPlatform.java.

Here is the call graph for this function:

Member Data Documentation

◆ cl

CL com.jogamp.opencl.CLPlatform.cl
staticprotected

Definition at line 111 of file CLPlatform.java.

◆ ID

final long com.jogamp.opencl.CLPlatform.ID

OpenCL platform id for this platform.

Definition at line 104 of file CLPlatform.java.

◆ info

final CLPlatformInfoAccessor com.jogamp.opencl.CLPlatform.info
protected

Definition at line 117 of file CLPlatform.java.

◆ version

final CLVersion com.jogamp.opencl.CLPlatform.version

Version of this OpenCL platform.

Definition at line 109 of file CLPlatform.java.


The documentation for this class was generated from the following file: