首页 > 解决方案 > 库 multprocesing 是否适用于 sagemaker conda-python3?

问题描述

库 multprocesing 在 sagemaker conda-python3 上运行良好吗?

标签: python-3.xpython-multiprocessingamazon-sagemaker

解决方案


这当然取决于您想到的用例,但通常对于使用poolfrommultiprocessing它的函数的并行处理效果很好,我经常使用它。例如:

import multiprocessing as mp

pool = mp.Pool(mp.cpu_count())

# f is your function and L the list of items you want to apply f to
result = pool.map(f, L)
pool.quit()
pool.join()

推荐阅读