概览
RAPIDS Accelerator for Apache Spark 使用 GPUs数据加速处理,通过 RAPIDS libraries来实现。
- 参考:
- https://nvidia.github.io/spark-rapids/
- https://www.nvidia.cn/deep-learning-ai/solutions/data-science/apache-spark-3/
- https://docs.dask.org/en/latest/
- Ubuntu 20.04安装spark 3.1.1为系统服务
- 基于Kubernetes的Spark集群部署实践
- Apache Spark on Kubernetes: How Apache YuniKorn (Incubating) helps
- GPU加速的数据科学-NVIDIA资源
- cuPy:A NumPy-compatible array library accelerated by CUDA
- Dask-分布式DataFrame安装与使用
- Dask on GPUs
- SparkMagic简介、安装与使用
- Livy 是 Apache Spark的一个REST服务
- Multi-GPU with cuGraph
当数据科学家从传统数据分析转向 AI applications以满足复杂市场需求的时候,传统的CPU-based 处理不再满足速度与成本的需求。快速增长的 AI 分析需要新的框架来快速处理数据和节约成本,通过 GPUs来达到这个目标。
RAPIDS Accelerator for Apache Spark整合了 RAPIDS cuDF 库和 Spark 分布式计算框架。该RAPIDS Accelerator library又一个内置的加速 shuffle 基于 UCX ,可以配置为 GPU-to-GPU 通讯和RDMA能力。
Spark RAPIDS 下载 v0.4.1
RAPIDS Notebooks
- cuML Notebooks
- cuGraph Notebooks
- CLX Notebooks
- cuSpatial Notebooks
- cuxfilter Notebooks
- XGBoost Notebooks
介绍
这些 notebooks 提供了使用 RAPIDS的例子。设计为自包含 runtime
version of the RAPIDS Docker Container 和 RAPIDS Nightly Docker Containers and can run on air-gapped systems。可以快速获得容器然后按照 RAPIDS.ai Getting Started page 进行安装和使用。
用法
获取最新的notebook repo 更新,运行 ./update.sh
或者使用命令:
git submodule update --init --remote --no-single-branch --depth 1
下载 CUDA Installer for Linux Ubuntu 20.04 x86_64
基本安装程序 | |
安装说明: | |
|
可以在 Installer Checksums 中找到安装程序和补丁的校验和。
详情请参阅 Installation Guide for Linux和 CUDA Quick Start Guide。
性能 & 成本与收益
Rapids Accelerator for Apache Spark 得益于 GPU 性能的同时降低了成本。如下: *ETL for FannieMae Mortgage Dataset (~200GB) as shown in our demo. Costs based on Cloud T4 GPU instance market price & V100 GPU price on Databricks Standard edition。
易于使用
运行以前的 Apache Spark 应用不需要改变代码。启动 Spark with the RAPIDS Accelerator for Apache Spark plugin jar然后打开配置,如下:
spark.conf.set('spark.rapids.sql.enabled','true')
下面是physical plan with operators,运行在GPU:
更多参考 get started。
一个统一的 AI framework for ETL + ML/DL
单一流水线 ,从数据准备到模型训练:
开始使用RAPIDS Accelerator for Apache Spark
Apache Spark 3.0+ 为用户提供了 plugin可以替换 SQL 和 DataFrame 操作。不需要对API做出改变,该 plugin替换 SQL operations为 GPU 加速版本。如果该操作不支持GPU加速将转而用 Spark CPU 版本。
⚠️注意plugin不能加速直接对RDDs的操作。
该 accelerator library 同时提供了Spark’s shuffle的实现,可以利用 UCX 优化 GPU data transfers,keeping as much data on the GPU as possible and bypassing the CPU to do GPU to GPU transfers。
该 GPU 加速处理 plugin 不要求加速的 shuffle 实现。但是,如果加速 SQL processing未开启,该shuffle implementation 将使用缺省的SortShuffleManager
。
开启 GPU 处理加速,需要:
- Apache Spark 3.0+
- A spark cluster configured with GPUs that comply with the requirements for the version of cudf.
- One GPU per executor.
- The following jars:
- A cudf jar that corresponds to the version of CUDA available on your cluster.
- RAPIDS Spark accelerator plugin jar.
- To set the config
spark.plugins
tocom.nvidia.spark.SQLPlugin
Spark GPU 调度概览
Apache Spark 3.0 现在支持 GPU 调度与 cluster manager 一样。你可以让 Spark 请求 GPUs 然后赋予tasks。精确的配置取决于 cluster manager的配置。下面是一些例子:
- Request your executor to have GPUs:
--conf spark.executor.resource.gpu.amount=1
- Specify the number of GPUs per task:
--conf spark.task.resource.gpu.amount=1
- Specify a GPU discovery script (required on YARN and K8S):
--conf spark.executor.resource.gpu.discoveryScript=./getGpusResources.sh
查看部署的详细信息确定其方法和限制。注意 spark.task.resource.gpu.amount
可以是小数,如果想要 multiple tasks to be run on an executor at the same time and assigned to the same GPU,可以设置为小于1的小数。要与 spark.executor.cores
设置相对应。例如,spark.executor.cores=2
将允许 2 tasks 在每一个 executor,并且希望 2 tasks 运行在同一个 GPU,将设置spark.task.resource.gpu.amount=0.5
。
更多参考Apache Spark 官方文档。
- Overview
- Kubernetes specific documentation
- Yarn specific documentation
- Standalone specific documentation