Ask Your Question

Revision history [back]

The @parallel decorator is based on the multiprocessing Python library. It is nothing advanced and only allows you to perform embarassingly parallel computations (ie no dependence between each individual computation).

If you want more advanced parallelization, a flow chart is not enough as it does not take into account the cost of a given computation. Let us imagine that you have 2 processors for the following tasks

  • A1, A2, A3 that takes respectively 1min, 1min, 3min
  • B that takes 1min and depends on A1, A2, A3

Then, doing it blindly you will start the computation with A1, A2 simultaneously. They will roughly finish at the same time and then A3 will run alone for 3 min.

Even with the assumption that you can give a rough approximation of the time of each task, the scheduling problem is algorithmically non-trivial (ie unlikely to be solved on large instances). I don't know of any Python implementation of something in that direction.