-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML-93][GPU] Add GPU support for PCA (#104)
* Add pca * add pca gpu script * nit
- Loading branch information
Showing
10 changed files
with
126 additions
and
42 deletions.
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
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,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script is a basic example script to get resource information about NVIDIA GPUs. | ||
# It assumes the drivers are properly installed and the nvidia-smi command is available. | ||
# It is not guaranteed to work on all setups so please test and customize as needed | ||
# for your environment. It can be passed into SPARK via the config | ||
# spark.{driver/executor}.resource.gpu.discoveryScript to allow the driver or executor to discover | ||
# the GPUs it was allocated. It assumes you are running within an isolated container where the | ||
# GPUs are allocated exclusively to that driver or executor. | ||
# It outputs a JSON formatted string that is expected by the | ||
# spark.{driver/executor}.resource.gpu.discoveryScript config. | ||
# | ||
# Example output: {"name": "gpu", "addresses":["0","1","2","3","4","5","6","7"]} | ||
|
||
#ADDRS=`nvidia-smi --query-gpu=index --format=csv,noheader | sed -e ':a' -e 'N' -e'$!ba' -e 's/\n/","/g'` | ||
#echo {\"name\": \"gpu\", \"addresses\":[\"$ADDRS\"]} | ||
#ADDRS="0","1","2","3","4","5","6","7" | ||
#echo {\"name\": \"gpu\", \"addresses\":[\"$ADDRS\"]} | ||
|
||
echo {\"name\": \"gpu\", \"addresses\":[\"0\",\"1\",\"2\",\"3\"]} |
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 @@ | ||
[{"id":{"componentName": "spark.worker","resourceName":"gpu"},"addresses":["0","1","2","3"]}] |
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,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
source ../../conf/env.sh | ||
|
||
APP_JAR=target/oap-mllib-examples-$OAP_MLLIB_VERSION.jar | ||
APP_CLASS=org.apache.spark.examples.ml.PCAExample | ||
|
||
USE_GPU=true | ||
RESOURCE_FILE=$PWD/IntelGpuResourceFile.json | ||
WORKER_GPU_AMOUNT=4 | ||
EXECUTOR_GPU_AMOUNT=1 | ||
TASK_GPU_AMOUNT=1 | ||
|
||
# Should run in standalone mode | ||
time $SPARK_HOME/bin/spark-submit --master $SPARK_MASTER -v \ | ||
--num-executors $SPARK_NUM_EXECUTORS \ | ||
--executor-cores $SPARK_EXECUTOR_CORES \ | ||
--total-executor-cores $SPARK_TOTAL_CORES \ | ||
--driver-memory $SPARK_DRIVER_MEMORY \ | ||
--executor-memory $SPARK_EXECUTOR_MEMORY \ | ||
--conf "spark.serializer=org.apache.spark.serializer.KryoSerializer" \ | ||
--conf "spark.default.parallelism=$SPARK_DEFAULT_PARALLELISM" \ | ||
--conf "spark.sql.shuffle.partitions=$SPARK_DEFAULT_PARALLELISM" \ | ||
--conf "spark.driver.extraClassPath=$SPARK_DRIVER_CLASSPATH" \ | ||
--conf "spark.executor.extraClassPath=$SPARK_EXECUTOR_CLASSPATH" \ | ||
--conf "spark.oap.mllib.useGPU=$USE_GPU" \ | ||
--conf "spark.worker.resourcesFile=$RESOURCE_FILE" \ | ||
--conf "spark.worker.resource.gpu.amount=$WORKER_GPU_AMOUNT" \ | ||
--conf "spark.executor.resource.gpu.amount=$EXECUTOR_GPU_AMOUNT" \ | ||
--conf "spark.task.resource.gpu.amount=$TASK_GPU_AMOUNT" \ | ||
--conf "spark.shuffle.reduceLocality.enabled=false" \ | ||
--conf "spark.network.timeout=1200s" \ | ||
--conf "spark.task.maxFailures=1" \ | ||
--jars $OAP_MLLIB_JAR \ | ||
--class $APP_CLASS \ | ||
$APP_JAR \ | ||
2>&1 | tee PCA-$(date +%m%d_%H_%M_%S).log | ||
|
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
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
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
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
4 changes: 2 additions & 2 deletions
4
mllib-dal/src/main/native/javah/org_apache_spark_ml_feature_PCADALImpl.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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