Download MetaTrader 5
MQL5 ReferenceWorking with OpenCL 

Working with OpenCL

OpenCL programs are used for performing computations on video cards that support OpenCL 1.1 or higher. Modern video cards contain hundreds of small specialized processors that can simultaneously perform simple mathematical operations with incoming data streams. The OpenCL language organizes parallel computing and provides greater speed for a certain class of tasks.

In some graphic cards working with the double type numbers is disabled by default. This can lead to compilation error 5105. To enable support for the double type numbers, please add the following directive to your OpenCL program: #pragma OPENCL EXTENSION cl_khr_fp64 : enable. However if a graphic card doesn't support double, enabling this directive won't be of help.

Functions for running programs in OpenCL:

Function

Action

CLHandleType

Returns the type of an OpenCL handle as a value of the ENUM_OPENCL_HANDLE_TYPE enumeration

CLGetInfoInteger

Returns the value of an integer property for an OpenCL object or device

CLContextCreate

Creates an OpenCL context

CLContextFree

Removes an OpenCL context

CLGetDeviceInfo

Receives device property from OpenCL driver

CLProgramCreate

Creates an OpenCL program from a source code

CLProgramFree

Removes an OpenCL program

CLKernelCreate

Creates an OpenCL start function

CLKernelFree

Removes an OpenCL start function

CLSetKernelArg

Sets a parameter for the OpenCL function

CLSetKernelArgMem

Sets an OpenCL buffer as a parameter of the OpenCL function

CLBufferCreate

Creates an OpenCL buffer

CLBufferFree

Deletes an OpenCL buffer

CLBufferWrite

Writes an array into an OpenCL buffer

CLBufferRead

Reads an OpenCL buffer into an array

CLExecute

Runs an OpenCL program


Updated: 2015.12.03