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.
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.
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()
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.
| Backend | Hardware | Status |
|---|---|---|
| Huawei Ascend | 910B, 310P | Full shim & ecosystem patches available. |
| AMD ROCm | MI210, MI250X, MI300X | Detection and device routing implemented. |
| Intel XPU | Max 1550, Flex, Arc | Detection and device routing implemented. |
| Cambricon | MLU370, MLU590 | Detection and device routing implemented. |
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
For detailed insights and additional documentation, refer to:
No comments yet.
Sign in to be the first to comment.