Changeset: b20a4c25d0ef for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b20a4c25d0ef
Added Files:
monetdb5/scheduler/Tests/mutation02.mal
Modified Files:
monetdb5/scheduler/mut_pack.c
monetdb5/scheduler/mut_policy.c
monetdb5/scheduler/run_multicore.c
Branch: mutation
Log Message:
Addition of the thetasubselect
diffs (149 lines):
diff --git a/monetdb5/scheduler/Tests/mutation02.mal
b/monetdb5/scheduler/Tests/mutation02.mal
new file mode 100644
--- /dev/null
+++ b/monetdb5/scheduler/Tests/mutation02.mal
@@ -0,0 +1,49 @@
+# example framework for a multicore based execution stack
+
+# The multicore scheduler picks a plan from a specific pool
+# possibly after performing introspection and plan multicore
+
+function initialize{unsafe}():bat[:oid,:lng];
+ b:= bat.new(:oid,:lng);
+
+ INT_MAX := 2147483647;
+ dbgmsk_restore := mdb.getDebug();
+ dbgmsk_unset := 8+8388608;
+ dbgmsk_keep := calc.xor(INT_MAX,dbgmsk_unset);
+ dbgmsk_set := calc.and(dbgmsk_restore,dbgmsk_keep);
+ mdb.setDebug(dbgmsk_set);
+
+ r:= mmath.srand(0);
+ barrier i:= 0:lng;
+ k:= mmath.rand();
+ l:= calc.lng(k);
+ bat.append(b,l);
+ redo i:= iterator.next(1:lng,1000000:lng);
+ exit i;
+ mdb.setDebug(dbgmsk_restore);
+
+ return b;
+end initialize;
+
+function query();
+ t0:= alarm.usec();
+ b:= initialize();
+ empty:= bat.new(:oid,:lng);
+barrier z:= language.dataflow();
+ s1 := algebra.thetasubselect(b,99:lng,"<=");
+ s2 := algebra.thetasubselect(b,999:lng,"<=");
+ s3 := algebra.thetasubselect(b,9999:lng, "<=");
+ language.pass(b);
+exit z;
+ t1:= alarm.usec();
+ t2 := t1-t0;
+ io.printf("# total running time %d\n",t2);
+end query;
+
+#multiple calls should produce more parallel plans.
+optimizer.multicore("user","query");
+user.query();
+user.query();
+user.query();
+user.query();
+user.query();
diff --git a/monetdb5/scheduler/mut_pack.c b/monetdb5/scheduler/mut_pack.c
--- a/monetdb5/scheduler/mut_pack.c
+++ b/monetdb5/scheduler/mut_pack.c
@@ -73,25 +73,28 @@ mutationPack(Client cntxt, Mutant m){
// first phase, see if we need to undo a bat.partition
svar = -1; mvar = -1; dvar = -1;
- for (i = 1; i < limit; i++)
- if ( (p= old[i])->token != NOOPsymbol){
+ for (i = 1; i < limit; i++) {
+ p= old[i];
if ( i == pc){
if ( m->stk->stksize < mb->vtop + p->argc)
continue;
mvar = getArg(p,0);
// move ahead to first candidate for consolidation
- j= i;
- for(i++ ; i < limit && validswitch(old[pc],old[i]); i++)
- /* nothing */;
+ for(i++ ; i < limit && validswitch(old[pc],old[i]);
i++){
+ old[pc] = old[i];
+ old[i] = p;
+ pc = i;
+ }
q = old[i];
+ // we found a partition to be removed
if (getModuleId(q) == batRef && getFunctionId(q) ==
partitionRef && getArgPos(p,mvar) >=0){
- // we found a partition to be removed
svar = getArg(q,0);
}
packpc = i-1;
newpack = p;
+ old[i-1]= 0;
m->comment = GDKstrdup("mutationPack");
} else
// rollback all but one partitioned instruction
@@ -99,8 +102,7 @@ mutationPack(Client cntxt, Mutant m){
if (dvar == -1){
getArg(p, getArgPos(p,svar)) = mvar;
dvar = getArg(p,0);
- } else
- p->token = NOOPsymbol;
+ }
}
}
@@ -108,8 +110,8 @@ mutationPack(Client cntxt, Mutant m){
mnstr_printf(cntxt->fdout,"#mutationPack mvar %d svar %d dvar
%d leftover %d\n", mvar,svar,dvar,limit);
// second phase, replace matpack with its successor
- for (i = 1; i < limit; i++) {
- p= old[i];
+ for (i = 1; i < limit; i++)
+ if ( (p= old[i])){
profiler = mb->profiler[i].trace;
if ( packpc == i && getArgPos(old[i+1],mvar) < 0){
diff --git a/monetdb5/scheduler/mut_policy.c b/monetdb5/scheduler/mut_policy.c
--- a/monetdb5/scheduler/mut_policy.c
+++ b/monetdb5/scheduler/mut_policy.c
@@ -44,8 +44,9 @@ mutationCandidate(InstrPtr p){
return 1;
return ( getModuleId(p) == algebraRef &&
(getFunctionId(p) == subselectRef ||
- getFunctionId(p) == joinRef ));
- //|| getFunctionId(p) == leftfetchjoinRef));
+ getFunctionId(p) == thetasubselectRef ||
+ getFunctionId(p) == joinRef ||
+ getFunctionId(p) == leftfetchjoinRef));
}
@@ -114,7 +115,7 @@ MUTpolicyBaseline(Client cntxt, Mutant m
{
if(getFunctionId(p) == joinRef)
mutationJoin(cntxt,m);
- else if(getFunctionId(p) == subselectRef)
+ else if(getFunctionId(p) == subselectRef || getFunctionId(p) ==
thetasubselectRef)
mutationSelect(cntxt,m);
else if(getFunctionId(p) == leftfetchjoinRef)
mutationLeftFetchJoin(cntxt,m);
diff --git a/monetdb5/scheduler/run_multicore.c
b/monetdb5/scheduler/run_multicore.c
--- a/monetdb5/scheduler/run_multicore.c
+++ b/monetdb5/scheduler/run_multicore.c
@@ -73,7 +73,7 @@ RUNmulticore(Client cntxt, MalBlkPtr mb,
mutant->totalQueryTime = GDKusec() - clkInit;
mutant->calls++;
- if ( mb->calls == 0 ){
+ if ( mutant->next == 0){
mutant->globalMinExec = mutant->totalQueryTime;
mutant->serialExecTime = mutant->totalQueryTime;
mutant->globalMinRun = 0;
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list