Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to change the number of cores #402

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

mikeejazmines
Copy link
Collaborator

resolves #370

Description

There is a feature in backtrader wherein you are able to change the max number of CPUs used to utilize multiprocessing. This has been included as a configurable option in the fastquant backtest wrapper. By default, it will be set to 1. Set it to None to utilize all available cores.

Documentation:
https://www.backtrader.com/blog/posts/2015-07-23-multicore-optimization/multicore-optimization/
https://github.com/mementum/backtrader/blob/0fa63ef4a35dc53cc7320813f8b15480c8f85517/backtrader/cerebro.py#L80

Checklist

  • I am making a pull request from a branch other than master
  • I have read the CONTRIBUTING.md

@mikeejazmines
Copy link
Collaborator Author

Testing this there is an issue of Can't pickle local object 'initalize_data.<locals>.CustomData'

This was brought up already in this thread https://community.backtrader.com/topic/2919/error-in-multi-core-optimization
however i havent found a solution for this

@mikeejazmines
Copy link
Collaborator Author

This would not work given the current usage of multiprocessing. This does not allow the serialization of lambda, and needs to use dill for pickling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Add multiprocessing support to backtest
1 participant