<jupyter_start><jupyter_text>multiprocessing<jupyter_code>import sys
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import multiprocessing

#import inference
# setting parameter:
np.random.seed(1)
nPC = 2
print("There are %d CPUs available on this machine" % multiprocessing.cpu_count())
print("You are using %d CPU(s)" % nPC)
def test_MPC(i):
    print(i,i+10)
    return i+10
n = 6

pool = multiprocessing.Pool(processes=nPC)
#res = pool.map(test_MPC,list(range(n)))
pool.map(test_MPC,list(range(n)))
pool.close()

#W=np.array([r[0] for r in res])
#cost=np.array([r[1] for r in res])
#H0=np.array([r[2] for r in res])
#print(res)
#print(type(res))
#start_time = timeit.default_timer()
#stop_time=timeit.default_timer()
#run_time=stop_time-start_time
#print('run_time:', run_time)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15227817745803357, 'fraction_numerical': 0.013189448441247002, 'mean_word_length': 6.9523809523809526, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '203894', 'license': 'MIT', 'n_tokens_mistral': 343, 'n_tokens_neox': 337, 'n_words': 72, 'path': 'old_versions/2018.11.05_compare_additive_multiplicative/multiprocessing.ipynb', 'repo_name': 'danhtaihoang/categorical-variables', 'size': '834'}