Skip to main content

cuda-morph

Run PyTorch workloads on non-NVIDIA hardware with minimal code changes.

Python 3.8+ Alpha status Apache 2.0 license

cuda-morph dark hero

Existing CUDA-style PyTorch scripts keep running — cuda-morph redirects calls to available backends or falls back to CPU.


Why this exists

A lot of ML code assumes torch.cuda everywhere. On non-NVIDIA setups, that often means immediate runtime errors and expensive rewrites.

cuda-morph is a runtime compatibility layer that helps you keep the same workflow and ship faster.


Visual walkthrough

cuda-morph workflow dark

  1. Start with existing CUDA-oriented code.
  2. Activate cuda-morph.
  3. Run with backend-aware routing and fallback behavior.

Quick start

pip install cuda-morph
import ascend_compat
ascend_compat.activate()

# Existing CUDA-style code stays the same
model = model.cuda()
cuda-morph info
cuda-morph check model.py

Core capabilities

  • Zero-rewrite activation for many CUDA-style PyTorch flows.
  • Backend routing across Ascend / ROCm / Intel XPU / CPU fallback paths.
  • CLI tooling for environment checks, porting hints, and validation commands.
  • Ecosystem patches for key libraries (current depth varies by backend).

Full matrix: docs/compatibility_matrix.md


Validation snapshot

cuda-morph cli dark ROCm .cuda() proof screenshot

  • 460+ tests passing in CPU-fallback mode.
  • Real hardware proof captured on RunPod AMD ROCm: .cuda() matmul ran on cuda:0 and reported AMD Radeon Graphics.
  • Core .cuda() routing on non-NVIDIA hardware is now validated; broader operator and ecosystem coverage is still in progress.

If you can test on non-NVIDIA accelerators, feedback is highly valuable: open an issue.


Backend status (current)

Backend Hardware Status
Huawei Ascend 910B, 310P Full shim + ecosystem patches (flash-attn, HuggingFace, DeepSpeed, vLLM). Needs hardware validation.
AMD ROCm MI210, MI250X, MI300X Detection + device routing. Ecosystem patches not yet implemented.
Intel XPU Max 1550, Flex, Arc Detection + device routing. Ecosystem patches not yet implemented.
Cambricon MLU370, MLU590 Detection + device routing. Ecosystem patches not yet implemented.

CLI

cuda-morph check model.py     # check a script for compatibility issues
cuda-morph port model.py      # generate porting suggestions
cuda-morph doctor             # environment diagnostics
cuda-morph doctor --full
cuda-morph verify --device npu
cuda-morph bench overhead
cuda-morph info

Development

git clone https://github.com/JosephAhn23/cuda-morph.git
cd cuda-morph
pip install -e ".[dev]"
pytest tests/ -v
pytest tests/ -v --run-hardware

See also

License

Apache 2.0

Metadata

Release files for cuda-morph 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cuda-morph 0.9.1
File Size Uploaded Provenance Actions
cuda_morph-0.9.1.tar.gz 151.8 kB With provenance Details for cuda_morph-0.9.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cuda-morph 0.9.1
File Interpreter ABI Platform Actions
cuda_morph-0.9.1-py3-none-any.whl Python 3 none any Details for cuda_morph-0.9.1-py3-none-any.whl

Total release size: 295.0 kB

Release files / cuda_morph-0.9.1.tar.gz

Download URL cuda_morph-0.9.1.tar.gz
Size 151.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d04d6894e4e63051dffe9df827f623505492f5d4da23279ed05d4a8b77e6cc30
BLAKE2b-256 checksum
How to use checksums
7329c9823b2d5148df6a57c7dd99791d9a6c4a5ebd990d62a1cf1a3ea8c5767d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 10, 2026.

Transparency log

Release files / cuda_morph-0.9.1-py3-none-any.whl

Download URL cuda_morph-0.9.1-py3-none-any.whl
Size 143.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98f9b099f715c5e737c4c8ae0fa0a8198b7f263a5094d7a0b03412030de27b99
BLAKE2b-256 checksum
How to use checksums
9f3fc9dc9b915667ca71f082c64dd3f73d6d224c9ac8a9789c9405fef4c1ba6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 10, 2026.

Transparency log

Security for cuda-morph 0.9.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cuda_morph-0.9.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page