Grasshopper

algorithmic modeling for Rhino

I am so excited to have this function. I'm super new to python but have some scripting experience in other languages.

Here I am attempting to speed up Kangaroo.removeDuplicateLines. Does the error below mean this can't be done with this component? or do I have a mistake?

import ghpythonlib.components as ghcomp

import ghpythonlib.parallel

def removeDupeLines(line, tol):

   result = ghcomp.Kangaroo.removeDuplicateLines(line, tol)

   if result: return result.curves

if multithread:

   Q = ghpythonlib.parallel.run(removeDupeLines, L, t)

else:

   Q = ghcomp.Kangaroo.removeDuplicateLines(L,t).curves

Views: 2269

Replies to This Discussion

I can't read the error, the image is too small.

--

David Rutten

david@mcneel.com

Also, multi-threading only works if you're going to run the component more than once. RemoveDuplicateLines operates on a whole list of lines so if you're only providing a single list (as the wire type in your image indicates) then you will not get any benefit from multi-threading it.

--

David Rutten

david@mcneel.com

Hi David,

I was wondering if you would mind taking a look at something. I'm somewhat new to Grasshopper, and I've been having a devil of a time trying to figure out why this is happening.

I wrote a parallel script in Ghpython to try to solve a MeshRay function faster than with the native Grasshopper module (I have a multi-core CPU), but I'm achieving much slower results with the parallel component. (56 ms for the native MeshRay module, 2.2s for the parallel Python component).

I've uploaded the file I've been testing with. Is there anything you can see in there that would cause this significance performance hit? I'm interested in both the boolean and point output of the operation - but I've limited it to just the H output to see if that would speed it up.

Thanks so much - I'm at a loss!

James

Attachments:

Just be aware that David is away at the moment. He will be back tomorrow.

With regards to your dilemma, Native components are already compiled script components have to be compiled as the instance is run so there will be an overhead to actually turn your code into a "component".

You should place this sort of question in a new "VB, C# and Pyhton Coding" forum discussion

running parallel on this component doesn't make sense (it does work when not using parallel). The reason is that removeDuplicateLines needs to work on the entire set of lines to produce an answer. Calling it the way you are showing calls removeDuplicateLines many times with a single line as the input each time.

As a side note - I realize you are maybe just using it as an example here, but are you using the removeduplicatelines from the new Kangaroo? It is now much faster than the old one.

I've been in full production mode for a while and have not updated gh or other components lately. I just saw the new release(s) Daniel. Thank you. I'll go through and update everything before I continue.

Thanks for the explanations. I suspected this may be the case; that it operates on the whole set at once.

Sorry for the small image. The error is:

1. Solution exception:Guid is not iterable

!!!! Wow !!!!!,

With the new Kangaroo installed, this removeDuplicateLines comp runs WAY faster. 762ms now compared with 8.3 seconds before.... Nice work Daniel.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service