python - Tensorflow Multiple processes with less GPUs Model inference
问题描述
I have 2 GPUs and 3 deep learning models that I'd like to be able to perform inference on, and I'd really like to optimize the speed. Would it be the most optimal if I perform inference on 2 models from GPU 0 and then on the 3rd model from GPU 1?
If that's the case, I'm confused on how the code would look like for that. Some sample code below:
for model_idx in range(len(model_names)):
# create thread for performing inference
p = multiprocessing.Process(target=perform_inference_processed, args=(sess,
curr_graph,
meta_graph_def,
input_list,
per_model_output))
process_list.append(p)
As far as I know, each GPU should only have a single process running on it. If I structure my code as above, I would have 2 processes on GPU 0 (which I don't think is possible?). Is there any other way I can structure it instead? Can I control which process gets executed twice?
Thank you.
解决方案
推荐阅读
- dart - 在 Dart 的 Map 对象中创建通用属性
- tesseract - 如何在 Alpine 上安装 Tesseract-OCR 4.1.1
- javascript - 相对于视口变换 SVG
- php - 如何从 xampp 安装访问托管在 bluehost/godaddy/hostinger 上的数据库
- python - 使用 Python 嵌套的 For 循环打印乘法表
- regex - 如何找到一个模式并重命名文件,在文件名中的匹配模式的两个部分之间使用前缀插入一个字符?
- typescript - 提取实用程序类型以“this”中断
- algorithm - 我可以使用什么匹配算法?
- bash - Windows 上的 Emacs 从脚本启动时会打开 emtpy 缓冲区
- postgresql - java.lang.NoClassDefFoundError: org/apache/kafka/connect/header/ConnectHeaders