"node", G.nodes(), [ CBlock([ "graph.node_data[node] = 0", # 0 represents not colored "VForbidden[node] = 0", "TVForbidden[node] = 0", "CS[node] = 0" ]), CDecl(('bool', 'pop', '')), CBlock(["pop = node < graph.nnodes"], parse=False), ClosureHint( ForAll("edge", G.edges("node"), [ CBlock([("edge_src[edge] = node")]), If("node < graph.getAbsDestination(edge)", [ EL.push("edge"), ]) ])) ]) ] ), #initializing all nodes to color 0 (not colored), pushing edges to edgelist and setting edge_src Kernel( "assignColors", [ G.param(), ("int *", "CS"), ("int *", "VForbidden"), ("int *", "TVForbidden") ], [ ForAll( "node", G.nodes(),
from gg.lib.graph import Graph from gg.lib.wl import Worklist from gg.ast.params import GraphParam import cgen G = Graph("graph") WL = Worklist() ast = Module([ CBlock(["typedef int edge_data_type", "typedef int node_data_type"]), CBlock([cgen.Define("MAXFORBID", "32")]), Kernel("ipgc_init", [G.param()], [ ForAll("node", G.nodes(), [CBlock(["graph.node_data[node] = 0"]), WL.push("node")]) ]), #initializing all nodes to color 0 Kernel( "assignColors", [G.param()], [ ForAll( "node", G.nodes(), [ CDecl([("int", "FORBIDDEN", ""), ("int", "offset", "=0"), ("bool", "colored", "=false")]), If( "graph.node_data[node] == 0", [ While(
from gg.ast.params import GraphParam import cgen G = Graph("graph") WL = Worklist() ast = Module([ CBlock(["typedef int edge_data_type", "typedef int node_data_type"]), Kernel("ipgc_init", [G.param(), ("int *", "max_degree")], [ ForAll("node", G.nodes(), [ CBlock([ "graph.node_data[node] = 0", "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",
from gg.lib.graph import Graph from gg.lib.wl import Worklist from gg.ast.params import GraphParam import cgen G = Graph("graph") WL = Worklist() ast = Module([ CBlock(["typedef int edge_data_type", "typedef int node_data_type"]), CBlock([cgen.Define("MAXFORBID", "32")]), Kernel("ipgc_init", [G.param()], [ ForAll("node", G.nodes(), [CBlock(["graph.node_data[node] = 0"]), WL.push("node")]) ]), #initializing all nodes to color 0 Kernel( "assignColors", [G.param()], [ ForAll( "wlnode", WL.items(), [ CDecl([ ("int", "node", ""), ("bool", "pop", ""), ]), WL.pop("pop", "wlnode", "node"), CDecl([("int", "FORBIDDEN", ""), ("int", "offset", "=0"),