Exemple #1
0
def execTpch(acc, num, profilers, buffers):

    qPath = "../query/plans/tpch" + str(num) + ".py"
    cfgPath = "../query/plans/tpch" + str(num) + "cfg.py"

    # read query plan
    alg = RelationalAlgebra(acc)
    plan = eval(loadScript(qPath))

    # read plan configuration ( if exists )
    cfg = {}
    if os.path.isfile(cfgPath):
        cfg = eval(loadScript(cfgPath))
    plan = alg.resolveAlgebraPlan(plan, cfg)

    qfilename = "tpch" + str(num)

    if profilers == 'all':
        profilers = getBufferPositions(alg)
    else:
        profilers = eval(profilers)
    if buffers == 'all':
        buffers = getBufferPositions(alg)
    else:
        buffers = eval(buffers)

    execute(alg, plan, qfilename, buffers, profilers)
    report(qfilename, profilers)
Exemple #2
0
def execTpch ( acc, num, showPlan=False ):
    
    qPath = "../query/plans/tpch" + str(num) + ".py"
    cfgPath = "../query/plans/tpch" + str(num) + "cfg.py"

    # read query plan
    alg = RelationalAlgebra ( acc )
    plan = eval ( loadScript ( qPath ) )
    
    # read plan configuration ( if exists )
    cfg = {}
    if os.path.isfile ( cfgPath ):
        cfg = eval ( loadScript ( cfgPath ) )

    # show basic plan
    if showPlan:
        alg.showGraph ( plan )
        
    plan = alg.resolveAlgebraPlan ( plan, cfg )
        
    # show refined plan 
    if showPlan:
        alg.showGraph ( plan )

    compiler = CudaCompiler ( algebraContext = alg, smArchitecture = "sm_75", decimalRepr = CType.FP32, debug = False )

    compilerPlan = alg.translateToCompilerPlan ( plan, compiler )
    compiler.gencode ( compilerPlan )
    compiler.compile ( "tpch" + str(num) )
    compiler.execute ()
def executePlanNumOperators ( usePushDownJoin = False ):

    EquiJoinTranslator.usePushDownJoin = usePushDownJoin 

    datagen.generator.joinData ( "pk-4zipf-fk" )
    acc = io.dbAccess ( schema.join.joinSchema, "mmdb", "./", True )

    for r in [2]:
        for n in [ 0,3,6,9,12,15,18,21,24,27 ]:

            alg = RelationalAlgebra ( acc )
            plan = alg.join (
                ("r_build", "s_probe"),
                alg.scan ( "r_build" ),
                alg.scan ( "s_probe" )
            )
            
            name = "r_linenumber"
            for i in range(0,n):
                plan = alg.selection (
                    scal.NotExpr (
                        scal.SmallerExpr ( 
                            scal.AbsExpr ( 
                                scal.SubExpr ( 
                                    scal.AttrExpr ( name ),
                                    scal.ConstExpr ( str ( random.randint (1, 999999999) ), Type.FLOAT )
                                )
                            ),
                            scal.ConstExpr ( "0.01", Type.FLOAT )
                        )
                    ),
                    plan
                )
                newname = "l_linenumber" + str(i)
                plan = alg.map ( newname,
                    scal.MulExpr ( 
                        scal.AttrExpr ( name ),
                        scal.ConstExpr ( "0.99", Type.FLOAT )
                    ),
                    plan
                )
                name = newname
           
            cfg = {}

            plan = alg.projection ( [ name ], plan )
            
            plan = alg.resolveAlgebraPlan ( plan, cfg )
            compiler = CudaCompiler ( alg, "sm_75", CType.FP64, False )
            compilerPlan = alg.translateToCompilerPlan ( plan, compiler )
            compiler.gencode ( compilerPlan )
            compiler.compile ( "joinbenchNumOps" )
            compiler.execute ()
