Discussion of article "How to Install and Use OpenCL for Calculations" - page 3

 

Can anyone have an update to include RX 580 / 570?

I have both cards, but don't have the cookbook for detailed instruction to leverage those cards.

Much appreciate it.

 
Currently I try to get OpenCL running on a GTX1070, but Metatrader doesn't mention the hardware nor I can activate it somewhere. How should it look like with the current MT5?
 
hao xue:

Can anyone have an update to include RX 580 / 570?

I have both cards, but don't have the cookbook for detailed instruction to leverage those cards.

Much appreciate it.

I don't know why terminal doesn't recognize the rx580, but opencl is working. You can try this code:

void OnStart()
  {
//---
   Print("TERMINAL_OPENCL_SUPPORT = ",TerminalInfoInteger(TERMINAL_OPENCL_SUPPORT));
   
   int cl_ctx; 
//--- initialize OpenCL context 
   if((cl_ctx=CLContextCreate(CL_USE_GPU_ONLY))==INVALID_HANDLE) 
     { 
      Print("OpenCL not found"); 
      return; 
     } 
//--- Display general information about OpenCL device 
   Print("OpenCL type: ",EnumToString((ENUM_CL_DEVICE_TYPE)CLGetInfoInteger(cl_ctx,CL_DEVICE_TYPE))); 
   Print("OpenCL vendor ID: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_VENDOR_ID)); 
   Print("OpenCL units: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_MAX_COMPUTE_UNITS)); 
   Print("OpenCL freq: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_MAX_CLOCK_FREQUENCY)," MHz"); 
   Print("OpenCL global mem: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_GLOBAL_MEM_SIZE)," bytes"); 
   Print("OpenCL local mem: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_LOCAL_MEM_SIZE)," bytes"); 

  }
 

Hello All


I've tryed the code on lensflare on a computer with an AMD 530 and another with an NVIDEA gtx 1060 but without success. My EA report a 0 device supported. Did someone have the same problem? Thanks!


void OnStart()
  {
//---
   Print("TERMINAL_OPENCL_SUPPORT = ",TerminalInfoInteger(TERMINAL_OPENCL_SUPPORT));
   
   int cl_ctx; 
//--- initialize OpenCL context 
   if((cl_ctx=CLContextCreate(CL_USE_GPU_ONLY))==INVALID_HANDLE) 
     { 
      Print("OpenCL not found"); 
      return; 
     } 
//--- Display general information about OpenCL device 
   Print("OpenCL type: ",EnumToString((ENUM_CL_DEVICE_TYPE)CLGetInfoInteger(cl_ctx,CL_DEVICE_TYPE))); 
   Print("OpenCL vendor ID: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_VENDOR_ID)); 
   Print("OpenCL units: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_MAX_COMPUTE_UNITS)); 
   Print("OpenCL freq: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_MAX_CLOCK_FREQUENCY)," MHz"); 
   Print("OpenCL global mem: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_GLOBAL_MEM_SIZE)," bytes"); 
   Print("OpenCL local mem: ",CLGetInfoInteger(cl_ctx,CL_DEVICE_LOCAL_MEM_SIZE)," bytes"); 

  }
 

How can I select which openCL processor to use?
It seem that I have CPU + Nvidia +Intel, and according to main page, that the Intel GPU is faster.

Also, because my Nvidia run a little, and then crashes when I try to exit the EA.

 

Hello all,

Can someone provide documentation on how to implement OpenCL on an EA ?

I made one too slow for optimization but OpenCL with my GTX2080 would help... Like a lot I guess !

 
EAML #:

How can I select which openCL processor to use?
It seem that I have CPU + Nvidia +Intel, and according to main page, that the Intel GPU is faster.

Also, because my Nvidia run a little, and then crashes when I try to exit the EA.

Apology for revive the thread.

For your case, you can try 

CL_USE_ANY

or 

CL_USE_CPU_ONLY

feeding into CLContextCreate function.

hao xue #:

Can anyone have an update to include RX 580 / 570?

I have both cards, but don't have the cookbook for detailed instruction to leverage those cards.

Much appreciate it.

I'm also using AMD RX 570. I can only use CPU based OpenCL. It cannot find any device for GPU.
With some of OpenCL example codes, it ran bad. I also desire to let it connected with GPU.
Anyway, I run through wine on Ubuntu.

 

I found the solution to make

CLContextCreate()

be able to create a context from GPU device.

As seen on its API document, instead of using CL_USE_GPU_ONLY, or CL_USE_GPU_DOUBLE_ONLY, use an ordinal number that is your desire GPU device e.g. CLContextCreate(0).

To determine which ordinal number is your GPU device, look into Journal tab.

Anyway, this is still considered as a bug still as we cannot use those flag to automatically find the right device for us. If we may, report the bug here.
Tested on build 3555.

Documentation on MQL5: Working with OpenCL / CLContextCreate
Documentation on MQL5: Working with OpenCL / CLContextCreate
  • www.mql5.com
CLContextCreate - Working with OpenCL - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: