def calc_kernel(samp):
    return kernel(samp)
cores = 4
torun = np.array_split(sample, cores, axis=1)
pool = Pool(processes=cores)
results = pool.map(calc_kernel, torun)
insample_mp = np.concatenate(results) < iso
print('multiprocessing filter/sample: ', time.time() - tik)
Speed up sampling of kernel estimate