Skip to content

[SPARK-1580] Estimate ALS communication and computation costs. - #493

Closed
tmyklebu wants to merge 24 commits into
apache:masterfrom
tmyklebu:alscost
Closed

tmyklebu wants to merge 24 commits into
apache:masterfrom
tmyklebu:alscost

Conversation

@tmyklebu

Copy link
Copy Markdown
Contributor

This pull request adds a function evaluatePartitioner to the ALS object. This function takes a dataset, a rank, and user and product Partitioners and returns estimates of the communication cost (in bytes) and computation cost (currently roughly in flops) of a single iteration of alternating least squares.

The communication cost estimate considers only the number of bytes needed for the data in the feature vectors. It does not consider the InLinkBlocks or OutLinkBlocks or array headers for the feature vectors or anything. It also is oblivious to compression. Thus it is inaccurate. However, the changes in this pull request are sufficient to meet the goals described in [SPARK-1580] and, for better or worse, are independent of those particular implementation details.

Likewise, the computation cost estimate considers only the number of floating-point operations needed to form and factorise the matrices that come up. No attention is paid to loop overhead or any other vagaries of the current implementation.

This pull request also appears to contain a bunch of commits that have already made it into trunk. I'm not really sure why that's the case or how to fix it; I'd appreciate guidance.

@AmplabJenkins

Copy link
Copy Markdown

Merged build triggered.

@AmplabJenkins

Copy link
Copy Markdown

Merged build started.

@tmyklebu

Copy link
Copy Markdown
Contributor Author

I also want to start a conversation here on how we want to test this. Certainly I should add test cases here, but I'm unsure of what exactly to test here.

It may make sense, at some point, to tweak the coefficients for outer products and Choleskies in the computation cost estimate, for instance, or to refine the communication cost estimate somehow. Small, explicit test case with a couple of users and a couple of products that checks for specific values would pose something of a nuisance to whoever is doing that tweaking. I'm not quite sure how to write a test encapsulating "the asymptotic behaviour of the computation cost ought to look like numRatings * rank^2 + (users + products) * rank^3" that wouldn't itself pose such a nuisance.

@AmplabJenkins

Copy link
Copy Markdown

Merged build finished. All automated tests passed.

@AmplabJenkins

Copy link
Copy Markdown

All automated tests passed.
Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/14352/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of summing the cost, we should show partition-wise cost in order to check the load balancing. Same for communication.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a pretty good idea. Implemented.

@AmplabJenkins

Copy link
Copy Markdown

Merged build triggered.

@AmplabJenkins

Copy link
Copy Markdown

Merged build started.

@AmplabJenkins

Copy link
Copy Markdown

Merged build finished. All automated tests passed.

@AmplabJenkins

Copy link
Copy Markdown

All automated tests passed.
Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/14387/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ArrayBuffer is always mutable, but BitSet/HashSet/HashMap have two versions. Import scala.collection.mutable and use mutable.BitSet, mutable.HashSet, and mutable.HashMap in code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving the BitSet alone for now; that's a different piece of code. Doing that for HashSet and HashMap.

@AmplabJenkins

Copy link
Copy Markdown

Build triggered.

@AmplabJenkins

Copy link
Copy Markdown

Build started.

@AmplabJenkins

Copy link
Copy Markdown

Build triggered.

@AmplabJenkins

Copy link
Copy Markdown

Build started.

@AmplabJenkins

Copy link
Copy Markdown

Build finished.

1 similar comment
@AmplabJenkins

Copy link
Copy Markdown

Build finished.

@AmplabJenkins

Copy link
Copy Markdown

Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/14613/

@AmplabJenkins

Copy link
Copy Markdown

Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/14612/

@tmyklebu

tmyklebu commented May 2, 2014

Copy link
Copy Markdown
Contributor Author

StreamingContextSuite's "stop gracefully" test failed here.

@mengxr

mengxr commented May 2, 2014

Copy link
Copy Markdown
Contributor

@tmyklebu The "Address already in use" message is an exception captured in an WARN message. It is not a test failure. But "stop gracefully is ...

@tmyklebu

tmyklebu commented May 2, 2014

Copy link
Copy Markdown
Contributor Author

Point being that Jenkins tests have failed repeatedly, apparently for reasons that have nothing to do with this change. (The BindException was the first weird thing I saw in that log, but it seems to happen all the time. The last weird thing is the OOME during VM teardown.)

pwendell pushed a commit to pwendell/spark that referenced this pull request May 12, 2014
Fixed bug where task set managers are added to queue twice

@mateiz can you verify that this is a bug and wasn't intentional? (https://github.com/apache/incubator-spark/commit/90a04dab8d9a2a9a372cea7cdf46cc0fd0f2f76c#diff-7fa4f84a961750c374f2120ca70e96edR551)

This bug leads to a small performance hit because task
set managers will get offered each rejected resource
offer twice, but doesn't lead to any incorrect functionality.

