-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can NCS2 use multiple processes? Or can an NCS2 run multiple models simultaneously? #2
Comments
am sorry your post is badly formatted i can't catch your meaning. For your last question, The answer is Yes. you can run two models simutaneously with only one NCS2, with lower performance result of course. |
from openvino.inference_engine import IENetwork, IEPlugin def main(net, plugin):
#####################################################
run() |
I use the above code and run two models at the same time to report the following errors: Process Process-1: Traceback (most recent call last): File "/usr/lib/python 3.5/multiprocessing/process.py", line 249, in_bootstrap Self.run () File "/usr/lib/python 3.5/multiprocessing/process.py", line 93, in run Self. _target (* self. _args,** self. _kwargs) File "mulit_nets_test_01.py", line 12, in main Exec_net = plugin. load (network = net) File "ie_api.pyx", line 389, in openvino.inference_engine.ie_api.IEPlugin.load File "ie_api.pyx", line 400, in openvino.inference_engine.ie_api.IEPlugin.load Runtime Error: Can not init USB device: NC_DEVICE_NOT_FOUND E: [ncAPI] [719106] ncDeviceOpen: 870 failed to find device Process Process-2: Traceback (most recent call last): File "/usr/lib/python 3.5/multiprocessing/process.py", line 249, in_bootstrap Self.run () File "/usr/lib/python 3.5/multiprocessing/process.py", line 93, in run Self. _target (* self. _args,** self. _kwargs) File "mulit_nets_test_01.py", line 12, in main Exec_net = plugin. load (network = net) File "ie_api.pyx", line 389, in openvino.inference_engine.ie_api.IEPlugin.load File "ie_api.pyx", line 400, in openvino.inference_engine.ie_api.IEPlugin.load Runtime Error: Can not init USB device: NC_DEVICE_NOT_FOUND In fact, I can be sure that my NCS2 is plugged in and there is no problem. If I use "processes. append" (threading. Thread (target = main, args = (net, plugin)) to get results, does this mean that NCS2 cannot run two models in parallel? |
processes.append(threading.Thread(target=main, args=(net,plugin ))) |
if you are sure the issue is not caused by your NCS2, suggest you try use threads instead of processes ( since different processed have different memory spaces, "passing" IEPlugin objects between processes may cause unexpected behavior like what you've ran into). if you really want multiple processes, you can init IEPlugin instances in child processes. this should also work. |
Hello, I don't quite understand what you mean by "Initializing IEPlugin in a child process". Can you show it in my code above? Thank you very much. |
[<Process(Process-1, initial)>, <Process(Process-2, initial)>] Process Process-1:
|
1. use threads , not processes ( in your code you fork 2 processes and do
job in child processes. please fork threads instead. )
2. init only one IEPlugin in main thread, and pass it to sub-threads.
ZhaoMonica <[email protected]>于2019年5月23日 周四下午5:23写道:
------------------------------
[<Process(Process-1, initial)>, <Process(Process-2, initial)>]
E: [ncAPI] [ 175625] ncDeviceOpen:870 failed to find device
Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python3.5/multiprocessing/process.py", line 249, in
_bootstrap
self.run()
File "/usr/lib/python3.5/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "mulit_nets_test_01.py", line 12, in main
exec_net = plugin.load(network=net)
File "ie_api.pyx", line 389, in
openvino.inference_engine.ie_api.IEPlugin.load
File "ie_api.pyx", line 400, in
openvino.inference_engine.ie_api.IEPlugin.load
RuntimeError: Can not init USB device: NC_DEVICE_NOT_FOUND
(1, 1, 100, 7)
------------------------------
I put the initialization of IEPlugin in the main () function of the code
above, which shows the results. Only one model has been loaded and output.
Do you know why?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2?email_source=notifications&email_token=AAJ2K2VSP34GQDXQE3QIZB3PWZO77A5CNFSM4HO2PROKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWBTSLY#issuecomment-495139119>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJ2K2VWQXFONWAOVLFRDX3PWZO77ANCNFSM4HO2PROA>
.
--
- Fanjiang
Wechat: decemberpei
Cell Phone: (86)176-1216-2932
|
Hello, can I understand that a NCS2 can only perform "plugin = IEPlugin" (device = "MYRIAD") once, and if it is a process, it will need several NCS2 to initialize IEPlugin once for each process. |
I haven't tried but I don't agree,
|
I have some questions about your first point: if there are several separate applications trying to use the same NCS2, does NCS2 support separate access for several separate applications? |
I use process simulation to simulate several separate applications to access NCS2 at the same time. In fact, when I insert an NCS2, only one application is working properly. Others will "fail to find NCS2". When I insert two NCS2, two programs will run normally. Does this mean that NCS2 cannot be processed or accessed simultaneously? |
I know some one reporting the same issue. I haven't tried this yet. my
guess is that one NCS can be bond to only one IEPlugin.
ZhaoMonica <[email protected]>于2019年5月24日 周五下午5:38写道:
I use process simulation to simulate several separate applications to
access NCS2 at the same time. In fact, when I insert an NCS2, only one
application is working properly. Others will "fail to find NCS2". When I
insert two NCS2, two programs will run normally. Does this mean that NCS2
cannot be processed or accessed simultaneously?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2?email_source=notifications&email_token=AAJ2K2S6F3ZWJBP5N4SMTFTPW6ZSZA5CNFSM4HO2PROKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWEWT4Q#issuecomment-495544818>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJ2K2VSWODENI4CGETYUH3PW6ZSZANCNFSM4HO2PROA>
.
--
- Fanjiang
Wechat: decemberpei
Cell Phone: (86)176-1216-2932
|
I can't find an answer for your question from official document. it may or
may not be supported.
ZhaoMonica <[email protected]>于2019年5月24日 周五下午5:31写道:
I have some questions about your first point: if there are several
separate applications trying to use the same NCS2, does NCS2 support
separate access for several separate applications?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2?email_source=notifications&email_token=AAJ2K2UUMX66L5X4FMGQOZLPW6YWFA5CNFSM4HO2PROKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWEV4FQ#issuecomment-495541782>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJ2K2VVY6TCN7MXBBOQTMLPW6YWFANCNFSM4HO2PROA>
.
--
- Fanjiang
Wechat: decemberpei
Cell Phone: (86)176-1216-2932
|
Hi, how can I avoid having only one thread running if I have an NCS2 and start four threads, each of which is an infinite loop?I want all four threads to execute in rotation, not just one running and all the others blocking. |
sorry your question has nothing to do with NCS2 nor this repo, Please google it yourself. |
just found some tips in official doc: |
Hello, may I ask "_worker = threading. Thread (target = async_infer_worker, args= (exec_nets [f], request_number, image_queue, out_blob)" in your "async_api_multi-processes_multi-requests_multi-ncs.py" file?
_ worker. start ()
Infer_threads. append (_worker)
Can "preprocess_process. join ()" be changed to process run? I tried unsuccessfully myself. I only have one NCS2. I want to run two models, one Yolo and one SSD model at the same time. Does NCS2 support it?
The text was updated successfully, but these errors were encountered: