Platforms to show: All Mac Windows Linux Cross-Platform

Back to CLProgramMBS class.

CLProgramMBS.Binaries as String()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the program binaries for all devices associated with program.

For each device in program, the binary returned can be the binary specified for the device when program is created with Constructor or it can be the executable binary generated by BuildProgram. If program is created with Constructor (with Source code), the binary returned is the binary generated by BuildProgram. The bits returned can be an implementation-specific intermediate representation (a.k.a. IR) or device specific executable bits or both. The decision on which information is returned in the binary is up to the OpenCL implementation.

Each entry in this array is used by the implementation as the location in memory where to copy the program binary for a specific device, if there is a binary available.

Lasterror is set.

Some examples using this method:

CLProgramMBS.BinarySizes as UInt64()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array that contains the size in bytes of the program binary for each device associated with program.

The size of the array is the number of devices associated with program. If a binary is not available for a device(s), a size of zero is returned.

Lasterror is set.

Some examples using this method:

CLProgramMBS.BuildLog(device as CLDeviceMBS) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the build log when BuildProgram was called for device.

If build status of program for device is kBuildNone, an empty string is returned.
Lasterror is set.

Some examples using this method:

CLProgramMBS.BuildOptions(device as CLDeviceMBS) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the build options specified by the options argument in BuildProgram for device.

If build status of program for device is kBuildNone, an empty string is returned.
Lasterror is set.

CLProgramMBS.BuildProgram(device as CLDeviceMBS, options as string = "")

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Builds (compiles and links) a program executable from the program source or binary.

See other BuildProgram method for details

See also:

Some examples using this method:

CLProgramMBS.BuildProgram(devices() as CLDeviceMBS, options as string = "")

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Builds (compiles and links) a program executable from the program source or binary.

devicesOptional, a list of devices you want to build for. If you specify no device, you build for all devices.
deviceOptional, the device you want to build for. If you specify no device, you build for all devices.
optionsA string that describes the build options to be used for building the program executable. The list of supported options is described in "Build Options" below.

OpenCL allows program executables to be built using the source or the binary.

The build options are categorized as pre-processor options, options for math intrinsics, options that control optimization and miscellaneous options. This specification defines a standard set of options that must be supported by an OpenCL compiler when building program executables online or offline. These may be extended by a set of vendor- or platform-specific options.

Preprocessor Options

These options control the OpenCL preprocessor which is run on each program source before actual compilation. -D options are processed in the order they are given in the options argument to clBuildProgram.
-D name
Predefine name as a macro, with definition 1.

-D name=definition
The contents of definition are tokenized and processed as if they appeared during translation phase three in a '#define' directive. In particular, the definition will be truncated by embedded newline characters.

-I dir
Add the directory dir to the list of directories to be searched for header files.


Math Intrinsics Options

These options control compiler behavior regarding floating-point arithmetic. These options trade off between speed and correctness.

-cl-single-precision-constant
Treat double precision floating-point constant as single precision constant.

-cl-denorms-are-zero
This option controls how single precision and double precision denormalized numbers are handled. If specified as a build option, the single precision denormalized numbers may be flushed to zero and if the optional extension for double precision is supported, double precision denormalized numbers may also be flushed to zero. This is intended to be a performance hint and the OpenCL compiler can choose not to flush denorms to zero if the device supports single precision (or double precision) denormalized numbers.

This option is ignored for single precision numbers if the device does not support single precision denormalized numbers i.e. kFPDenorm bit is not set in SingleFPConfig.

This option is ignored for double precision numbers if the device does not support double precision or if it does support double precison but CL_FP_DENORM bit is not set in CL_DEVICE_DOUBLE_FP_CONFIG.

This flag only applies for scalar and vector single precision floating-point variables and computations on these floating-point variables inside a program. It does not apply to reading from or writing to image objects.


Optimization Options

These options control various sorts of optimizations. Turning on optimization flags makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and possibly the ability to debug the program.
-cl-opt-disable
This option disables all optimizations. The default is optimizations are enabled.

