Error "Runtime Exception. Comm Failure 113" when using g.triple_apply with global parameters

User 1914 | 6/9/2015, 7:07:43 PM

I am trying to use g.triple_apply with externally declared global parameters and get the following error:

The code snippet is:

global ncomponents global covars global means global cvlogdet global cvchol

def logmultivariatenormaldensityg (sourcevertex, edge, targetvertex): """ calculation of responsibilities for each edge in the graph """ ndim = cvchol[c].shape[0] X = sourcevertex['features'] c = target_vertex['vertexid'] cvsol = linalg.solvetriangular(cvchol[c], (X - means[c]).T, lower=True).T edge['resp'] = - .5 * (np.sum(cvsol ** 2) + ndim np.log(2 np.pi) + cvlogdet[c]) return (sourcevertex, edge, targetvertex) ... error occured at 217 g.tripleapply(logmultivariatenormaldensityg, mutated_fields=['resp'])

/usr/lib/python2.7/site-packages/graphlab/datastructures/sgraph.pyc in tripleapply(self, tripleapplyfn, mutatedfields, inputfields) 1018 else: 1019 with cythoncontext(): -> 1020 return SGraph(proxy=g.proxy.lambdatripleapply(tripleapplyfn, mutated_fields))

/usr/lib/python2.7/site-packages/graphlab/cython/context.pyc in exit(self, exctype, excvalue, traceback) 29 def exit(self, exctype, excvalue, traceback): 30 if not self.showcythontrace and exctype: ---> 31 raise exctype(exc_value)

Comments

User 19 | 6/9/2015, 8:41:56 PM

Does it work when you remove the cv_sol =... line and simply set edge['resp']=1? After doing this, does it work when you don't set the other variables to be global?


User 1914 | 6/10/2015, 7:44:34 PM

Changed asa you suggested and no error anymore. However, I do need these global variables. The only other option would be to add them to all the vertices? They are fairly small 7 4 4 floats, compared to millions of vertices?


User 19 | 6/10/2015, 8:02:53 PM

The global variables should be fine to use. I wouldn't recommend adding them to the vertices. The global variable a in this example works as expected:

` import graphlab as gl g = gl.SFrame({'i': range(10), 'j': [i+5 for i in range(10)]}) g = gl.SGraph().add_edges(g, 'i', 'j') g.edges['sum'] = 0

global a a = [i for i in range(20)]

def fn(src, edge, dst): i = src['__id'] j = dst['__id']

edge['sum'] = i + j + a[i] + a[j]
return (src, edge, dst)

g2 = g.tripleapply(fn, ['sum'], ['sum']) g2.edges gives the following Data: +----------+----------+-----+ | __srcid | __dst_id | sum | +----------+----------+-----+ | 5 | 10 | 30 | | 8 | 13 | 42 | | 7 | 12 | 38 | | 0 | 5 | 10 | | 2 | 7 | 18 | | 9 | 14 | 46 | | 6 | 11 | 34 | | 3 | 8 | 22 | | 1 | 6 | 14 | | 4 | 9 | 26 | +----------+----------+-----+ [10 rows x 3 columns]

`

So I would recommend working up from a small example like this. I suspect there are some inputs to linalg.solve_triangular that are causing problems.