Skip to content

Commit a1c7039

Browse files
committed
Minor changes
1 parent ccc3ce8 commit a1c7039

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/scala/SparkJob.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class SparkJob(val padding: Int = 3,
3939
val splitted = splitImage(inputMatrix)
4040

4141
// Make RDD of matrixes
42-
val matrixes = sc.parallelize(splitted._1, splitted._2 * splitted._3)
42+
val matrixes = sc.parallelize(splitted._1.seq, splitted._2 * splitted._3)
4343
matrixes.partitionBy(new HashPartitioner(splitted._2 * splitted._3)).persist(StorageLevel.MEMORY_ONLY)
4444
val computed = compute(matrixes, pipeline)
4545

@@ -58,7 +58,7 @@ class SparkJob(val padding: Int = 3,
5858
* @param pixelMatrix input matrix
5959
* @return Seq[((i,j), matrix)]
6060
*/
61-
private def splitImage(pixelMatrix: BDM[Double]): (Seq[((Int, Int), Matrix)], Int, Int) = {
61+
private def splitImage(pixelMatrix: BDM[Double]): (ParSeq[((Int, Int), Matrix)], Int, Int) = {
6262
val subHeight = if(this.subHeight <= 0) pixelMatrix.rows else this.subHeight
6363
val subWidth = if(this.subWidth <= 0) pixelMatrix.cols else this.subWidth
6464
assert(padding <= subHeight)
@@ -95,8 +95,8 @@ class SparkJob(val padding: Int = 3,
9595
}
9696
// For each pair of matrix elements crop the input matrix
9797
(for {
98-
p1 <- (0 until n) // X
99-
p2 <- (0 until m) // Y
98+
p1 <- (0 until n).par // X
99+
p2 <- (0 until m).par // Y
100100
} yield {
101101
val xFromPadded = p1 * subWidth
102102
val xToPadded = xFromPadded + subWidth + padding*2 -1

0 commit comments

Comments
 (0)