Ashwin Srinath - cudf.pandas: The Zero Code Change GPU Accelerator for Pandas | PyData Global 2023

Learn how cudf.pandas accelerates Pandas code by 10-100x on GPUs with zero code changes through proxy pattern interception. See supported operations, limitations & best practices.

Key takeaways
  • cudf.pandas allows running Pandas code on GPUs without code changes by using a proxy pattern that intercepts Pandas calls

  • Current support covers 60-75% of Pandas API with 94% test suite passing - unsupported operations fallback gracefully to CPU

  • Performance improvements of 10-100x are possible for supported operations, though actual speedups vary by operation type:

    • String operations: 9ms vs 3000ms
    • Merge operations: 1s vs 14s
    • Group by operations: 50ms vs 1000ms+
  • Key limitations:

    • Only provides GPU acceleration (no CPU performance improvements)
    • Requires minimizing CPU fallbacks for best performance
    • Data movement between CPU/GPU can create overhead
    • Not all third-party libraries compatible due to type checking
  • Best practices for using cudf.pandas:

    • Use built-in profiler to identify bottlenecks
    • Minimize operations that require CPU fallback
    • Write code using idiomatic Pandas patterns
    • Consider data size vs GPU memory constraints
  • Installation available via Conda, Pip and Docker with support for:

    • Jupyter notebooks
    • Google Colab
    • Stand-alone Python scripts
  • Compatible with existing Pandas-based libraries and tools through proxy pattern, allowing gradual adoption without full codebase changes

  • Particularly useful for:

    • Large datasets
    • Performance-critical applications
    • Existing Pandas codebases needing acceleration
    • Teams wanting to maintain Pandas API compatibility