]) ]), ]), ]), ]), #assigning new colors to all conflicting nodes Kernel( "detectConflicts", [G.param(), ("int *", "edge_src"), ("int *", "CS")], [ ForAll( "wledge", EL.items(), [ CDecl([("int", "edge", ""), ("bool", "pop", ""), ("int", "color", "=0")]), EL.pop("pop", "wledge", "edge"), CDecl([('int', 'u', '= edge_src[edge]'), ('int', 'v', '= graph.getAbsDestination(edge)')]), If( "CS[u] == CS[v] && graph.node_data[u] == graph.node_data[v] && u < v", [ CBlock(["graph.node_data[v] = 0" ]), # uncolor node v ]), ]), ]), #detecting conflicting nodes Kernel( "createNewEdgeList", [ G.param(), ("int *", "edge_src"), ("int *", "CS"), ("int *", "VForbidden")
"atomicMax(max_degree, graph.getOutDegree(node))" ]), WL.push("node") ]) ]), #initializing all nodes to color 0 Kernel( "assignColors", [G.param(), ("bool *", "forbidden"), ("int *", "max_degree")], [ ForAll( "wlnode", WL.items(), [ CDecl([("int", "node", ""), ("bool", "pop", ""), ("int", "color", "=0")]), WL.pop("pop", "wlnode", "node"), ForAll("edge", G.edges("node"), [ CDecl([("index_type", "dst", "=graph.getAbsDestination(edge)")]), CBlock([ "forbidden[max_degree[0] * node + graph.node_data[dst]] = true" ]), ]), While("forbidden[max_degree[0] * node + color]==true", [ CBlock(["color++"]), ]), #R: do we need a sync_threads here to make sure forbidden of all nodes is calculated before updating any node? CBlock(["graph.node_data[node] = color"]), WL.push("node") ]) ]), #assigning new colors to all conflicting nodes