OpenCL: internal implementation tests in MQL5 - page 52

 
joo:
I take it that if we want to pass a two-dimensional/multidimensional array with data to the GPU, we can use the data representation as a structure and pass the structure?

I tried it through a structure - it worked! I never would have guessed to pass multidimensional arrays this way myself :) Thanks!

I have attached small example, using two-dimensional arrays - it works just fine. The example is a little crooked - but in general it demonstrates the possibility of such a perversion quite well :)

PS: Your UGA + OpenCL - it's just no emotions :) How we used to live - it's creepy to remember...

Документация по MQL5: Основы языка / Переменные
Документация по MQL5: Основы языка / Переменные
  • www.mql5.com
Основы языка / Переменные - Документация по MQL5
Files:
 
MigVRN:

PS: Your UGA + OpenCL is just no emotion at all. :) How we used to live is eerie to remember...

Thank you, I'm glad you like it. And taking the opportunity, I would like to say Hi and many thanks to Ilyas Sharapov(mql5).
 

CL_DEVICE_ANY and CL_DEVICE_GPU obsolete?

Are CL_USE_ANY and CL_USE_GPU_ONLY relevant now?

 
joo:

CL_DEVICE_ANY and CL_DEVICE_GPU obsolete?

Are CL_USE_ANY and CL_USE_GPU_ONLY relevant now?

Yes.
 
MetaDriver:
Yes.

Discovered by Prof. Tychkov's method a mysterious device 1 in my computer, which is faster than CL_USE_ANY and even faster than CL_USE_GPU_ONLY.

What is it? :O

 
joo:

Found a mysterious device 1 in my computer, using Professor Tychkov's method, that runs faster than CL_USE_ANY and even faster than CL_USE_GPU_ONLY.

What is it? :O

Stats, please. For all devices. :)
 
MetaDriver:
Stats on the board. For all devices. :)
CL_USE_ANY

2012.04.12 23:27:29 Struct_OpenCL (GBPUSD,H1) Difference in calculation between GPY and CPY: 0.0
2012.04.12 23:27:28 Struct_OpenCL (GBPUSD,H1) CPY/GPU= 1.326
2012.04.12 23:27:28 Struct_OpenCL (GBPUSD,H1) GPU time = 141 ms

2012.04.12 23:27:28 Struct_OpenCL (GBPUSD,H1) SPU time = 187 ms


CL_USE_GPU_ONLY

2012.04.12 23:29:11 Struct_OpenCL (GBPUSD,H1) Difference in calculation between GPY and CPY: 0.0
2012.04.12 23:29:11 Struct_OpenCL (GBPUSD,H1) CPY/GPU= 1.376
2012.04.12 23:29:11 Struct_OpenCL (GBPUSD,H1) GPU time = 125 ms

2012.04.12 23:29:11 Struct_OpenCL (GBPUSD,H1) SPU Time = 172 ms


1

2012.04.12 23:30:12 Struct_OpenCL (GBPUSD,H1) Difference in calculation between GPY and CPY: 0.0
2012.04.12 23:30:12 Struct_OpenCL (GBPUSD,H1) CPY/GPU= 2.397
2012.04.12 23:30:12 Struct_OpenCL (GBPUSD,H1) GPU time = 78 ms

2012.04.12 23:30:12 Struct_OpenCL (GBPUSD,H1) SPU Time = 187 ms


I recommend everyone to try the same way as I did, it is quite possible that you will find a faster device than the helpless discrete graphics. :D


PS. I suspect that CL_USE_ANY and CL_USE_GPU_ONLY are the same - calculation on CPU, but device 1 is my GPU. It's an elementary confusion in the standard constants.

 
joo:

I recommend everyone to mess around with it like I did, you'll probably find a faster device than the useless discrete graphics. :D

PS. I suspect that CL_USE_ANY and CL_USE_GPU_ONLY are the same thing - it's a CPU calculation, but device 1 is my GPU. It's an elementary confusion in the standard constants.

Here's what I read! It wasn't in the terminal's help! Tweaked the code to reflect these changes. See what you get. I've got it like this:

23:17:00 SPU time = 1155 ms
23:17:01 Total OpenCL enabled devices: 2
23:17:02 GPU Time #0 = 249 ms
23:17:02 CPY/GPU #0 = 4.639
23:17:03 GPU #1 Time = 265 ms
23:17:03 CPY/GPU #1= 4.358

GPU: Advanced Micro Devices, Inc. Turks with OpenCL 1.1 (6 units, 725 MHz, 1024 Mb, version CAL 1.4.1703 (VM))
CPU: GenuineIntel Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz with OpenCL 1.1 (4 units, 2095 MHz, 5990 Mb, version 2.0)
Files:
 
2012.04.12 22:37:07     OpenCL  GPU: NVIDIA Corporation GeForce GT 440 with OpenCL 1.1 (2 units, 1660 MHz, 1024 Mb, version 296.10)
2012.04.12 22:37:07     OpenCL  CPU: AuthenticAMD AMD Athlon(tm) II X4 630 Processor with OpenCL 1.1 (4 units, 2998 MHz, 2048 Mb, version 2.0)
2012.04.12 22:39:46     Struct_OpenCL__1 (EURUSD,H1)    Время СPU = 686 ms
2012.04.12 22:39:47     Struct_OpenCL__1 (EURUSD,H1)    Всего устройств c возможностями OpenCL: 2
2012.04.12 22:39:50     Struct_OpenCL__1 (EURUSD,H1)    Время GPU №0 = 172 ms
2012.04.12 22:39:50     Struct_OpenCL__1 (EURUSD,H1)    CPY/GPU №0= 3.988
2012.04.12 22:39:51     Struct_OpenCL__1 (EURUSD,H1)    Время GPU №1 = 406 ms
2012.04.12 22:39:51     Struct_OpenCL__1 (EURUSD,H1)    CPY/GPU №1= 1.690
 
MigVRN:

Try using this structure, it didn't work for me (I suspect the second dimension has to be a fixed size, that's why it didn't work for me):

struct Array2dFloat
{
  float Column[];
  int LineCount(int lineCount)
  {
    int size = ArrayResize(Column,lineCount);
    ArrayInitialize(Column,0.0);
    return(size);
  }
};

And, for convenience, a function like this to resize both dimensions:

void ArrayResize2DArrayFloat(Array2dFloat &ArrayOfArray[], int columnCount,int lineCount)
{
  // разбивка по вертикали
  ArrayResize(ArrayOfArray,columnCount);
  // разбивка по горизонтали
  for(int i=0;i<columnCount;i++)
    ArrayOfArray[i].LineCount(lineCount);
}