1) I have a 64 core machine. Why doesn’t my optimization use all 64 cores?
Unfortunately distributed processing isn’t always as simple as add more cores and things always run faster.
NeuroShell Trader does not distribute processing such that every single calculation or line of computer code is distributed. Instead NeuroShell Trader simply distributes the backtesting of each parameter combination (i.e. genetic individual). Furthermore, the genetic optimizer isn’t looking at every single parameter combination possible each pass, but instead it looks at around 40 to 100 combinations per generation depending upon the complexity of the parameter space. So taken to an extreme, distributing 100 generations across 1,000 core machine, wouldn’t be any faster than distributing it across a 100 core machine.
Keep in mind that to distribute processing of the backtesting of each parameter combination, there is a lot more going on behind the scenes beyond just the calculations. The historical data has to be setup and shared with each distributed processor, the results have to be sent back to the optimization “server” and the optimization “server” has to then compile all those results and issue new parameter sets after each genetic optimization pass. If the setup, initialization and passing back of results is not trivial compared to the actual backtest calculation time, then adding more processors could slow things down more than speed things up.
It is entirely possible that for some problems due to the overhead of setting up, sending data and retrieving results, distributing 1 parameter set each to 64 processors will be slower than distributing 2 parameter sets each to 32 processors.
NeuroShell Trader takes all the setup, communication and backtesting time factors into account and performs load balancing between processors in order to determine an optimal number of processors to utilize. As a result, the actual number of processors utilized can be less than the number of processors/cores than are actually available.
2) It looks like initialization at the start of optimization takes longer the more cores you have.
Yes. The optimization process is essentially the server sending out the processor initialization (data, parameter sets, indicator specifications, etc.) to each processor, then waiting around until all the processors have reported their results. In an extreme case where the initialization process takes as much time as the actual backtesting of results by each processor, then the processors that are initialized first will be finished backtesting before the later processors are even initialized. The net result of this extreme would be that optimization time can be expressed roughly as (# Processors) * (Intialization Time). In that case, it is better to have less processors rather than more (up until the point at which the reduction of processors causes the total backtest time for each processor to be more than initialization due splitting up the number of backtests across fewer and fewer processors).
NeuroShell does take all these factors into account and does do rough load balancing between processors of the workload for each processor based upon how long it takes to be initialized and calculate backtests, but load balancing is simply trying to make things better and isn’t a perfect solution.
3) Will an optimization done over 64 cores be a different optimization than one done over 1 core?
No, an optimization with no distributed optimization, should see the same things as distributed optimization across 4, 10, 100 or 1,000 cores. Not distributing the optimization (i.e. 1 core) is the exact same optimization process, it just takes longer.
4) Can I force NeuroShell Trader to utilize more cores/processors?
Yes. There is an nstparam.ini file setting (as of version 6.5 Beta 4) called MaxNumberOfProcessors that is by default set to MaxNumberOfProcessors=0. If you change this setting in the nstparam.ini file to anything other than 0, then NST will use that setting instead of its calculated number of logical processors. So if you set it to “MaxNumberOfProcessors=72” and then rerun NST and then go to the Tools->Options->Distributed Processing you can verify that the new setting by seeing if it now says X out of 72 available cores/hyperthreads and you can now set X to be up to 72.
When you set the .ini file MaxNumberOfProcessors and artificially increase the number of cores in Tools->Options->Distributed Processing , you are forcing it to use that many cores whether NeuroShell Trader thinks it should be using that many cores or not. In some cases you may see X cores utilized at 100% utilization and the remaining cores at 0% or 1% utilization. In that case, the optimization problem probably only really needed X cores, but since you told it to use more cores, NST launched extra cores and ended up not utilizing them.
Note that this setting only applies to the NST Server computer when using Network versions of NST and will not work on client computers across the network.