-cl-strict-aliasing
This option allows the compiler to assume the strictest aliasing rules.

The following options control compiler behavior regarding floating-point arithmetic. These options trade off between performance and correctness and must be specifically enabled. These options are not turned on by default since it can result in incorrect output for programs which depend on an exact implementation of IEEE 754 rules/specifications for math functions.

-cl-mad-enable
Allow a * b + c to be replaced by a mad. The mad computes a * b + c with reduced accuracy. For example, some OpenCL devices implement mad as truncate the result of a * b before adding it to c.

-cl-no-signed-zeros
Allow optimizations for floating-point arithmetic that ignore the signedness of zero. IEEE 754 arithmetic specifies the behavior of distinct +0.0 and -0.0 values, which then prohibits simplification of expressions such as x+0.0 or 0.0*x (even with -clfinite-math only). This option implies that the sign of a zero result isn't significant.

-cl-unsafe-math-optimizations
Allow optimizations for floating-point arithmetic that (a) assume that arguments and results are valid, (b) may violate IEEE 754 standard and (c) may violate the OpenCL numerical compliance requirements as defined in section 7.4 for single-precision floating-point, section 9.3.9 for double-precision floating-point, and edge case behavior in section 7.5. This option includes the -cl-no-signed-zeros and -cl-mad-enable options.

-cl-finite-math-only
Allow optimizations for floating-point arithmetic that assume that arguments and results are not NaNs or ±∞. This option may violate the OpenCL numerical compliance requirements defined in in section 7.4 for single-precision floating-point, section 9.3.9 for double-precision floating-point, and edge case behavior in section 7.5.

-cl-fast-relaxed-math
Sets the optimization options -cl-finite-math-only and -cl-unsafe-math-optimizations. This allows optimizations for floating-point arithmetic that may violate the IEEE 754 standard and the OpenCL numerical compliance requirements defined in the specification in section 7.4 for single-precision floating-point, section 9.3.9 for double-precision floating-point, and edge case behavior in section 7.5. This option causes the preprocessor macro __FAST_RELAXED_MATH__ to be defined in the OpenCL program.


Options to Request or Suppress Warnings

Warnings are diagnostic messages that report constructions which are not inherently erroneous but which are risky or suggest there may have been an error. The following languageindependent options do not enable specific warnings but control the kinds of diagnostics produced by the OpenCL compiler.
-w
Inhibit all warning messages.

-Werror
Make all warnings into errors.

Lasterror is set.

See also:

CLProgramMBS.BuildProgram(options as string = "")

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Builds (compiles and links) a program executable from the program source or binary.

See other BuildProgram method for details
Lasterror is set.

See also:

CLProgramMBS.BuildStatus(device as CLDeviceMBS) as Int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the build status of program for a specific device as given by device.

See kBuild* constants.
Lasterror is set.

