diff options
author | Matei Zaharia <matei@eecs.berkeley.edu> | 2011-02-01 15:11:08 -0800 |
---|---|---|
committer | Matei Zaharia <matei@eecs.berkeley.edu> | 2011-02-01 15:11:08 -0800 |
commit | e5c4cd8a5e188592f8786a265c0cd073c69ac886 (patch) | |
tree | 031c4f814372a818f7574cfac84f1fc4749bd9d3 /examples/src/main/scala/BroadcastTest.scala | |
parent | dcfa2ce83bf884008b4e8c02e923da1e49027ba4 (diff) | |
download | spark-e5c4cd8a5e188592f8786a265c0cd073c69ac886.tar.gz spark-e5c4cd8a5e188592f8786a265c0cd073c69ac886.tar.bz2 spark-e5c4cd8a5e188592f8786a265c0cd073c69ac886.zip |
Made examples and core subprojects
Diffstat (limited to 'examples/src/main/scala/BroadcastTest.scala')
-rw-r--r-- | examples/src/main/scala/BroadcastTest.scala | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/examples/src/main/scala/BroadcastTest.scala b/examples/src/main/scala/BroadcastTest.scala new file mode 100644 index 0000000000..40c2be8f6d --- /dev/null +++ b/examples/src/main/scala/BroadcastTest.scala @@ -0,0 +1,28 @@ +import spark.SparkContext + +object BroadcastTest { + def main(args: Array[String]) { + if (args.length == 0) { + System.err.println("Usage: BroadcastTest <host> [<slices>]") + System.exit(1) + } + val spark = new SparkContext(args(0), "Broadcast Test") + val slices = if (args.length > 1) args(1).toInt else 2 + val num = if (args.length > 2) args(2).toInt else 1000000 + + var arr1 = new Array[Int](num) + for (i <- 0 until arr1.length) + arr1(i) = i + +// var arr2 = new Array[Int](num * 2) +// for (i <- 0 until arr2.length) +// arr2(i) = i + + val barr1 = spark.broadcast(arr1) +// val barr2 = spark.broadcast(arr2) + spark.parallelize(1 to 10, slices).foreach { +// i => println(barr1.value.size + barr2.value.size) + i => println(barr1.value.size) + } + } +} |