Skip to content

[SPARK-1535] ALS: Avoid the garbage-creating ctor of DoubleMatrix - #442

Closed
tmyklebu wants to merge 2 commits into
apache:masterfrom
tmyklebu:foo2
Closed

tmyklebu wants to merge 2 commits into
apache:masterfrom
tmyklebu:foo2

Conversation

@tmyklebu

Copy link
Copy Markdown
Contributor

new DoubleMatrix(double[]) creates a garbage double[] of the same length as its argument and immediately throws it away. This pull request avoids that constructor in the ALS code.

@AmplabJenkins

Copy link
Copy Markdown

Merged build triggered.

@AmplabJenkins

Copy link
Copy Markdown

Merged build started.

@AmplabJenkins

Copy link
Copy Markdown

Merged build finished.

@AmplabJenkins

Copy link
Copy Markdown

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

@tmyklebu

Copy link
Copy Markdown
Contributor Author

This appears to be a PySpark error unrelated to my change.

@srowen

srowen commented Apr 18, 2014

Copy link
Copy Markdown
Member

+1 BTW I submitted a fix for this in jblas, although it is not yet released.

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.

put a space after :

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(PS might also note in the comment that it's safe to go back to the old DoubleMatrix constructor at jblas 1.2.4 or later.)

@mengxr

mengxr commented Apr 18, 2014

Copy link
Copy Markdown
Contributor

@tmyklebu Thanks for fixing this! Could you create a JIRA?

@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/14238/

@tmyklebu

Copy link
Copy Markdown
Contributor Author

[SPARK-1535] describes the issue and the form of the fix.

@mengxr

mengxr commented Apr 18, 2014

Copy link
Copy Markdown
Contributor

@tmyklebu Could you add the JIRA number to the title of this PR? It makes life easier for people who merge the code.

@tmyklebu tmyklebu changed the title ALS: Avoid the garbage-creating ctor of DoubleMatrix [SPARK-1535] ALS: Avoid the garbage-creating ctor of DoubleMatrix Apr 18, 2014
@mengxr

mengxr commented Apr 19, 2014

Copy link
Copy Markdown
Contributor

LGTM. Thanks for fixing it! @mateiz Could you help merge this into both master and branch-1.0?

@tmyklebu

Copy link
Copy Markdown
Contributor Author

@srowen: Does Hotspot actually generate code for the allocation and the dead store with the bad ctor? I haven't picked through it yet.

@srowen

srowen commented Apr 19, 2014

Copy link
Copy Markdown
Member

I doubt Hotspot can remove this allocation, but am not sure. It would have to do a couple things -- inline the call to 2 other constructors, realize there's no threading issue in the constructor, realize the dead store. I think it's worth avoiding manually here.

@mateiz

mateiz commented Apr 19, 2014

Copy link
Copy Markdown
Contributor

Merged into master and branch 1.0, thanks!

asfgit pushed a commit that referenced this pull request Apr 19, 2014
`new DoubleMatrix(double[])` creates a garbage `double[]` of the same length as its argument and immediately throws it away.  This pull request avoids that constructor in the ALS code.

Author: Tor Myklebust <tmyklebu@gmail.com>

Closes #442 from tmyklebu/foo2 and squashes the following commits:

2784fc5 [Tor Myklebust] Mention that this is probably fixed as of jblas 1.2.4; repunctuate.
a09904f [Tor Myklebust] Helper function for wrapping Array[Double]'s with DoubleMatrix's.

(cherry picked from commit 25fc318)
Signed-off-by: Matei Zaharia <matei@databricks.com>
@asfgit asfgit closed this in 25fc318 Apr 19, 2014
pwendell added a commit to pwendell/spark that referenced this pull request May 12, 2014
Workers should use working directory as spark home if it's not specified

If users don't set SPARK_HOME in their environment file when launching an application, the standalone cluster should default to the spark home of the worker.
pdeyhim pushed a commit to pdeyhim/spark-1 that referenced this pull request Jun 25, 2014
`new DoubleMatrix(double[])` creates a garbage `double[]` of the same length as its argument and immediately throws it away.  This pull request avoids that constructor in the ALS code.

Author: Tor Myklebust <tmyklebu@gmail.com>

Closes apache#442 from tmyklebu/foo2 and squashes the following commits:

2784fc5 [Tor Myklebust] Mention that this is probably fixed as of jblas 1.2.4; repunctuate.
a09904f [Tor Myklebust] Helper function for wrapping Array[Double]'s with DoubleMatrix's.
andrewor14 pushed a commit to andrewor14/spark that referenced this pull request Jan 8, 2015
Workers should use working directory as spark home if it's not specified

If users don't set SPARK_HOME in their environment file when launching an application, the standalone cluster should default to the spark home of the worker.
(cherry picked from commit 59f475c)

Signed-off-by: Patrick Wendell <pwendell@gmail.com>
markhamstra pushed a commit to markhamstra/spark that referenced this pull request Nov 7, 2017
Required for ./dev/check-license to pass
bzhaoopenstack pushed a commit to bzhaoopenstack/spark that referenced this pull request Sep 11, 2019
Fix error of running trovestack in openlab job
arjunshroff pushed a commit to arjunshroff/spark that referenced this pull request Nov 24, 2020
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.

5 participants