-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Spark-RAPIDS-ML PCA #440
Merged
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
49f982e
Update Spark-RAPIDS-ML PCA
rishic3 8c4765a
Reran with standalone
rishic3 8e0d142
Fix typo
rishic3 f3c363e
Delete Scala example, remove mean-centering
rishic3 418526c
Update README
rishic3 76ee00e
Update standalone setup script, README
rishic3 dcb3273
SparkSession init for CI
rishic3 711d6cb
remove sparkcontext
rishic3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Spark-Rapids-ML PCA example | ||
|
||
This is an example of the GPU accelerated PCA algorithm from the [Spark-Rapids-ML](https://github.com/NVIDIA/spark-rapids-ml) library, which provides PySpark ML compatible algorithms powered by RAPIDS cuML. | ||
The notebook uses PCA to reduce a random dataset with 2048 feature dimensions to 3 dimensions. We train both the GPU and CPU algorithms for comparison. | ||
|
||
## Build | ||
|
||
Please refer to the Spark-Rapids-ML [README](https://github.com/NVIDIA/spark-rapids-ml/blob/HEAD/python) for Python build instructions and API usage. | ||
|
||
## Running the Notebooks | ||
|
||
Once you have built your environment, please follow these instructions to run the notebooks. | ||
|
||
**Note**: for demonstration purposes, these examples just use a local Spark Standalone cluster with a single executor, but you should be able to run them on any distributed Spark cluster. | ||
``` | ||
# setup environment variables | ||
export SPARK_HOME=/path/to/spark | ||
export MASTER=spark://$(hostname):7077 | ||
export SPARK_WORKER_INSTANCES=1 | ||
export CORES_PER_WORKER=8 | ||
export PYSPARK_DRIVER_PYTHON=jupyter | ||
export PYSPARK_DRIVER_PYTHON_OPTS='lab' | ||
|
||
# start spark standalone cluster | ||
${SPARK_HOME}/sbin/start-master.sh; ${SPARK_HOME}/sbin/start-worker.sh -c ${CORES_PER_WORKER} -m 16G ${MASTER} | ||
|
||
# start jupyter with pyspark | ||
${SPARK_HOME}/bin/pyspark --master ${MASTER} \ | ||
--driver-memory 10G \ | ||
--executor-memory 8G \ | ||
--conf spark.python.worker.reuse=True | ||
|
||
# BROWSE to localhost:8888 to view/run notebooks | ||
|
||
# stop spark standalone cluster | ||
${SPARK_HOME}/sbin/stop-worker.sh; ${SPARK_HOME}/sbin/stop-master.sh | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If spark is started like this, likely have to add (many of if not all of) the configs now in the notebook cell to this command. You should verify (e.g. enabling the etl plugin, gpu resource per executor, etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most recent commit sets up the standalone cluster and all the configs in a shell script. For CI folks I have a cell that conditionally creates the session if not already initialized - verified this works with
jupyter nbconvert
.Will poke around more though to see if we can avoid some of this code repetition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The complicating factor is that the readme instructions start jupyter with a spark context so some configs need to be set up at the time the spark context is created. CI needs the spark context to be started in the notebook. So some duplication is needed, unless the readme just starts normal jupyter server (without spark). But better to keep the current instructions for now.