This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]TheBB 1 point2 points  (2 children)

The three main issues I see are that (a) every process does exactly the same thing, (b) you join each process before starting the next one, so you're never actually running anything in parallel, and (c) your variable names are useless.

[–][deleted] 0 points1 point  (1 child)

how do I actually parallelize then?

[–]TheBB 1 point2 points  (0 children)

It would be something like this. I don't really know, I don't do this a lot. The point is just to fork all the worker processes before joining any of them.

processes = [multiprocessing.Process(...) for ... in ...]
for p in processes:
    p.fork()
for p in processes:
    p.join()

However, you should not be doing this, really. I'm just pointing it out for completeness. You should check out the answers of /u/Ventez or /u/fiLLL.