Search
 
SCRIPT & CODE EXAMPLE
 

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())
Comment

PREVIOUS NEXT
Code Example
Python :: python tkinter button dynamic button command 
Python :: how to use django-rest-framework-datatables 
Python :: python default keyword parameter list 
Python :: Local to ISO 8601: 
Python :: hide tkinter window 
Python :: edit models in django admin 
Python :: create gui python 
Python :: python factor number 
Python :: how to union value without the same value in numpy 
Python :: merge 2 dataframes in python 
Python :: how to strip whitespace in python 
Python :: text classification 
Python :: python how to extract a string from another string 
Python :: check if string match regex python 
Python :: pygame bg color 
Python :: python sort descending 
Python :: how to make a timer using python 
Python :: check audio playing on windows python 
Python :: dictionary changed size during iteration 
Python :: defaultdict python 
Python :: string list to list 
Python :: draw picture in python libraries 
Python :: list of lists to table python 
Python :: include in flask 
Python :: python printing hello world 
Python :: tkinter tutorial 
Python :: python for data analysis 
Python :: cholesky decomposition in python 
Python :: python not in list 
Python :: Iterating Through Dictionaries with For Loops 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =