Grasshopper

algorithmic modeling for Rhino

I was trying out calling GH components in Python, following a post by by Steve Baer, that explains how to apply parallel computing and call components in Python in GH.

However I ran into a number of issues:

  • When I tried to replicate the "Region Difference" component in Python, it ran without errors, but the result was totally different from the GH component   :(    Off course it shows a significant drop in processing time (almost a third of the time required.
  • When I tried applying the parallel solver in Python, it didn't work and returns an error...

Has anyone tried this before? Or know what might be the problem?

Attached are the files for your reference.

Regards,

Omar

Views: 1784

Attachments:

Replies to This Discussion

Hi Omar

 Check the attached file" 

Attachments:

Hi Omar

the script had a logic bug, in the sense that it was supposed to work on the entire list of curves, not only one at the time. I set list access to fix this.

I also made a quick test at making this parallel. It works here as well. Making it parallel in more advanced ways, for example by making both inputs accept lists, will be more complicated. However, this shows the potential.

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Attachments:

Thanks Giulio,

The single threaded version runs perfectly now, but the parallel mode does not work and displays this message:

Omar

Just by quick look at the photo you attached:
Your input is "curveA", while in your code you have "curvesA".

Yeah, sorry I renamed it just as a last step and forgot to update the code...

I fixed this, but now the parallel python does work in the proper way

Attachments:

In fact, forget that parallel sample entirely. That operation is not parellelizable. I put that together in haste and did not check that it did not make sense for what you were trying to do. The serial sample should work correctly.

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Thanks Giulio,

Actually now that you have mentioned it, yes, I think I kind of understand how in this case it is not parellizable...

So my next target would be the "Cap Brep" component, it takes a long time on my definition and it should be "parellizable", as it is basically trying to cap a large number of separate open breps.

Thanks again Giulio and Djordje

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service