Skip to content

Commit 2378137

Browse files
committed
Parallelize rollupstats computation in DataInfo constructors.
1 parent 4b3089c commit 2378137

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/hex/FrameTask.java

+9
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ private DataInfo(Frame fr, int[][] catLevels, int responses, TransformType predi
257257
_catOffsets = MemoryManager.malloc4(catLevels.length+1);
258258
_catMissing = new int[catLevels.length];
259259
int s = 0;
260+
// compute rollupstats in parallel
261+
Futures fs = new Futures();
262+
for (Vec v : fr.vecs()) v.rollupStats(fs);
263+
fs.blockForPending();
260264

261265
for(int i = 0; i < catLevels.length; ++i){
262266
_catOffsets[i] = s;
@@ -320,6 +324,11 @@ public DataInfo(Frame fr, int nResponses, boolean useAllFactorLevels, TransformT
320324
_useAllFactorLevels = useAllFactorLevels;
321325
_catLvls = null;
322326
final Vec [] vecs = fr.vecs();
327+
// compute rollupstats in parallel
328+
Futures fs = new Futures();
329+
for (Vec v : vecs) v.rollupStats(fs);
330+
fs.blockForPending();
331+
323332
final int n = vecs.length-_responses;
324333
if (n < 1) throw new IllegalArgumentException("Training data must have at least one column.");
325334
int [] nums = MemoryManager.malloc4(n);

0 commit comments

Comments
 (0)