예제 #1
0
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 ()
예제 #2
0
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()