OpenCL not working when called twice or more

 

Hey guys!


I'm facing a weird issue. I'm using the code available here in this article to test OpenCL capacities. The first time I execute the script everything works fine, as you can see on the log. The second time, however, I get the message "OpenCL not found". What could be happening? Is there a bug in the example code?


The attached file contains the result of the example.


ps: in case anyone is wondering, GetLastError() results a 4014 error:

ERR_FUNCTION_NOT_ALLOWED


ps2: the error happens when creating the OpenCL context via CLContextCreate. I thought that storing the context in a global variable could've helped to use it in further calls to OpenCL functions, but it didn't work.

How to Install and Use OpenCL for Calculations
How to Install and Use OpenCL for Calculations
  • www.mql5.com
It has been over a year since MQL5 started providing native support for OpenCL. However not many users have seen the true value of using parallel computing in their Expert Advisors, indicators or scripts. This article serves to help you install and set up OpenCL on your computer so that you can try to use this technology in the MetaTrader 5 trading terminal.
Files:
OpenCL.png  48 kb
 
Found the actual issue (and now I'm feeling dumb). Just needed to allow the OpenCL to run on the terminal, not only in the strategy tester. The only bug here is that it executes at least once before returning the error (it should never execute in this situation).