Here's what you can do with OpenCL directly in MetaTrader 5 without any DLLs

 

This is a demonstration not only of GPU calculations in the MQL5 code, but also of the graphical capabilities of the terminal:

The full source code as a script is attached. The bug on OpenCL 1.2 has been fixed.

Files:
Seascape.mq5  39 kb
 
Renat Fatkhullin:

This is a demonstration not only of GPU calculations in the MQL5 code, but also of the graphical capabilities of the terminal:

Full source code as a script is attached.

Aaaaaaaaahhhhhhhh ... Stop me getting off !
 

We are preparing an OpenCL staff library for maths and rendering, which will take a few weeks. It's going to be amazingly fast and beautiful.

In the meantime, take a look at the updated graphics library for rendering science graphs.

 

О! Soon it will come to games ))))

What for in a trading platform? Well, the calculations are understandable, and all sorts of beautiful things only seduce.

 
Vitalie Postolache:

О! Soon it will come to games ))))

What for in a trading platform? Well, the calculations are clear, and all sorts of beautiful things only seduce.

With OpenCL you can use thousands of GPU cores to speed up mathematical calculations a hundred (several hundred) times.

This is exactly what is needed in trading and what will allow to move to the use of techniques that require orders of magnitude more calculation resources.

In MQL4 you dig with a shovel, while in MQL5 with OpenCL you get a tractor in terms of performance. To bring GPU calculations to the masses, we are preparing new math libraries in addition to the existing ones.

 

Couldn't get past it, passed it by

 
Renat Fatkhullin:

This is a demonstration not only of GPU calculations in the MQL5 code, but also of the graphical capabilities of the terminal:

The full source code as a script is attached.

Compiled it, ran it.

Does not work.

MT5 build 1491.

W7 prof SP1 eng 64-bit


 
prostotrader:

Compiled it, launched it.

Look at the logs of the terminal and expert window.

The script is complex, just written and not yet debugged. It doesn't run everywhere without GPU.

 
Renat Fatkhullin:

Look at the terminal logs and the expert window.

The script is complex, just written and not yet debugged. It doesn't run everywhere without GPU.

2016.12.10 03:57:08.180 Seascape (GOLD-12.16,H1)        OpenCL: GPU device 'GeForce GTX 970' selected
2016.12.10 03:57:08.197 Seascape (GOLD-12.16,H1)        <kernel>:188:18: error: subscripted access is not allowed for OpenCL vectors
2016.12.10 03:57:08.197 Seascape (GOLD-12.16,H1)           uint b=(uint)(res[2]*255);
2016.12.10 03:57:08.197 Seascape (GOLD-12.16,H1)                         ^   ~
2016.12.10 03:57:08.197 Seascape (GOLD-12.16,H1)        <kernel>:189:18: error: subscripted access is not allowed for OpenCL vectors
2016.12.10 03:57:08.197 Seascape (GOLD-12.16,H1)           uint g=(uint)(res[1]*255);
2016.12.10 03:57:08.197 Seascape (GOLD-12.16,H1)                         ^   ~
2016.12.10 03:57:08.197 Seascape (GOLD-12.16,H1)        <kernel>:190:18: error: subscripted access is not allowed for OpenCL vectors
2016.12.10 03:57:08.197 Seascape (GOLD-12.16,H1)           uint r=(uint)(res[0]*255);
2016.12.10 03:57:08.197 Seascape (GOLD-12.16,H1)                         ^   ~
2016.12.10 03:57:08.197 Seascape (GOLD-12.16,H1)        
2016.12.10 03:57:08.218 Seascape (GOLD-12.16,H1)        OpenCL program create failed
2016.12.10 03:57:36.695 Seascape (GOLD-12.16,H1)        OpenCL: GPU device 'GeForce GTX 970' selected
2016.12.10 03:57:36.711 Seascape (GOLD-12.16,H1)        <kernel>:188:18: error: subscripted access is not allowed for OpenCL vectors
2016.12.10 03:57:36.711 Seascape (GOLD-12.16,H1)           uint b=(uint)(res[2]*255);
2016.12.10 03:57:36.711 Seascape (GOLD-12.16,H1)                         ^   ~
2016.12.10 03:57:36.711 Seascape (GOLD-12.16,H1)        <kernel>:189:18: error: subscripted access is not allowed for OpenCL vectors
2016.12.10 03:57:36.711 Seascape (GOLD-12.16,H1)           uint g=(uint)(res[1]*255);
2016.12.10 03:57:36.711 Seascape (GOLD-12.16,H1)                         ^   ~
2016.12.10 03:57:36.711 Seascape (GOLD-12.16,H1)        <kernel>:190:18: error: subscripted access is not allowed for OpenCL vectors
2016.12.10 03:57:36.711 Seascape (GOLD-12.16,H1)           uint r=(uint)(res[0]*255);
2016.12.10 03:57:36.711 Seascape (GOLD-12.16,H1)                         ^   ~
2016.12.10 03:57:36.711 Seascape (GOLD-12.16,H1)        
2016.12.10 03:57:36.730 Seascape (GOLD-12.16,H1)        OpenCL program create failed

2016.12.10 03:57:06.729 OpenCL  Device #0: GPU NVIDIA Corporation GeForce GTX 970 with OpenCL 1.2 (13 units, 1367 MHz, 4096 Mb, version 372.90)
 

OK, we'll figure it out. The code was like a test of a pen.

Each GPU device has its own compiler and it decides what to skip. Intel, AMD and Nvidia OpenCL compilers are different.

We are testing under OpenCL 2.0 which has a much greater functionality. We will check and fix this test on OpenCL 1.2.