RAPIDs
RAPIDS is an open-source suite of GPU-accelerated libraries developed by NVIDIA that enables end-to-end data science and analytics pipelines to run entirely on GPUs.
It is designed to provide orders of magnitude speed-up compared to CPU-based alternatives for data loading, preprocessing, machine learning, graph analytics and more.
RAPIDS aims to bring GPU acceleration to the data science ecosystem without requiring significant code changes.
RAPIDS Visualisation Guide
The RAPIDS visualisation guide showcases how RAPIDS can accelerate interactive plotting of large datasets.
It highlights popular plotting libraries that are RAPIDS-accelerated:
HoloViews, hvPlot: Declarative APIs for building interactive plots and dashboards
Datashader: For rasterizing large datasets into images for display
Plotly, Bokeh: For interactive web-based visualisations
Seaborn: For static statistical graphics
These libraries can directly use cuDF dataframes instead of pandas for 5-100x faster plotting. The guide provides GPU-accelerated Interactive examples that dynamically plot millions of points.
It also covers general concepts like the importance of using a Jupyter server local to the GPU machine, handling large datasets that exceed GPU memory, and using Dask for distributed rendering.
Overall it demonstrates how to build end-to-end visual analytics pipelines that are GPU-accelerated.
Key features of RAPIDS
Accelerated data processing: RAPIDS includes libraries like cuDF, a GPU-accelerated DataFrame library that mimics the Pandas API, allowing users to process and manipulate large datasets efficiently on GPUs.
Machine learning and deep learning: cuML, a component of RAPIDS, provides GPU-accelerated implementations of popular machine learning algorithms, enabling faster training and inference.
Graph analytics: cuGraph is a library within RAPIDS that offers GPU-accelerated graph algorithms for analysing large-scale graph datasets.
Spatial analytics: cuSpatial is a library that provides GPU-accelerated spatial and trajectory data processing capabilities.
Data visualisation: cuxfilter is a RAPIDS library that enables the creation of interactive, GPU-accelerated dashboards for data visualization.
Seamless integration: RAPIDS integrates well with existing data science workflows and libraries, such as scikit-learn, NumPy, and Pandas, making it easier for data scientists to adopt GPU acceleration.
cuDF In-Depth
cuDF is a GPU DataFrame library that provides a pandas-like API for loading, filtering, aggregating and manipulating tabular data on GPUs. Key features of cuDF include:
Uses Apache Arrow columnar memory format on GPU for efficient processing:
Apache Arrow is a cross-language development platform for in-memory data.
It provides a standardised columnar memory format for efficient storage and processing of tabular data.
cuDF leverages the Apache Arrow format to store data in a columnar layout on the GPU.
Columnar data layout allows for better memory access patterns and enables SIMD (Single Instruction Multiple Data) operations on GPUs.
By using Apache Arrow, cuDF achieves efficient memory utilisation and high-performance data processing on GPUs.
Provides Python and C++ APIs, integrates with Numba, CuPy, Dask
cuDF offers both Python and C++ APIs for data manipulation and processing.
The Python API provides a user-friendly interface similar to pandas, allowing users to work with familiar DataFrame operations.
The C++ API enables low-level access to cuDF functionalities and allows for high-performance custom operations.
cuDF integrates seamlessly with other GPU-accelerated libraries such as Numba, CuPy, and Dask.
Numba is a just-in-time (JIT) compiler that can be used to accelerate custom Python functions on GPUs.
CuPy is a GPU-accelerated library for numerical computations that provides a NumPy-compatible interface.
Dask is a flexible library for parallel computing that can be used to scale cuDF operations across multiple GPUs or distributed systems.
Supports reading from a range of file formats
cuDF supports reading data from various file formats commonly used in data processing and analytics.
CSV (Comma-Separated Values) is a plain text format where each line represents a row, and values are separated by commas.
Parquet is a columnar storage format that provides efficient compression and encoding schemes for fast data retrieval.
ORC (Optimised Row Columnar) is another columnar storage format that offers high compression and efficient querying.
JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write.
cuDF can read data directly from these file formats into GPU memory, enabling fast data loading and processing.
Has a wide range of data types - numerics, strings, categoricals, timestamps
cuDF supports a wide range of data types to represent different kinds of data.
Numeric data types include integers (e.g., int8, int16, int32, int64) and floating-point numbers (e.g., float32, float64).
String data type represents textual data and allows for efficient string operations.
Categorical data type is used for storing data with a fixed number of unique values, providing efficient memory usage and fast comparisons.
Timestamp data type represents date and time values and enables time-based operations and analysis.
Provides Intra-dataframe operations
Intra-dataframe operations are performed within a single DataFrame.
Filter operation selects rows based on specified conditions, allowing for data subsets.
Project operation selects specific columns from the DataFrame, enabling column-wise transformations.
Aggregation operations perform computations across rows or columns, such as sum, average, count, etc.
Sort operation arranges the rows of the DataFrame based on one or more columns, in ascending or descending order.
These operations are crucial for data manipulation and analysis within a DataFrame.
Provides Inter-dataframe operations like joins, unions, merges
Inter-dataframe operations involve combining or merging multiple DataFrames.
Join operation combines rows from two DataFrames based on a common key column, allowing for data integration from different sources.
Union operation concatenates two DataFrames vertically, stacking the rows of one DataFrame below the other.
Merge operation combines DataFrames horizontally, aligning rows based on common columns or indexes.
These operations facilitate data combination and integration from multiple DataFrames.
Implements Reductions operations
Reduction operations aggregate data across rows or columns to produce a single result.
Sum operation calculates the sum of values in a column or across rows.
Min and max operations find the minimum and maximum values in a column or across rows.
Unique operation returns the unique values in a column or DataFrame.
Nunique operation counts the number of unique values in a column or DataFrame.
These operations are useful for data summarization and statistical analysis.
Time-series operations
Time-series operations are specific to data that is ordered by time.
Moving window functions calculate metrics over a sliding window of data points, such as rolling average or rolling standard deviation.
Sampling operation selects data points at regular intervals or based on a specific frequency.
Shifting operation moves the data points forward or backward in time, allowing for lag or lead analysis.
These operations are essential for analyzing and manipulating time-series data.
Integrates with cuML
cuML is a GPU-accelerated machine learning library that is part of the RAPIDS ecosystem.
cuDF seamlessly integrates with cuML, allowing for end-to-end GPU-accelerated machine learning pipelines.
Data loaded and processed using cuDF can be directly passed to cuML for training and inference.
This integration enables fast and efficient machine learning workflows entirely on GPUs.
Supports multi-GPU and distributed processing via Dask-cuDF
Dask-cuDF is an extension of cuDF that enables multi-GPU and distributed processing.
It leverages Dask, a flexible parallel computing library, to scale cuDF operations across multiple GPUs or distributed systems.
Dask-cuDF allows for the processing of larger-than-memory datasets by partitioning the data across multiple GPUs.
It enables distributed computation and parallel execution of cuDF operations, providing scalability and faster processing times.
With Dask-cuDF, users can harness the power of multiple GPUs or distributed clusters for handling massive datasets.
These key functions of cuDF collectively provide a powerful and efficient framework for data processing, analysis, and machine learning on GPUs.
By leveraging the Apache Arrow memory format, offering a wide range of data types and operations, integrating with other GPU-accelerated libraries, and supporting multi-GPU and distributed processing, cuDF enables users to accelerate their data workflows and achieve high-performance computing on GPUs.
Performance benchmarks
show cuDF providing 10-100x speedup over pandas on a wide range of workloads. This allows data scientists to manipulate much larger datasets and iterate faster.
RAPIDS Accelerator for Apache Spark
A key innovation is the "RAPIDS Accelerator for Apache Spark" which can be used to accelerate Spark SQL and DataFrame operations transparently, without any application code changes.
The RAPIDS Accelerator for Apache Spark is a plugin that allows Spark SQL and DataFrame operations to be executed on NVIDIA GPUs for faster processing.
Overview
It allows existing Spark applications to leverage GPUs without code changes by replacing the backend for SQL and DataFrame operations with GPU-accelerated versions using the RAPIDS libraries like cuDF.
If an operation is not supported on GPU, it will automatically fall back to using the CPU version in Spark.
It provides an accelerated shuffle implementation that can do GPU-to-GPU transfers, bypassing the CPU for better performance. However, the GPU accelerated processing can be used independently of the accelerated shuffle.
Benefits
Significantly speeds up processing and reduces infrastructure costs compared to CPU-based Spark, especially for workloads shifting to AI/ML that strain traditional CPU frameworks. A mortgage dataset ETL was shown to get 3.5X better performance at 3.4X lower cost.
Existing Spark applications can be accelerated with no code changes simply by adding the RAPIDS plugin jar and enabling it with a config. Explains in the physical plan which operators run on GPU.
Provides a unified AI framework allowing GPU acceleration of the full pipeline from ETL to ML/DL in a single workflow.
Qualification Tool
The Qualification Tool helps identify which existing CPU-based Spark workloads are good candidates to be migrated to GPU.
It analyses Spark event logs from CPU runs and estimates potential speedup on GPU at an operator level based on benchmarks.
Combines speedup estimates with other heuristics to make recommendations on which applications to migrate.
Additionally provides optimized Spark configs for running on GPU and recommends GPU cluster sizing on cloud platforms.
Available as a pip package for both cloud (Dataproc, EMR, Databricks) and on-prem deployments.
So in summary, the RAPIDS Accelerator enables Spark workloads to transparently leverage GPUs for major speedups and cost savings, aided by the Qualification Tool to prioritise workloads for migration.
This empowers Spark as a unified framework for accelerated data analytics and AI.
Under the hood, it plugs into the Spark APIs and replaces CPU-based operations with GPU-accelerated cuDF operations where possible.
Installation
RAPIDS provides several installation methods depending on the environment and version:
Conda: The recommended method, allows creating ready-to-use RAPIDS environments. Miniconda or Anaconda can be used.
Docker: Containerised RAPIDS environment, useful for deploying in cloud environments. Requires Docker CE v19.03+ and nvidia-container-toolkit.
Pip: For existing Python environments, RAPIDS can be installed via pip. Requires exact matching of pip wheel to system CUDA toolkit version.
From Source: For development or custom builds.
The installation guide provides step-by-step instructions for each method.
It lists the hardware and software prerequisites (NVIDIA GPU Volta or later, CUDA 11.2+, Ubuntu/CentOS + GCC 9+).
Cloud instances from AWS, Azure, GCP etc. can also be used.
The installation is streamlined using the "Quick Start" tool which generates the exact conda/docker/pip commands based on your configuration choices.
Example
To install RAPIDS, you can follow the installation guide provided in the RAPIDS documentation. The installation process typically involves the following steps:
Ensure that you have a compatible NVIDIA GPU and the necessary drivers installed.
Install a supported version of Python and create a new virtual environment (optional but recommended).
Use the conda package manager to install RAPIDS and its dependencies. The installation command may look like:
Verify the installation by importing RAPIDS libraries in a Python script or notebook.
Detailed installation instructions, including system requirements and troubleshooting steps, can be found in the RAPIDS documentation.
RAPIDS is designed to accelerate various stages of the data science pipeline, from data preprocessing and feature engineering to model training and inference.
It can significantly speed up data processing and machine learning tasks, especially when working with large datasets that can benefit from GPU acceleration.
Last updated