How to distribute calculations over multiple cores? - page 2

 
Fernando Carreiro #:
Because MetaTrader is multi-threaded and the operating system will divide up the threads of all applications amongst the CPU's and the threads get switched in an out and not necessarily always on the same CPU.

So i'm forcing a spill over to other cores essentially because of mt5 handling the load well

 
Lorentzos Roussos #: So i'm forcing a spill over to other cores essentially because of mt5 handling the load well

On MT4 however, I don't think it will distribute so well. You will have to test and see.

 

oh my code is wrong . i disabled the "busy gate" and this happened :


 
Fernando Carreiro #:

On MT4 however, I don't think it will distribute so well. You will have to test and see.

yeah i mean because it wont multi thread , i want to compare speeds essentially because thats the bottom line 

 
Lorentzos Roussos #: oh my code is wrong . i disabled the "busy gate" and this happened :

That is because the "busy" flag would cause a pause between processing each subsequent event, allowing the operating system to switch out the thread.

However, when you remove the "busy" flag, the event processing becomes contagious without a pause in between event handling and the operating system no longer switches it out and gives it priority to continue processing on the same physical thread.

 
Fernando Carreiro #:

That is because the "busy" flag would cause a pause between processing each subsequent event, allowing the operating system to switch out the thread.

However, when you remove it, the event processing becomes contagious without a pause in between event handling and the operating system no longer switches it out and gives it priority to continue processing on the same physical thread.

I see , so the bottom line would be the same , it would not take significantly less time and i'm seeing the average use not the concurrent .

 
Lorentzos Roussos #: I see , so the bottom line would be the same , it would not take significantly less time and i'm seeing the average use not the concurrent .

It is actually slightly faster if it continually uses the same physical thread, because switching in and out of different CPU's would actually be slightly slowed, but it would be negligible.

 
Fernando Carreiro #:

It is actually slightly faster if it continually uses the same physical thread, because switching in and out of different CPU's would actually be slightly slowed, but it would be negligible.

i see . and the gain of openCl is the route is mem->cpu->mem->cpu while with a custom solution it'd be hdd->mem->cpu->mem->hdd->mem...etc

And there's also cpus that support openCL then 

  int devices_=CLGetInfoInteger(0,CL_DEVICE_COUNT);
  Print("OpenCL.Devices #("+devices_+")");
  for(int i=0;i<devices_;i++){
     Print("Device#"+(i+1)+" : "+EnumToString((ENUM_CL_DEVICE_TYPE)CLGetInfoInteger(i,CL_DEVICE_TYPE)));
     }
 
Lorentzos Roussos #: i see . and the gain of openCl is the route is mem->cpu->mem->cpu while with a custom solution it'd be hdd->mem->cpu->mem->hdd->mem...etc And there's also cpus that support openCL then 

I have no experience with using OpenCL with MetaTrader, so I don't know what performance gain you would get.
 
Fernando Carreiro #:
I have no experience with using OpenCL with MetaTrader, so I don't know what performance gain you would get.

have you installed anything other than the tester agent to get your cpu listed in the open cl devices ?