python-3.x - 库 multprocesing 是否适用于 sagemaker conda-python3?
问题描述
库 multprocesing 在 sagemaker conda-python3 上运行良好吗?
解决方案
这当然取决于您想到的用例,但通常对于使用pool
frommultiprocessing
它的函数的并行处理效果很好,我经常使用它。例如:
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()
推荐阅读
- postman - 在 Postman 中断言数组中的元素
- azure - 如何配置两个前端应用在 Azure 应用服务上并行运行
- nagios - Nagios - 外部命令错误:命令失败
- javascript - 可以用 jquery 加入两个选择器吗?
- jquery - 将类添加到父 div,其中包含带有值的输入复选框
- angular - 将 Angular PWA 部署到 GitHub 页面时,CSS 位置未按预期工作
- android - 对话框没有关闭
- google-cloud-platform - 如何在 Airflow 中使用电子邮件运算符附加文件
- python - Tensorflow 对象检测:将大型输入图像裁剪成图块
- spring-boot - 在 Spring Boot 应用程序中添加 spring-boot-starter-data-redis 后启动 Tomcat 上下文时出错