Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Parallel computing : too many values to unpack

$
0
0

Hi everyone, I need to speed up a code and am trying parallel computing to solve Mesh Plane intersections. Nevertheless I get the error “too many values to unpack” when using parallel. I fear the error pops out because my function has more than one arguement, and I´ve packed all inputs in a tuple to handle the parallel computing. The function works perfectly fine without parallel.

What am I doing wrong?

import Rhino.Geometry.Intersect as rgIntersect
from ghpythonlib import parallel

def MeshPlaneSections(args):
    # packing function arguments in a tuple to enable parallel computing
    meshes,plane = args
    
    result =[]
    for mesh in meshes:
        intersections = rgIntersect.Intersection.MeshPlane(mesh,plane)
        if intersections is not None:
            for poly in intersections:
                result.append(poly)
    return result

input = (M,P) #argument tuple

sections = MeshPlaneSections(input) #no parallel computing, working fine

#sections = parallel.run(MeshPlaneSections,input) #parallel computing, not working

Another question, another approach : would this code run faster in csharp instead of python ?

Thanks for the help!

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles