//+------------------------------------------------------------------+ //| Tester-512_Test_001.mq5 | //| Copyright 2012, MetaDriver | //| MetaDriver@rambler.ru | //+------------------------------------------------------------------+ #property copyright "Copyright 2012, MetaDriver" #property link "MetaDriver@rambler.ru" #property version "1.00" #define CountInd 16 #define CountBars 144000 #define CountPass 1280 float NETs[CountPass][CountInd]; float Inds[CountBars][CountInd]; float Result[CountPass]; float Price[CountBars]; int cl_Ctx=INVALID_HANDLE; int cl_Prg=INVALID_HANDLE; int cl_Krn=INVALID_HANDLE; int cl_Mem_NET=INVALID_HANDLE; int cl_Mem_Inds=INVALID_HANDLE; int cl_Mem_Price=INVALID_HANDLE; int cl_Mem_Result=INVALID_HANDLE; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { if(CountInd!=8 && CountInd!=16) { Alert("Error : CountInd mast be == 8 or == 16 only !"); return; } WriteCL_Program(); InitData(); long GpuTime, CpuTime; if(!GpuInit()) return; else Print("OpenCL init OK!"); long st=GetTickCount(); gpuCalculate(); Print("GPU time = ",GpuTime=GetTickCount()-st," ms"); GpuDeinit(); OutResult("Gpu"); st=GetTickCount(); cpuCalculate(); Print("CPU time = ",CpuTime=GetTickCount()-st," ms"); OutResult("Cpu"); Print("CpuTime/GpuTime = ",CpuTime*1./GpuTime); } //+------------------------------------------------------------------+ void InitData() { srand(GetTickCount()); Price[1]=float(rand()*1.0/3276700.0+1.5); for(int i=1;i