Thanks to @hdc1112 for pointing this out.
gzm55 pushed a commit to MediaV/spark that referenced this pull request Jul 17, 2014
Fixed bug where task set managers are added to queue twice

@mateiz can you verify that this is a bug and wasn't intentional? (https://github.com/apache/incubator-spark/commit/90a04dab8d9a2a9a372cea7cdf46cc0fd0f2f76c#diff-7fa4f84a961750c374f2120ca70e96edR551)

This bug leads to a small performance hit because task
set managers will get offered each rejected resource
offer twice, but doesn't lead to any incorrect functionality.

Thanks to @hdc1112 for pointing this out.
(cherry picked from commit 5bcfd79)

Signed-off-by: Patrick Wendell <pwendell@gmail.com>
@pwendell

Copy link
Copy Markdown
Contributor

@tmyklebu could you put [MLlib] in the title here? Otherwise it doesn't get properly filtered by our tools. That might be why it hasn't been looked at.

@asfgit asfgit closed this in e25ec06 Aug 2, 2014
xiliu82 pushed a commit to xiliu82/spark that referenced this pull request Sep 4, 2014
Continue the work from apache#493.

Closes apache#493 and Closes apache#593

Author: Tor Myklebust <tmyklebu@gmail.com>
Author: Xiangrui Meng <meng@databricks.com>

Closes apache#1731 from mengxr/tmyklebu-alscost and squashes the following commits:

9b56a8b [Xiangrui Meng] updated API and added a simple test
68a3229 [Xiangrui Meng] merge master
217bd1d [Tor Myklebust] Documentation and choleskies -> subproblems.
8cbb718 [Tor Myklebust] Braces get spaces.
0455cd4 [Tor Myklebust] Parens for collectAsMap.
2b2febe [Tor Myklebust] Use `makeLinkRDDs` when estimating costs.
2ab7a5d [Tor Myklebust] Reindent estimateCost's declaration and make it return Seqs.
8b21e6d [Tor Myklebust] Fix overlong lines.
8cbebf1 [Tor Myklebust] Rename and clean up the return format of cost estimator.
6615ed5 [Tor Myklebust] It's more useful to give per-partition estimates.  Do that.
5530678 [Tor Myklebust] Merge branch 'master' of https://github.com/apache/spark into alscost
6c31324 [Tor Myklebust] Make it actually build...
a1184d1 [Tor Myklebust] Mark ALS.evaluatePartitioner DeveloperApi.
657a71b [Tor Myklebust] Simple-minded estimates of computation and communication costs in ALS.
dcf583a [Tor Myklebust] Remove the partitioner member variable; instead, thread that needle everywhere it needs to go.
23d6f91 [Tor Myklebust] Stop making the partitioner configurable.
495784f [Tor Myklebust] Merge branch 'master' of https://github.com/apache/spark
674933a [Tor Myklebust] Fix style.
40edc23 [Tor Myklebust] Fix missing space.
f841345 [Tor Myklebust] Fix daft bug creating 'pairs', also for -> foreach.
5ec9e6c [Tor Myklebust] Clean a couple of things up using 'map'.
36a0f43 [Tor Myklebust] Make the partitioner private.
d872b09 [Tor Myklebust] Add negative id ALS test.
df27697 [Tor Myklebust] Support custom partitioners.  Currently we use the same partitioner for users and products.
c90b6d8 [Tor Myklebust] Scramble user and product ids before bucketing.
c774d7d [Tor Myklebust] Make the partitioner a member variable and use it instead of modding directly.
andrewor14 pushed a commit to andrewor14/spark that referenced this pull request Jan 8, 2015
Fixed bug where task set managers are added to queue twice

@mateiz can you verify that this is a bug and wasn't intentional? (https://github.com/apache/incubator-spark/commit/90a04dab8d9a2a9a372cea7cdf46cc0fd0f2f76c#diff-7fa4f84a961750c374f2120ca70e96edR551)

This bug leads to a small performance hit because task
set managers will get offered each rejected resource
offer twice, but doesn't lead to any incorrect functionality.

Thanks to @hdc1112 for pointing this out.
(cherry picked from commit 5bcfd79)

Signed-off-by: Patrick Wendell <pwendell@gmail.com>
markhamstra pushed a commit to markhamstra/spark that referenced this pull request Nov 7, 2017
bzhaoopenstack pushed a commit to bzhaoopenstack/spark that referenced this pull request Sep 11, 2019
* [Issue apache#196]Enable GPU AI job
* Fix gpu jobs issue
* Remove the pre GPU env task

This will ignore the CUDA and NVIDIA driver installation when job use
huaweicloud. Now, GPU resources only support Tesla V100 GPU on
huaweicloud with a specific flavor. Using the cloudimage for fitting flavor,
gpu version, driver version and linux kernel version. Periodly uploading the
new gpu version manually for now.
RolatZhang pushed a commit to RolatZhang/spark that referenced this pull request Aug 15, 2022
RolatZhang pushed a commit to RolatZhang/spark that referenced this pull request Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants