Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
e73a5f34
Commit
e73a5f34
authored
14 years ago
by
Mosharaf Chowdhury
Browse files
Options
Downloads
Patches
Plain Diff
Now compiles with Scala 2.8.0, but doesn't run with nexus.jar
Must update it to use mesos.jar
parent
0da5b00d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/examples/BroadcastTest.scala
+12
-11
12 additions, 11 deletions
src/examples/BroadcastTest.scala
src/examples/LocalFileLR.scala
+1
-1
1 addition, 1 deletion
src/examples/LocalFileLR.scala
src/scala/spark/SparkContext.scala
+2
-2
2 additions, 2 deletions
src/scala/spark/SparkContext.scala
with
15 additions
and
14 deletions
src/examples/BroadcastTest.scala
+
12
−
11
View file @
e73a5f34
...
...
@@ -3,25 +3,26 @@ import spark.SparkContext
object
BroadcastTest
{
def
main
(
args
:
Array
[
String
])
{
if
(
args
.
length
==
0
)
{
System
.
err
.
println
(
"Usage: BroadcastTest <host> [<slices>]
[<array-len>]
"
)
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
arr
=
new
Array
[
Int
](
num
)
for
(
i
<-
0
until
arr
.
length
)
arr
(
i
)
=
i
var
arr
1
=
new
Array
[
Int
](
num
)
for
(
i
<-
0
until
arr
1
.
length
)
arr
1
(
i
)
=
i
val
start
=
System
.
nanoTime
val
barr
=
spark
.
broadcast
(
arr
)
// 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
{
println
(
"in task: barr = "
+
barr
)
i
=>
println
(
barr
.
value
.
size
)
//
i =>
println(
barr1.value.size + barr2.value.size
)
i
=>
println
(
barr
1
.
value
.
size
)
}
val
time
=
(
System
.
nanoTime
-
start
)
/
1
e9
println
(
"BroadcastTest took "
+
time
+
" s"
)
}
}
This diff is collapsed.
Click to expand it.
src/examples/LocalFileLR.scala
+
1
−
1
View file @
e73a5f34
...
...
@@ -13,7 +13,7 @@ object LocalFileLR {
}
def
main
(
args
:
Array
[
String
])
{
val
lines
=
scala
.
io
.
Source
.
from
Path
(
args
(
0
)).
getLines
()
val
lines
=
scala
.
io
.
Source
.
from
File
(
args
(
0
)).
getLines
()
val
points
=
lines
.
map
(
parsePoint
_
)
val
ITERATIONS
=
args
(
1
).
toInt
...
...
This diff is collapsed.
Click to expand it.
src/scala/spark/SparkContext.scala
+
2
−
2
View file @
e73a5f34
...
...
@@ -18,8 +18,8 @@ class SparkContext(master: String, frameworkName: String) {
new
Accumulator
(
initialValue
,
param
)
// TODO: Keep around a weak hash map of values to Cached versions?
def
broadcast
[
T
](
value
:
T
)
=
new
CentralizedHDFSBroadcast
(
value
,
local
)
//
def broadcast[T](value: T) = new ChainedStreamingBroadcast(value, local)
//
def broadcast[T](value: T) = new CentralizedHDFSBroadcast(value, local)
def
broadcast
[
T
](
value
:
T
)
=
new
ChainedStreamingBroadcast
(
value
,
local
)
def
textFile
(
path
:
String
)
=
new
HdfsTextFile
(
this
,
path
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment