3030import org .apache .sysds .runtime .transform .encode .EncoderFactory ;
3131import org .apache .sysds .runtime .transform .encode .MultiColumnEncoder ;
3232import org .apache .sysds .test .TestUtils ;
33+ import org .apache .sysds .utils .stats .InfrastructureAnalyzer ;
3334
3435public class Transform extends APerfTest <Object , FrameBlock > {
3536
@@ -41,32 +42,33 @@ public Transform(int N, IGenerate<FrameBlock> gen, int k, String spec) {
4142 this .k = k ;
4243 this .spec = spec ;
4344 FrameBlock in = gen .take ();
44- System .out .println ("Transform Encode Perf: rows: " + in .getNumRows () + " schema:" + Arrays .toString (in .getSchema ()));
45+ System .out
46+ .println ("Transform Encode Perf: rows: " + in .getNumRows () + " schema:" + Arrays .toString (in .getSchema ()));
4547 System .out .println (spec );
4648 }
4749
4850 public void run () throws Exception {
4951 execute (() -> te (), () -> clear (), "Normal" );
5052 execute (() -> tec (), () -> clear (), "Compressed" );
51- execute (() -> te (), () -> clear (), "Normal" );
52- execute (() -> tec (), () -> clear (), "Compressed" );
53+ // execute(() -> te(), () -> clear(), "Normal");
54+ // execute(() -> tec(), () -> clear(), "Compressed");
5355 }
5456
55- private void te (){
57+ private void te () {
5658 FrameBlock in = gen .take ();
5759 MultiColumnEncoder enc = EncoderFactory .createEncoder (spec , in .getNumColumns ());
5860 enc .encode (in , k );
5961 ret .add (null );
6062 }
6163
62- private void tec (){
64+ private void tec () {
6365 FrameBlock in = gen .take ();
6466 MultiColumnEncoder enc = EncoderFactory .createEncoder (spec , in .getNumColumns ());
6567 enc .encode (in , k , true );
6668 ret .add (null );
6769 }
6870
69- private void clear (){
71+ private void clear () {
7072 clearRDCCache (gen .take ());
7173 }
7274
@@ -75,29 +77,64 @@ protected String makeResString() {
7577 return "" ;
7678 }
7779
78-
79- /**
80+ /**
8081 * Forcefully clear recode cache of underlying arrays
8182 */
82- public void clearRDCCache (FrameBlock f ){
83+ public void clearRDCCache (FrameBlock f ) {
8384 for (Array <?> a : f .getColumns ())
8485 a .setCache (null );
8586 }
8687
87-
8888 public static void main (String [] args ) throws Exception {
89- for (int i = 1 ; i < 100 ; i *= 10 ){
89+ int k = InfrastructureAnalyzer .getLocalParallelism ();
90+ for (int i = 1 ; i < 100 ; i *= 10 ) {
91+
92+ FrameBlock in = TestUtils .generateRandomFrameBlock (100000 * i , new ValueType [] {ValueType .UINT4 }, 32 );
9093
91- FrameBlock in = TestUtils .generateRandomFrameBlock (100000 * i , new ValueType []{ValueType .UINT4 }, 32 );
92- System .out .println (Arrays .toString (in .getColumnNames ()));
9394 ConstFrame gen = new ConstFrame (in );
94- // passthrough
95- new Transform (300 , gen , 16 , "{}" ).run ();
96- new Transform (300 , gen , 16 , "{ids:true, recode:[1]}" ).run ();
97- new Transform (300 , gen , 16 , "{ids:true, bin:[{id:1, method:equi-width, numbins:4}]}" ).run ();
98- new Transform (300 , gen , 16 , "{ids:true, bin:[{id:1, method:equi-width, numbins:4}], dummycode:[1]}" ).run ();
99- new Transform (300 , gen , 16 , "{ids:true, hash:[1], K:10}" ).run ();
100- new Transform (300 , gen , 16 , "{ids:true, hash:[1], K:10, dummycode:[1]}" ).run ();
95+ // // passthrough
96+ new Transform (300 , gen , k , "{}" ).run ();
97+ new Transform (300 , gen , k , "{ids:true, recode:[1]}" ).run ();
98+ new Transform (300 , gen , k , "{ids:true, bin:[{id:1, method:equi-width, numbins:4}]}" ).run ();
99+ new Transform (300 , gen , k , "{ids:true, bin:[{id:1, method:equi-width, numbins:4}], dummycode:[1]}" ).run ();
100+ new Transform (300 , gen , k , "{ids:true, hash:[1], K:10}" ).run ();
101+ new Transform (300 , gen , k , "{ids:true, hash:[1], K:10, dummycode:[1]}" ).run ();
102+
103+ in = TestUtils .generateRandomFrameBlock (
104+ 100000 * i , new ValueType [] {ValueType .UINT4 , ValueType .UINT4 , ValueType .UINT4 , ValueType .UINT4 ,
105+ ValueType .UINT4 , ValueType .UINT4 , ValueType .UINT4 , ValueType .UINT4 , ValueType .UINT4 , ValueType .UINT4 },
106+ 32 );
107+
108+ gen = new ConstFrame (in );
109+ new Transform (300 , gen , k , "{}" ).run ();
110+ new Transform (300 , gen , k , "{ids:true, recode:[1,2,3,4,5,6,7,8,9,10]}" ).run ();
111+ new Transform (300 , gen , k , "{ids:true, bin:[" //
112+ + "\n {id:1, method:equi-width, numbins:4}," //
113+ + "\n {id:2, method:equi-width, numbins:4}," //
114+ + "\n {id:3, method:equi-width, numbins:4}," //
115+ + "\n {id:4, method:equi-width, numbins:4}," //
116+ + "\n {id:5, method:equi-width, numbins:4}," //
117+ + "\n {id:6, method:equi-width, numbins:4}," //
118+ + "\n {id:7, method:equi-width, numbins:4}," //
119+ + "\n {id:8, method:equi-width, numbins:4}," //
120+ + "\n {id:9, method:equi-width, numbins:4}," //
121+ + "\n {id:10, method:equi-width, numbins:4}," //
122+ + "]}" ).run ();
123+ new Transform (300 , gen , k , "{ids:true, bin:[" //
124+ + "\n {id:1, method:equi-width, numbins:4}," //
125+ + "\n {id:2, method:equi-width, numbins:4}," //
126+ + "\n {id:3, method:equi-width, numbins:4}," //
127+ + "\n {id:4, method:equi-width, numbins:4}," //
128+ + "\n {id:5, method:equi-width, numbins:4}," //
129+ + "\n {id:6, method:equi-width, numbins:4}," //
130+ + "\n {id:7, method:equi-width, numbins:4}," //
131+ + "\n {id:8, method:equi-width, numbins:4}," //
132+ + "\n {id:9, method:equi-width, numbins:4}," //
133+ + "\n {id:10, method:equi-width, numbins:4}," //
134+ + "], dummycode:[1,2,3,4,5,6,7,8,9,10]}" ).run ();
135+ new Transform (300 , gen , k , "{ids:true, hash:[1,2,3,4,5,6,7,8,9,10], K:10}" ).run ();
136+ new Transform (300 , gen , k , "{ids:true, hash:[1,2,3,4,5,6,7,8,9,10], K:10, dummycode:[1,2,3,4,5,6,7,8,9,10]}" ).run ();
137+
101138 }
102139
103140 System .exit (0 ); // forcefully stop.
0 commit comments