Whats a simple code that does parallel processing in python 2.7? All the examples Ive found online are convoluted and include unnecessary codes.
how would i do a simple brute force integer factoring program where I can factor 1 integer on each core (4)? my real program probably only needs 2 cores, and need to share information.
I know that parallel-python and other libraries exist, but i want to keep the number of libraries used to a minimum, thus I want to use the thread and/or multiprocessing libraries, since they come with python
A good simple way to start with parallel processing in python is just the pool mapping in mutiprocessing — its like the usual python maps but individual function calls are spread out over the different number of processes.
Factoring is a nice example of this – you can brute-force check all the divisions spreading out over all available tasks:
This gives me