Is high CPU load in SM caused by my Strategy?
Author: piter99
Creation Date: 8/31/2017 3:15 PM
profile picture

piter99

#1
Hi,

I got new PC:
CPU Intel i7 4820k, 3.7 GHz, RAM 12 GB.
Running ATP and Chrome only.
2 strats running in SM load CPU 100%, freezes all aps.
4 strats may crash ATP.
All strats use one data set with 70 symbols.

All strats like:

CODE:
Please log in to see this code.


Any suggestions how to decrease PC load.
Thank you.
profile picture

Eugene

#2
Hi,

Having run this code (with GetTradingLoopStartBar... uncommented - see P.S. below) on 500-5000 bars of Nasdaq 100 1-minute data I haven't encountered striking performance issues. Even though the CPU is less powerful, with 2 instances of your strategy it was far from 100% load.

Assuming you run it in 64-bit WLP, here's a couple of suggestions:

1. ATP doesn't have any connection to WLP. Make sure it's WLP that causes the CPU load.
2. Load less bars.
3. Optimize the code, if applicable.

P.S. You wouldn't want to use this design pattern in Strategy Monitor:
CODE:
Please log in to see this code.

This makes it lose memory of created Positions. It's applicable to screeners but not to the SM.

profile picture

piter99

#3

Actually I use 50 bars to screen data set and manually enter to ATP to check setup.
How could I optimize code?
Or something else?

Thanks.
profile picture

Eugene

#4
First and foremost, switch to 64-bit Wealth-Lab Pro. Code optimization is not urgent. There is no excuse for not running 64-bit WLP on a powerful CPU with 12GB RAM. 32-bit WLP is the bottleneck.
profile picture

piter99

#5
Great,
Is it upgrade or new installation?
Should I uninstall old version and save my strats or I have create them from scratch in 64 bit version?

Thank you.
profile picture

Eugene

#6
Here's how to install WLP 6.9.18 correctly:

Wealth-Lab Pro 6.9.18 is ready

As to your Strategies, they are never affected by uninstallation, reinstallation, or upgrade.
profile picture

piter99

#7
Uninstall old WL, reboot PC.
64 bit WL installation successful.
Workspace, SM layout saved.
But 2 strats from 4 lost parameters in SM and if open strat. Picture attached.
2 strats with parameters doesn't have "Community indicators".

Any suggestions?
Thanks.
profile picture

kcbars

#8
I'm not sure what time period you're using for your strategies, but in my experience 70 symbols seems like a lot for intraday (if that's what you're doing). But regardless, I struggled with similar issues for years with nearly the identical PC, always with the 64bit version. I have an 8 core machine specifically dedicated to wealth-lab, and the only way I could get WL to stop crashing intraday was to run it using only 2 cores. Don't know why, doesn't make sense, but it doesn't go to full 100% utilization or crash this way.
profile picture

Eugene

#9
QUOTE:
2 strats with parameters doesn't have "Community indicators".

Reinstall Community Indicators and restart WLP.
profile picture

piter99

#10
Community Indicators reinstalled, all strats OK now.
CPU utilization up to 90% with 4 strats screening, freezes ATP but for shorter time.
Everything in general looks better.
Is anything I can do in order to decrease PC load?
Thank you.
profile picture

piter99

#11
I have ATP crash again during strats running in SM.
profile picture

Eugene

#12
We don't support ATP. WLP is a stanadalone application. ATP isn't connected to WLP.
profile picture

piter99

#13
My question was about WLP loading PC up to 90%.
Is anything you could suggest about decreasing PC load during SM running strats?
profile picture

kcbars

#14
I know it sounds crazy, but did you try running WL using only 2 cores? It completely solved my 100% utilization problem.
profile picture

piter99

#15
Hi developers,
Back-testing strategy (for(int bar = GetTradingLoopStartBar(11); bar < Bars.Count; bar++)), 5 min, with 117 symbols, data range 4 months increase CPU utilization only by 3-5%.
Running same strategy in SM (screening, int bar = Bars.Count - 1;), with same data and settings load CPU up to 95%.
Please suggest something.

Hi kcbars,
How can I select 2 cores on my PC? In BIOS?
Thanks
profile picture

Eugene

#16
QUOTE:
How can I select 2 cores on my PC? In BIOS?

It's easier than you think:

Assign specific processor cores for certain apps in Windows 10
profile picture

piter99

#17
Thanks,
Assigning separate cores to WLP and ATP decrease CPU load from 38 to 77%.
Even BAC (50 mln shares) was't frozen during SM screening 2 strats. But I have to do it every time I open apps.
It's great help, but didn't explain the difference between backtesting and screening in regards to CPU load.
profile picture

Eugene

#18
Amazing tip kcbars!

QUOTE:
But I have to do it every time I open apps.

Of course affinity can be set in command line (or in batch file if you prefer):

Set affinity with start /AFFINITY command on Windows 7

Right-click your WLP shortcut to modify.

QUOTE:
but didn't explain the difference between backtesting and screening in regards to CPU load.

I couldn't reproduce it using WLD so this should be WLP specific. As the difference between WLD and WLP in this aspect is the Fidelity Streaming data, this could be the explanation.

Suggestion: for testing purposes (since Google's streaming data may be delayed), create a Google intraday DataSet of the same kind and give it a try. Its operation in the Strategy Monitor doesn't depend on streaming data. If problem persists this could be a PC-specific issue, otherwise it's specific to WLP.
profile picture

piter99

#19
Here are test results:
- 2 strats running in SM every 5 min with 117 symbols with logical processors affinity. 1-4 processors assigned to ATP, 5-8 to WLP. Capture.png with Fidelity dataset. Capture1.png with Google dataset.
- Conclusion: with separate processors ATP load decreases to 50%, but WLP loaded up to 100% with any data set during SM screen running.

profile picture

Eugene

#20
Since Google behaves identically, we can scratch off the Fidelity streaming data in the SM from the list of concerns. I don't see a problem with this and have no other suggestion to share.