Exemple #4
0
def execTpch(acc, num, showPlan=False):

    qPath = "../query/plans/tpch" + str(num) + ".py"
    cfgPath = "../query/plans/tpch" + str(num) + "cfg.py"

    # read query plan
    alg = RelationalAlgebra(acc)
    plan = eval(loadScript(qPath))

    # read plan configuration ( if exists )
    cfg = {}
    if os.path.isfile(cfgPath):
        cfg = eval(loadScript(cfgPath))

    # show basic plan
    if showPlan:
        alg.showGraph(plan)

    plan = alg.resolveAlgebraPlan(plan, cfg)

    # show refined plan
    if showPlan:
        alg.showGraph(plan)

    experimentBuffer(alg, plan, cfg, num)
def experimentDivergence(addLaneRefill):
    predicateValue = 45
    for r in [1, 2, 3, 4, 5]:
        for n in [0, 3, 6, 9, 12, 15, 18, 21, 24, 27]:
            alg = RelationalAlgebra(acc)
            plan = alg.selection(
                scal.LargerExpr(scal.AttrExpr("l_quantity"),
                                scal.ConstExpr(str(predicateValue), Type.INT)),
                alg.scan("lineitem"))
            name = "l_extendedprice"
            for i in range(0, n):
                plan = alg.selection(
                    scal.NotExpr(
                        scal.SmallerExpr(
                            scal.AbsExpr(
                                scal.SubExpr(
                                    scal.AttrExpr(name),
                                    scal.ConstExpr(
                                        str(random.randint(1, 999999999)),
                                        Type.FLOAT))),
                            scal.ConstExpr("0.01", Type.FLOAT))), plan)
                newname = "l_extprice" + str(i)
                plan = alg.map(
                    newname,
                    scal.MulExpr(scal.AttrExpr(name),
                                 scal.ConstExpr("0.99", Type.FLOAT)), plan)
                name = newname

            plan = alg.projection([name], plan)
            cfg = {}
            plan = alg.resolveAlgebraPlan(plan, cfg)
            compiler = CudaCompiler(alg, "sm_75", CType.FP64, False)
            if addLaneRefill:
                compiler.setBuffers([2])
            compilerPlan = alg.translateToCompilerPlan(plan, compiler)
            compiler.gencode(compilerPlan)
            compiler.compile("filterbenchNumOps")
            compiler.execute()
Exemple #6
0
def experimentDivergence(doBuffer):
    for predicateValue in [5, 10, 15, 20, 25, 30, 35, 40, 45, 50]:
        alg = RelationalAlgebra(acc)
        plan = alg.join(
            ("l_partkey", "p_partkey"), alg.scan("part"),
            alg.selection(
                scal.SmallerExpr(scal.AttrExpr("l_quantity"),
                                 scal.ConstExpr(str(predicateValue),
                                                Type.INT)),
                alg.scan("lineitem")))
        plan = alg.aggregation(
            ["l_quantity"],
            [(Reduction.SUM, "l_extendedprice", "total_price")], plan)
        cfg = {}
        cfg[5] = {}
        cfg[5]["numgroups"] = 100000
        plan = alg.resolveAlgebraPlan(plan, cfg)
        compiler = CudaCompiler(alg, "sm_75", CType.FP64, False)
        if doBuffer:
            compiler.setBuffers([3])
        compilerPlan = alg.translateToCompilerPlan(plan, compiler)
        compiler.gencode(compilerPlan)
        compiler.compile("filterbenchTPCH")
        compiler.execute()
Exemple #7
0
def executePlanNumOperators(usePushDownJoin=False):

    EquiJoinTranslator.usePushDownJoin = usePushDownJoin

    for data in ["pk-fk", "pk-8-fk", "pk-32-fk", "pk-zipf-fk", "pk-4zipf-fk"]:
        for r in [2]:

            datagen.generator.joinData(data)
            acc = io.dbAccess(schema.join.joinSchema, "mmdb", "./", True)

            alg = RelationalAlgebra(acc)
            plan = alg.join(("r_build", "s_probe"), alg.scan("r_build"),
                            alg.scan("s_probe"))

            plan = alg.resolveAlgebraPlan(plan, {})
            compiler = CudaCompiler(alg, "sm_75", CType.FP32, False)
            compilerPlan = alg.translateToCompilerPlan(plan, compiler)
            compiler.gencode(compilerPlan)
            compiler.compile("joinbenchNumOps")
            compiler.execute()