CLProgramMBS.Constructor(context as CLContextMBS, devices() as CLDeviceMBS, binaries() as string, status() as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a program object for a context, and loads specified binary data into the program object.

context: Must be a valid OpenCL context.
devices: a list of devices that are in context. The binaries are loaded for devices specified in this list.

The devices associated with the program object will be the list of devices specified by devices. The list of devices specified by devices must be devices associated with context.

binaries: An array of strings containing the program binaries to be loaded for devices specified by devices. For each device given by devices(i), the string with the program binary for that device is given by binaries(i).

The program binaries specified by binaries contain the bits that describe the program executable that will be run on the device(s) associated with context. The program binary can consist of either or both of device-specific executable(s), and/or implementation-specific intermediate representation (IR) which will be converted to the device-specific executable.

sttaus: Returns whether the program binary for each device specified in devices was loaded successfully or not. It is an array of ubound -1 and is filled by the plugin.

Lasterror is set.

OpenCL allows applications to create a program object using the program source or binary and build appropriate program executables. This allows applications to determine whether they want to use the pre-built offline binary or load and compile the program source and use the executable compiled/linked online as the program executable. This can be very useful as it allows applications to load and build program executables online on its first instance for appropriate OpenCL devices in the system. These executables can now be queried and cached by the application. Future instances of the application launching will no longer need to compile and build the program executables. The cached executables can be read and loaded by the application, which can help significantly reduce the application initialization time.

See also:

CLProgramMBS.Constructor(context as CLContextMBS, line as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a program object for a context, and loads the source code specified by the line string into the program object.

context: Must be a valid OpenCL context.
line: A string with all the lines of the program.

The devices associated with the program object are the devices associated with context.

OpenCL allows applications to create a program object using the program source or binary and build appropriate program executables. This allows applications to determine whether they want to use the pre-built offline binary or load and compile the program source and use the executable compiled/linked online as the program executable. This can be very useful as it allows applications to load and build program executables online on its first instance for appropriate OpenCL devices in the system. These executables can now be queried and cached by the application. Future instances of the application launching will no longer need to compile and build the program executables. The cached executables can be read and loaded by the application, which can help significantly reduce the application initialization time.

An OpenCL program consists of a set of kernels that are identified as functions declared with the __kernel qualifier in the program source. OpenCL programs may also contain auxiliary functions and constant data that can be used by __kernel functions. The program executable can be generated online or offline by the OpenCL compiler for the appropriate target device(s).

Lasterror is set.

See also:

CLProgramMBS.Constructor(context as CLContextMBS, lines() as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a program object for a context, and loads the source code specified by the text strings in the lines array into the program object.

context: Must be a valid OpenCL context.
lines: An array of strings that make up the source code.

The devices associated with the program object are the devices associated with context.

OpenCL allows applications to create a program object using the program source or binary and build appropriate program executables. This allows applications to determine whether they want to use the pre-built offline binary or load and compile the program source and use the executable compiled/linked online as the program executable. This can be very useful as it allows applications to load and build program executables online on its first instance for appropriate OpenCL devices in the system. These executables can now be queried and cached by the application. Future instances of the application launching will no longer need to compile and build the program executables. The cached executables can be read and loaded by the application, which can help significantly reduce the application initialization time.

An OpenCL program consists of a set of kernels that are identified as functions declared with the __kernel qualifier in the program source. OpenCL programs may also contain auxiliary functions and constant data that can be used by __kernel functions. The program executable can be generated online or offline by the OpenCL compiler for the appropriate target device(s).

Lasterror is set.

See also:

CLProgramMBS.Context as CLContextMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The context for this program.

Lasterror is set.

CLProgramMBS.CreateKernelsInProgram(maxKernels as Integer = 100) as CLKernelMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates kernel objects for all kernel functions in program.

maxKernels: maximum number of kernels to return.

Kernel objects are not created for any __kernel functions in program that do not have the same function definition across all devices for which a program executable has been successfully built.

Kernel objects can only be created once you have a program object with a valid program source or binary loaded into the program object and the program executable has been successfully built for one or more devices associated with program. No changes to the program executable are allowed while there are kernel objects associated with a program object. This means that calls to BuildProgram return kInvalidOperation (in lasterror) if there are kernel objects attached to a program object. The OpenCL context associated with program will be the context associated with kernel. The list of devices associated with program are the devices associated with kernel. Devices associated with a program object for which a valid program executable has been built can be used to execute kernels declared in the program object.

Lasterror is set.

CLProgramMBS.Devices as CLDeviceMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the list of devices associated with the program object.

This can be the devices associated with context on which the program object has been created or can be a subset of devices that are specified when a progam object is created.

CLProgramMBS.NumDevices as UInt32

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the number of devices associated with program.

Lasterror is set.

CLProgramMBS.ReferenceCount as UInt32

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the program reference count.

Lasterror is set.

CLProgramMBS.Source as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the program source code specified in the Constructor.

The source string returned is a concatenation of all source strings specified to Constructor.

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


The biggest plugin in space...