OpenCL: internal implementation tests in MQL5 - page 20

 

The codes will be added:

ERR_OPENCL_NOT_SUPPORTED           5100    
ERR_OPENCL_INTERNAL                5101
ERR_OPENCL_INVALID_HANDLE          5102
ERR_OPENCL_CONTEXT_CREATE          5103
ERR_OPENCL_QUEUE_CREATE            5104
ERR_OPENCL_PROGRAM_CREATE          5105
ERR_OPENCL_TOO_LONG_KERNEL_NAME    5106
ERR_OPENCL_KERNEL_CREATE           5107
ERR_OPENCL_SET_KERNEL_PARAMETER    5108
ERR_OPENCL_EXECUTE                 5109
ERR_OPENCL_WRONG_BUFFER_SIZE       5110
ERR_OPENCL_WRONG_BUFFER_OFFSET     5111
ERR_OPENCL_BUFFER_CREATE           5112
 
Rosh:

The codes will be added:

Thank you, then what is missing is a function to check the handle for validity.

We only accept from CL functions the value of the pointer, not the pointer itself, so storing the pointer in different places will cause a situation of trying to remove an invalid process (be it context, buffer, program or kernel).

function required:

bool CLCheckHandle(int handle);
 
And you also need to programmatically get the memory size of the device, because widgets have less memory than the CPU's, and all the simultaneously existing contexts use the same memory.
 
Urain:
And also it is necessary to get programmatically memory size of the device, because visions have less memory than CPU's, while all simultaneously existing contexts use the same memory.

It would be good to get the card temperature (and CPU too) by standard mql means in order to dose the load.

// 'Cause I've been going on a bit of a rampage... :)

 
MetaDriver:
Does anyone read this thread at all? It's kind of like a monologue :)
 
There is no functionality in OpenCL to get temperature and GPU load.
Obtaining properties of OpenCL objects will be coming soon.
Handle checking will also be organised.
 
mql5:
1. there is no functionality in OpenCL to get GPU temperature and load.
2. fetching properties of OpenCL objects will be available soon.
3. Handle checking will also be organized.

1. i know. It doesn't have to be through OpenCL, it has to be through the system. The idea is just to make the functionality native (without DLL calls from mql5 programs).

Here are some excellent functions:

TerminalInfoInteger

Returns an integer value of a corresponding environment property of an mql5 program.

TerminalInfoString

Returns a string value of a corresponding environment property of an mql5 program

MQL5InfoInteger

Returns an integer type value of a corresponding property of a running mql5 program

MQL5InfoString

Returns a value of string type of a corresponding property of a launched mql5-program

It would be nice and logical to add:

SystemInfoInteger and therefore

SystemInfoString

which provides access to all necessary information about system environment: number of cores, name and size of operating system, amount of memory (total), amount of available (free) memory (RAM and disk space), etc., etc.

After all, the terminal doesn't work in empty eternal space. Otherwise it looks very sandy.

2, 3.

4. Be sure to implement a normal buffer access (cl_Read/WriteBuffer), specifying both start offsets (both the mql-array offset and the offset in the cl-buffer). Otherwise, almost all the arrays have to be copied twice - do we really need it? We are not writing in OpenCL to waste time rewriting from nothing into nothing. That's not fair. :)

 
MetaDriver:
...

4. make sure you already have a normal buffer access (cl_Read/WriteBuffer), specifying both starting offsets (both mql-array offset and cl-buffer offset). Otherwise, almost all the arrays have to be copied twice - do we really need it? We are not writing in OpenCL to waste time rewriting from nothing into nothing. That's not fair. :)

Clarify what you mean by that.

I haven't come across the situations you're describing so far.

 
Urain:

Specify what you mean by that.

What it's for, I haven't yet encountered the situations you describe.

No problem. Here's a recent example. Building an Ema family.

...........  
 while(limit/(cl_BufLength-1)>0)
     {
       for(int i=0;i<CountLine;i++)
         {
          dOut[i]=EmaBuffer[i].B[limit];  // переписываем начальные значения Ema
                            // в промежуточный массив, поскольку напрямую с указанного смещения 
                            // загрузить в буфер невозможно.
         }
       CLBufferWrite(cl_Mem_Out,dOut,0,CountLine*sizeof(double));  // загружаем в gpu
       for(int i=1;i<cl_BufLength;i++)
         {
          dIn[i]=price[limit-i];                 // переписываем цены
                                                // То же самое с ценами.
         }
       CLBufferWrite(cl_Mem_In,dIn);  // загружаем в gpu

       CLExecute(cl_Krn,1,kOfs,kWork);
.........
..........

Nothing exotic is required. I just want it to be like here:

int  ArrayCopy(
   void  dst_array[],       // куда копируем
   void  src_array[],       // откуда копируем
   int   dst_start=0,       // с какого индекса пишем в приемник
   int   src_start=0,       // с какого индекса копируем из источника
   int   cnt=WHOLE_ARRAY    // сколько элементов
   );

 
MetaDriver:

No problem. Here's a recent example. Building the Ema family

Nothing exotic is required, I just want it to be like here:

int  ArrayCopy(
   void  dst_array[],       // куда копируем
   void  src_array[],       // откуда копируем
   int   dst_start=0,       // с какого индекса пишем в приемник
   int   src_start=0,       // с какого индекса копируем из источника
   int   cnt=WHOLE_ARRAY    // сколько элементов
   );



Yeah, I get it, you don't want more complicated algorithms and memory overruns from using

//Выполняет OpenCL программу.
bool  CLExecute(int          kernel,                 // хендл на кернел OpenCL
                uint         work_dim,               // размерность пространства задач 
                const uint&  global_work_offset[],   // начальное смещение индексов
                const uint&  global_work_size[]     // общее количество индексов
                );

and you want to be able to offset at the copy stage.

I don't want to copy 100000 elements and then do 998000 shift. But we should leave the variant with shift that we have now, because it allows not to copy many times the same data, but to take it for a new task from an already prepared CL buffer with a new shift.

SZY it would also be nice to be able to overwrite by reallocating or overwriting part of data in CL buffer, then newly received data from tick could be added without having to buy all data. In realtime this is hardly useful, but in the tester it is.

Reason: