Jump to content

Dual Core with NI Vision


Recommended Posts

Dear all,

I'm trying to ameliorate a software by developping it on a dual core.

I've parallelize two tasks and win already some times, but I'm far away from the 2 times quicker I'm expecting for one reason: The two tasks are using the nivision.dll.

I was thinking on duplicating the DLL and calling on the first task the nivision.dll, and on the second task the nivision2.dll !

But, I get an error: something like "the entry point of the function IsImage does not exist in the dynamic library nivissvc.dll"

Does someone has any idea to correct this bug ?

Does someone has any idea to duplicate the task using the same DLL ?

Every little suggestion could be usefull, so please don't hesitate to throw any idea !

Thanks in advance for your precious help !

Laurent

Link to comment

QUOTE(lraynal @ Feb 11 2008, 10:55 AM)

I've parallelize two tasks and win already some times, but I'm far away from the 2 times quicker I'm expecting for one reason: The two tasks are using the nivision.dll.

I've had the same problem. What you need to realise is that the DLL calls are all configured as Reentrant. For some reason (The wisdom is beyond me unless it's a bug-fix) all the VIs CALLING the DLL-nodes are NOT set to be Re-entrant. This effectively makes the calls NOT reentrant. I've played around with simply setting the VIs to Re-entrant, but this seems to lead to the occasional problem with the IMAQ functions. I think there are certain functions which can be made reentrant (without problems), and others which can't.

Maybe newer versions are better? I was using the 12t Quarter 2007 Developer suite version.

Shane.

Link to comment

QUOTE(shoneill @ Feb 11 2008, 11:45 AM)

I've had the same problem. What you need to realise is that the DLL calls are all configured as Reentrant. For some reason (The wisdom is beyond me unless it's a bug-fix) all the VIs CALLING the DLL-nodes are NOT set to be Re-entrant. This effectively makes the calls NOT reentrant. I've played around with simply setting the VIs to Re-entrant, but this seems to lead to the occasional problem with the IMAQ functions. I think there are certain functions which can be made reentrant (without problems), and others which can't.

Maybe newer versions are better? I was using the 12t Quarter 2007 Developer suite version.

Shane.

Hi Shane,

Yes, my last test seems to go your way: I've duplicate every IMAQ function I'm using (for exemple: "IMAQ ArrayToImage.vi" has been duplicate to "IMAQ ArrayToImage 2.vi") both calling the same DLL.

I'm using the number 1 on one thread and the number 2 on the other thread, and almost reach my goal (half the total time)!

I will put the time missing on your explanation of function not called as re-entrant...

I'm still waiting for any other/new ideas !

So please fell welcome to join the discussion ! And thanks a lot Shane !!!

Laurent

Link to comment

You can set *almost* all the IMAQ functions re-entrant, they are not when you install NI-Vision but most of them should be. I got this information from a well-informed lad at NI Week :ninja:

I don't remember which function can't be set re-entrant nor why, but if you can ask your local NI support engineer to forward the question to the Vision Team in Austin you should receive all the information you need.

Good luck

Link to comment

QUOTE(TiT @ Feb 11 2008, 02:19 PM)

I don't remember which function can't be set re-entrant nor why, but if you can ask your local NI support engineer to forward the question to the Vision Team in Austin you should receive all the information you need.

But why aren't they reentrant when they're installed?! Given the amount of marketing with "The multicore crisis" and so on, you'd think these VIs would be optimised for parallel processing. It's not like Vision is an area where this kind of thing wouldn't be expected or anything.....

Ask my NI engineers. Hmm, tried that a few weeks back. Didn't help much. I suppose I'll try again though..... There are times I really DO notice the geographical distance to the US of A.

Shane.

Link to comment

QUOTE(shoneill @ Feb 11 2008, 03:29 PM)

Everybody make mistakes, me, you and "them" as well.

QUOTE(shoneill @ Feb 11 2008, 03:29 PM)

Ask my NI engineers. Hmm, tried that a few weeks back. Didn't help much. I suppose I'll try again though..... There are times I really DO notice the geographical distance to the US of A.

Damn true ! Depending on the issue we happen to short-cut the local NI guys and knock straight to the people we know in Austin.

"It's not who you are it's who you know"

Link to comment

QUOTE(TiT @ Feb 11 2008, 04:30 PM)

Everybody make mistakes, me, you and "them" as well.

Well that's true for sure. I'd expect the "problem" to get fixed though..... Any idea if the newer versions of the IMAQ functions are any different?

Unfortunately I don't know ANYONE in Austin......

Shane.

Link to comment

QUOTE(shoneill @ Feb 11 2008, 08:25 AM)

Well that's true for sure. I'd expect the "problem" to get fixed though..... Any idea if the newer versions of the IMAQ functions are any different?

Unfortunately I don't know ANYONE in Austin......

Shane.

I don't know what version of IMAQ you are using, but in my version (8.5) the dll calls to NI Vision in this VI are set to "run in any thread" (yellow call library function); this means calls to NI Vision are "thread-safe". This is the correct setup for re-entrant performance of VI's with dll calls. Calling IMAQ Array to Image in two different threads won't block each other.

Now as to getting "double performance" for the parallel loops, there could be a range of reasons for that; sharing the same image buffer? same subVI? Who knows.

Just making another copy of a VI with a dll call and re-naming it doesn't guarantee re-entrancy. NI Vision has been "thread-safe" for many versions atleast since 7 as far as I can remember.

Neville.

Link to comment

QUOTE(Neville D @ Feb 13 2008, 07:46 PM)

I don't know what version of IMAQ you are using, but in my version (8.5) the dll calls to NI Vision in this VI are set to "run in any thread" (yellow call library function); this means calls to NI Vision are "thread-safe". This is the correct setup for re-entrant performance of VI's with dll calls. Calling IMAQ Array to Image in two different threads won't block each other.

Now as to getting "double performance" for the parallel loops, there could be a range of reasons for that; sharing the same image buffer? same subVI? Who knows.

Just making another copy of a VI with a dll call and re-naming it doesn't guarantee re-entrancy. NI Vision has been "thread-safe" for many versions atleast since 7 as far as I can remember.

Neville.

I repeat:

QUOTE

What you need to realise is that the DLL calls are all configured as Reentrant. For some reason (The wisdom is beyond me unless it's a bug-fix) all the VIs CALLING the DLL-nodes are NOT set to be Re-entrant. This effectively makes the calls NOT reentrant.

It's not just the DLL call, but also the VI the DLL call is in.

Shane.

Link to comment

Shane and Laurent,

I suggest you post your questions about this on the machine vision board on NI forum, guys there will tell you which IMAQ VI can be set re-entrant or not and why.

Many IMAQ VIs just call a thread-safe dll, such VIs can be set re-entrant, but as pointed Neville D :

QUOTE

Now as to getting "double performance" for the parallel loops, there could be a range of reasons for that; sharing the same image buffer? same subVI? Who knows.

Hope this helps

Link to comment

Shane is right, the IMAQ DLL calls are re-entrant, but not the VIs encapsulating this call (in 8.5). Which means that creating a copy of this VI (for the second loop) IS a solution ! It's probably not the best one, but it works !!!!

(I could change the property of the VI, but what if my client decide to "update" products of NI, he will have to change the properties again ?)

And I get my target time:

The whole process parralelized takes half the time without the parralel loop...

Well, after all these discusions, I can't add more than that !

Thanks all of you,

Laurent

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.