PitchHut logo
cuda-morph
Seamlessly run PyTorch on non-NVIDIA hardware without code changes.
Pitch

cuda-morph is a groundbreaking CUDA compatibility layer that enables existing PyTorch models to run on Huawei Ascend NPUs and other non-NVIDIA hardware without modifications. It simplifies machine learning workflows, allowing for backend-aware routing and fallback behavior, ultimately accelerating shipping and deploying machine learning applications.

Description

cuda-morph is designed to enable seamless execution of PyTorch workloads on non-NVIDIA hardware with minimal code changes. This innovative compatibility layer ensures that existing CUDA-based PyTorch scripts continue to function without the need for significant rewrites. By redirecting calls to available backends or falling back to CPU, cuda-morph streamlines the machine learning development process, enhancing productivity and efficiency in deploying models across diverse hardware platforms.

Key Features

  • Zero-Rewrite Activation: Users can activate many existing CUDA-style PyTorch flows without rewriting code.
  • Flexible Backend Routing: Automatically routes based on available hardware, including support for Ascend, ROCm, Intel XPU, and CPU fallbacks.
  • Command-Line Interface (CLI): Includes tools for environment checks, porting hints, and script validation to ensure compatibility.
  • Ecosystem Compatibility: Offers patches for essential libraries to facilitate integration with cuda-morph, further easing the transition to non-NVIDIA hardware.

How It Works

  1. Begin with existing CUDA-oriented codebase.
  2. Activate the cuda-morph layer.
  3. Run the code with optimal backend-aware routing.

Example Usage

To install the package, run:

pip install cuda-morph

Then, activate compatibility in your code:

import ascend_compat
ascend_compat.activate()

# Existing CUDA-style code remains unchanged
model = model.cuda()

Validation and Backends

cuda-morph has undergone rigorous testing with over 460 tests passing in CPU fallback mode. Users can verify compatibility on various hardware platforms and view a comprehensive matrix of supported capabilities for each backend.

Current Backend Support:

BackendHardwareStatus
Huawei Ascend910B, 310PFull shim & ecosystem patches available.
AMD ROCmMI210, MI250X, MI300XDetection and device routing implemented.
Intel XPUMax 1550, Flex, ArcDetection and device routing implemented.
CambriconMLU370, MLU590Detection and device routing implemented.

Diagnostic Tools

Utilize the CLI tools to assess compatibility and optimize code for different hardware setups:

cuda-morph check model.py  # Check script for compatibility issues
cuda-morph port model.py   # Generate porting suggestions

Further Exploration

For detailed insights and additional documentation, refer to:

0 comments

No comments yet.

Sign in to be the first to comment.