@@ -405,6 +405,7 @@ by providing a single objective and a single list of constraints, and specifying
405
405
the ``planning_horizon `` argument to, for example, 2. This simply copies the terms
406
406
for each step of planning horizon.
407
407
408
+ .. _disk-access :
408
409
409
410
Disk Access
410
411
-----------
@@ -485,6 +486,34 @@ internet access. If you run the test suite (by ``python -m cvxportfolio.tests``)
485
486
on a computer without internet access you should see a few tests, mostly
486
487
in the ``test_data.py `` module, failing, but most of the test suite will run.
487
488
489
+ Parallel back-testing
490
+ ---------------------
491
+
492
+ You can run multiple back-tests in parallel wit the :meth: `MarketSimulator.backtest_many `
493
+ method. It takes a list of policies and returns the corresponding list of
494
+ :class: `cvxportfolio.result.BacktestResult `. Also
495
+ :meth: `MarketSimulator.optimize_hyperparameters ` uses the same approach,
496
+ to search over the space of hyper-parameters efficiently.
497
+
498
+ .. note ::
499
+
500
+ It is not recommended to run multiple Cvxportfolio programs at the same time,
501
+ unless you are careful to not :ref: `access on-disk storage <disk-access >`. If
502
+ you want to run many back-tests at the same time, you should run a single program
503
+ with :meth: `MarketSimulator.backtest_many `.
504
+
505
+ .. note ::
506
+
507
+ If your Cvxportfolio program uses custom objects, for example
508
+ :doc: `a forecaster <examples/user_provided_forecasters >`,
509
+ and in that you call complex third party libraries, like machine-learning
510
+ ones, parallel back-testing can be problematic. You should in those cases
511
+ make sure to :ref: `initialize and finalize <execution-model >` all resources you use.
512
+ Cvxportfolio supports the ``multiprocess `` `parallel execution library
513
+ <https://multiprocess.readthedocs.io/en/latest/> `_, which may help in such
514
+ cases. Simply install ``multiprocess `` in the Python environment to make
515
+ Cvxportfolio use it.
516
+
488
517
489
518
CVXPY
490
519
-----
@@ -556,6 +585,8 @@ parallel back-tests, ....
556
585
In the next section we explain how Cvxportfolio policy objects work,
557
586
which is useful to know when extending them.
558
587
588
+ .. _execution-model :
589
+
559
590
Policy execution model
560
591
----------------------
561
592
0 commit comments