Grasshopper

algorithmic modeling for Rhino

Multithreading, Race condition's trouble | ghPython parallel modules + SurfaceMorph

if not using paralle modules ....

if using paralle modules ....

why this...

please help me !!

****************

import ghpythonlib.components as ghcomp
import ghpythonlib.parallel

model = []


def SrfMorph(myS):
    result = ghcomp.SurfaceMorph(G,R,myS,U,V,W)
    if result:
        return result

if parallel:
    model = ghpythonlib.parallel.run(SrfMorph, S, True)
else:
    model = ghcomp.SurfaceMorph(G,R,S,U,V,W)

****************

Views: 964

Attachments:

Replies to This Discussion

Hi Shuta,

I guess it's a bug of some sort.
Interestingly the problem goes away when you graft the "S" input.

Hi djordje

thx for your advice!

but,

if graft the "S" input...

the component run as "single thread"...

<graft - 563 ms>

<not graft - 256ms>

Having higher component's run time in parallel mode, than in single thread mode, is not an indication that parallel mode is running in single thread mode too.
The reason why you might have higher time if you graft the "S" input is because parallel.run function is meant to be used with single lists (being that a python regular list or a list from a single branched grasshopper tree), or python's lists of lists. When you graft "S" input, you get a data tree with several branches, with one list on each of those branches. Because of this parallel.run then needs to take one list at a time, and an item from that list, which results in much higher component run time.

I reported the problem at ghpython's github issues page.

thx!

Hi 筑梦NARUTO 

Thanks for your information !
I read the article carefully.
But, I was not able to solve this problem...

In this article, "race condition" is not described.

It looks like SurfaceMorph is not thread safe. I created an issue in our bugtracker to fix this in the future.

http://mcneel.myjetbrains.com/youtrack/issue/RH-29738

For now, you should not use multiple threads for the SurfaceMorph functionality.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service