Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

multiprocessing in jupyter notebook

import multiprocessing

def double(a):
    return a * 2

def driver_func():
    PROCESSES = 4
    with multiprocessing.Pool(PROCESSES) as pool:
        params = [(1, ), (2, ), (3, ), (4, )]
        results = [pool.apply_async(double, p) for p in params]

        for r in results:
            print('	', r.get())
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #multiprocessing #jupyter #notebook
ADD COMMENT
Topic
Name
7+4 =