[PYTHON] Parallel processing with local functions

Pool uses Process because it cannot process local functions in parallel

#! /usr/local/bin/python
# -*- coding:utf-8

import multiprocessing
from time import sleep

def foo():
    def f(j,k):
        l = j + k
        print "no:%s" % i
        sleep(5 - i)
        print "unko%s" % l
    jobs = []
    for i in range(5):
        p = multiprocessing.Process(target=f,args=(i,100))
        jobs.append(p)
        p.start()
foo()


Recommended Posts

Parallel processing with local functions
Parallel processing with multiprocessing
Parallel processing with Parallel of scikit-learn
[Python] Easy parallel processing with Joblib
How to do multi-core parallel processing with python
Parallel processing with no deep meaning in Python
Image processing with MyHDL
Processing datasets with pandas (1)
Processing datasets with pandas (2)
Image processing with Python
Local server with python
SMP parallel with OpenMP
Image Processing with PIL
An introduction to Python distributed parallel processing with Ray
Curry arbitrary functions with Python ....
Image processing with Python (Part 2)
100 Language Processing with Python Knock 2015
Getting Started with Python Functions
Parallel computing with iPython notebook
Image processing with PIL (Pillow)
"Apple processing" with OpenCV3 + Python3
Acoustic signal processing with Python (2)
Blender Modal Operator parallel processing
Acoustic signal processing with Python
Image processing with Python (Part 1)
Image processing with Python (Part 3)
Pre-try local testing with Travis
Data processing tips with Pandas
[Python] Image processing with scikit-image
Avoid implementing useless functions with inheritance
Study natural language processing with Kikagaku
Real-time image processing basics with opencv
Python parallel processing (multiprocessing and Joblib)
100 Language Processing Knock with Python (Chapter 1)
[Natural language processing] Preprocessing with Japanese
Try audio signal processing with librosa-Beginner
Evaluate benchmark functions with Chaotic PSO
100 Language Processing Knock with Python (Chapter 3)
Image processing with Python 100 knocks # 3 Binarization
IPython cluster stupid (distributed parallel processing)
Path processing with takewhile and dropwhile
Free from hard-coding functions with SymPy
10 functions of "language with battery" python
Python parallel / parallel processing sample code summary
Read files in parallel with Python
Image processing with Python 100 knocks # 2 Grayscale
Arithmetic processing with Chinese numeral class
Easy parallel execution with python subprocess
Creating an exe file with Python PyInstaller: PC freezes in parallel processing
Receive a list of the results of parallel processing in Python with starmap