Changeset: f27f412c9800 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f27f412c9800
Added Files:
        monetdb5/scheduler/Tests/transientTestFinal.mal
Branch: mutation
Log Message:

script to test transient bat added


diffs (204 lines):

diff --git a/monetdb5/scheduler/Tests/transientTestFinal.mal 
b/monetdb5/scheduler/Tests/transientTestFinal.mal
new file mode 100644
--- /dev/null
+++ b/monetdb5/scheduler/Tests/transientTestFinal.mal
@@ -0,0 +1,199 @@
+# script to check the functionality of bat.setTransient in guaranteeing the 
correct cardinality of the mutation subselect calls.
+# Follow the instructions at the end of the page to invoke
+
+
+function initializeLeft640MB{unsafe}():bat[:oid,:lng];
+
+       t0 := alarm.usec();
+
+        b:= bat.new(:oid,:lng);
+       bat.setPersistent(b,true);
+       bat.setName(b, "Left640MB");
+
+       io.printf("\n Left 640MB started");
+        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,80000000:lng);
+        exit i;
+       cnt := aggr.count(b);
+       io.printf("\n Left 640 MB count= %d",cnt);      
+       
+       t1 :=  alarm.usec();
+       t2 := t1-t0;
+       io.printf("\n Time for 640MB left - %d \n",t2);
+       
+       bat.unload("Left640MB");
+       transaction.commit();
+
+        return b;
+end initializeLeft640MB;
+
+
+function initializeLeft2000MB{unsafe}():bat[:oid,:lng];
+       
+
+       t0 :=  alarm.usec();
+        b:= bat.new(:oid,:lng);
+        bat.setPersistent(b,true);
+        bat.setName(b, "Left2000MB");
+
+       io.printf("\n Left 2000MB started");
+        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,250000000:lng);
+        exit i;
+        cnt := aggr.count(b);
+#        io.print(cnt);
+       io.printf("\n Left 2000 MB count= %d",cnt);     
+
+        bat.unload("Left2000MB");
+        transaction.commit();
+
+       t1 :=  alarm.usec();
+       t2 := t1-t0;
+       io.printf("\n Time for 2GB left - %d \n",t2);
+       
+        return b;
+end initializeLeft2000MB;
+
+function initializeLeft3200MB{unsafe}():bat[:oid,:lng];
+        
+       t0 :=  alarm.usec();
+        b:= bat.new(:oid,:lng);
+        bat.setPersistent(b,true);
+        bat.setName(b, "Left3200MB");
+
+       io.printf("\n Left 3200MB started");
+        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,400000000:lng);
+        exit i;
+        cnt := aggr.count(b);
+#        io.print(cnt);
+       io.printf("\n Left 3200 MB count= %d",cnt);     
+
+        bat.unload("Left3200MB");
+        transaction.commit();
+
+       t1 :=  alarm.usec();
+       t2 := t1-t0;
+       io.printf("\n Time for 3.2GB left - %d \n",t2);
+
+        return b;
+end initializeLeft3200MB;
+
+function initializeNewLeft3200MB{unsafe}():bat[:oid,:lng];
+        
+       t0 :=  alarm.usec();
+        b:= bat.new(:oid,:lng);
+        bat.setPersistent(b,true);
+        bat.setName(b, "NewLeft3200MB");
+
+       io.printf("\n New Left 3200MB started");
+        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,400000000:lng);
+        exit i;
+        cnt := aggr.count(b);
+#        io.print(cnt);
+       io.printf("\n Left 3200 MB count= %d",cnt);     
+
+        bat.unload("NewLeft3200MB");
+        transaction.commit();
+
+       t1 :=  alarm.usec();
+       t2 := t1-t0;
+       io.printf("\n Time for 3.2GB left - %d \n",t2);
+
+        return b;
+end initializeNewLeft3200MB;
+
+function initBatCreate{unsafe}();
+
+#      a := initializeLeft640MB();
+#      a: = initializeLeft2000MB();
+#      a := initializeLeft3200MB();
+#      a := initializeNewLeft3200MB();
+
+end initBatCreate;
+
+function initialize{unsafe}():bat[:oid,:lng];
+
+#      b:bat[:oid,:lng] := bat.load("Left3200MB");
+#      bat.setTransient(b);
+
+       cnt := aggr.count(b);
+       io.printf("\nLeft count %d\n",cnt);
+
+        return b;
+end initialize;
+
+function query(b:bat[:oid,:lng]):lng;
+        profiler.activate("ticks");
+        profiler.activate("thread");
+        profiler.activate("stmt");
+        profiler.activate("time");
+        profiler.setAll();
+#       profiler.start();
+
+        t0:= alarm.usec();
+        s1:= nil:bat[:oid,:oid];
+
+barrier z:= language.dataflow();
+       s1 := algebra.subselect(b,1:lng,999999:lng,true,true,false);
+
+exit z;
+        t1:= alarm.usec();
+        cnt := aggr.count(s1);
+        io.print(cnt);
+
+       stmt:= profiler.getTrace("stmt");
+       ticks:= profiler.getTrace("ticks");
+       thread:= profiler.getTrace("thread");
+       time1:= profiler.getTrace("time");
+#      io.print(time1,thread,ticks,stmt);
+#       profiler.stop();
+
+       return query := t1-t0;
+end query;
+
+optimizer.multicore("user","query");
+function testrun();
+        t0:= alarm.usec();
+        b:= initialize();
+        bat.setReadMode(b);
+#       cnt := aggr.count(b);
+#       io.print(cnt);
+
+barrier step:=0;
+       t2:= user.query(b);
+        io.printf("%d %d\n",step,t2);
+        redo step:= iterator.next(1,20);
+exit step;
+
+end testrun;
+
+#################################### Instructions 
#######################################
+
+#Call this function during first run keeping the testrun call below commented, 
to create a persistent bat
+
+#initBatCreate();
+
+#In the second run, comment initBatCreate call above and uncomment testrun 
call below to invoke it. Cardinality count will be different for different runs.
+#In the third run keeping the initBatCreate commented, and testrun 
uncommented, also uncomment the bat.setTransient in the initialize function to 
get correct cardinality count.
+
+#testrun();
+
+       
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to