Skip to content

Commit 3e55f99

Browse files
committed
[SYSTEMDS-3644] Compressed transform encode
1 parent 8f5a42c commit 3e55f99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1428
-594
lines changed

src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupIO.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ public static long getExactSizeOnDisk(List<AColGroup> colGroups) {
9494
}
9595
ret += grp.getExactSizeOnDisk();
9696
}
97-
LOG.error(" duplicate dicts on exact Size on Disk : " + (colGroups.size() - dicts.size()) );
97+
if(LOG.isWarnEnabled())
98+
LOG.warn(" duplicate dicts on exact Size on Disk : " + (colGroups.size() - dicts.size()) );
99+
98100
return ret;
99101
}
100102

src/main/java/org/apache/sysds/runtime/compress/lib/CLALibDecompress.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ private static MatrixBlock decompressExecute(CompressedMatrixBlock cmb, int k) {
237237
if(ret.isInSparseFormat())
238238
decompressSparseSingleThread(ret, filteredGroups, nRows, blklen);
239239
else
240-
decompressDenseSingleThread(ret, filteredGroups, nRows, blklen, constV, eps, nonZeros, overlapping);
240+
decompressDenseSingleThread(ret, filteredGroups, nRows, blklen, constV, eps, overlapping);
241241
}
242242
else if(ret.isInSparseFormat())
243243
decompressSparseMultiThread(ret, filteredGroups, nRows, blklen, k);
@@ -294,7 +294,7 @@ private static void decompressSparseSingleThread(MatrixBlock ret, List<AColGroup
294294
}
295295

296296
private static void decompressDenseSingleThread(MatrixBlock ret, List<AColGroup> filteredGroups, int rlen,
297-
int blklen, double[] constV, double eps, long nonZeros, boolean overlapping) {
297+
int blklen, double[] constV, double eps, boolean overlapping) {
298298

299299
final DenseBlock db = ret.getDenseBlock();
300300
final int nCol = ret.getNumColumns();
@@ -308,21 +308,19 @@ private static void decompressDenseSingleThread(MatrixBlock ret, List<AColGroup>
308308
}
309309
}
310310

311-
// private static void decompressDenseMultiThread(MatrixBlock ret, List<AColGroup> groups, double[] constV, int k,
312-
// boolean overlapping) {
313-
// final int nRows = ret.getNumRows();
314-
// final double eps = getEps(constV);
315-
// final int blklen = Math.max(nRows / k, 512);
316-
// decompressDenseMultiThread(ret, groups, nRows, blklen, constV, eps, k, overlapping);
317-
// }
318-
319-
protected static void decompressDenseMultiThread(MatrixBlock ret, List<AColGroup> groups, double[] constV,
311+
public static void decompressDense(MatrixBlock ret, List<AColGroup> groups, double[] constV,
320312
double eps, int k, boolean overlapping) {
321313

322314
Timing time = new Timing(true);
323315
final int nRows = ret.getNumRows();
324316
final int blklen = Math.max(nRows / k, 512);
325-
decompressDenseMultiThread(ret, groups, nRows, blklen, constV, eps, k, overlapping);
317+
if( k > 1)
318+
decompressDenseMultiThread(ret, groups, nRows, blklen, constV, eps, k, overlapping);
319+
else
320+
decompressDenseSingleThread(ret, groups, nRows, blklen, constV, eps, overlapping);
321+
322+
ret.recomputeNonZeros(k);
323+
326324
if(DMLScript.STATISTICS) {
327325
final double t = time.stop();
328326
DMLCompressionStatistics.addDecompressTime(t, k);

src/main/java/org/apache/sysds/runtime/compress/lib/CLALibRightMultBy.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,8 @@ private static MatrixBlock RMM(CompressedMatrixBlock m1, MatrixBlock that, int k
189189
constV = mmTemp.isEmpty() ? null : mmTemp.getDenseBlockValues();
190190
}
191191

192-
final Timing time = new Timing(true);
193-
194192
ret = asyncRet(f);
195-
CLALibDecompress.decompressDenseMultiThread(ret, retCg, constV, 0, k, true);
196-
197-
if(DMLScript.STATISTICS) {
198-
final double t = time.stop();
199-
DMLCompressionStatistics.addDecompressTime(t, k);
200-
}
193+
CLALibDecompress.decompressDense(ret, retCg, constV, 0, k, true);
201194

202195
return ret;
203196
}

src/main/java/org/apache/sysds/runtime/frame/data/FrameBlock.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,8 +1267,8 @@ public void copy(int rl, int ru, int cl, int cu, FrameBlock src) {
12671267
* @param col is the column # from frame data which contains Recode map generated earlier.
12681268
* @return map of token and code for every element in the input column of a frame containing Recode map
12691269
*/
1270-
public Map<Object, Long> getRecodeMap(int col) {
1271-
return _coldata[col].getRecodeMap();
1270+
public Map<Object, Integer> getRecodeMap(int col) {
1271+
return _coldata[col].getRecodeMap(4);
12721272
}
12731273

12741274
@Override

src/main/java/org/apache/sysds/runtime/frame/data/columns/ABooleanArray.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import java.util.HashMap;
2323
import java.util.Map;
24+
import java.util.concurrent.ExecutorService;
2425

2526
public abstract class ABooleanArray extends Array<Boolean> {
2627

@@ -55,13 +56,14 @@ public boolean possiblyContainsNaN() {
5556
* @param value The string array to set from.
5657
*/
5758
public abstract void setNullsFromString(int rl, int ru, Array<String> value);
58-
59+
60+
5961
@Override
60-
protected Map<Boolean, Long> createRecodeMap() {
61-
Map<Boolean, Long> map = new HashMap<>();
62-
long id = 1;
62+
protected Map<Boolean, Integer> createRecodeMap(int estimate, ExecutorService pool) {
63+
Map<Boolean, Integer> map = new HashMap<>();
64+
int id = 1;
6365
for(int i = 0; i < size() && id <= 2; i++) {
64-
Long v = map.putIfAbsent(get(i), id);
66+
Integer v = map.putIfAbsent(get(i), id);
6567
if(v == null)
6668
id++;
6769
}

src/main/java/org/apache/sysds/runtime/frame/data/columns/ACompressedArray.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ public void setFromOtherType(int rl, int ru, Array<?> value) {
5959
throw new DMLCompressionException("Invalid to set value in CompressedArray");
6060
}
6161

62-
@Override
63-
public void set(int rl, int ru, Array<T> value, int rlSrc) {
64-
throw new DMLCompressionException("Invalid to set value in CompressedArray");
65-
}
66-
6762
@Override
6863
public void setNz(int rl, int ru, Array<T> value) {
6964
throw new DMLCompressionException("Invalid to set value in CompressedArray");

0 commit comments

Comments
 (0)