Skip to main content

numba-cuda-mlir Python Compiler

Project description

Numba-CUDA-MLIR

Numba-CUDA-MLIR provides a programming model similar to CUDA C++ in Python. It is evolved from Numba-CUDA, and is intended to be compatible with Numba-CUDA kernels.

Numba-CUDA-MLIR aims to interoperate well with existing programming models whilst also allowing experts sufficient control over code generation.

Quick Start

Install with pip:

pip install numba-cuda-mlir[cu13]  # or [cu12] if using CUDA 12

or using conda:

conda install -c conda-forge numba-cuda-mlir

Writing and executing a simple vector add kernel:

import numpy as np
from numba_cuda_mlir import cuda

@cuda.jit
def vector_add(a, b, out):
    i = cuda.grid(1)
    if i < out.shape[0]:
        out[i] = a[i] + b[i]

n = 1_000_000
a = np.ones(n, dtype=np.float32)
b = np.ones(n, dtype=np.float32)
out = np.zeros(n, dtype=np.float32)

threads_per_block = 256
blocks = (n + threads_per_block - 1) // threads_per_block
vector_add[blocks, threads_per_block](a, b, out)

Migration from Numba / Numba-CUDA

Change imports to use the numba_cuda_mlir.cuda package instead of numba.cuda. For example:

from numba import cuda

becomes:

from numba_cuda_mlir import cuda

For the majority of code using Numba-CUDA, this should be a sufficient change to enable the use of Numba-CUDA-MLIR. For code using the extension APIs, modifications will be required as Numba-CUDA-MLIR uses MLIR in its code generation process instead of LLVM IR. See the Migration Guidance in the documentation for further details.

Installation Requirements

  • Python >= 3.11, with:
    • The cuda.core and cuda-bindings packages
    • NumPy >= 1.22
  • CUDA Toolkit components (CUDA Runtime, NVCC, NVRTC, nvJitLink, and CCCL) installed via pip or conda, or a system package manager (Linux).
  • NVIDIA GPU with Compute Capability 7.0 or greater and a compatible driver:
    • >= r525 for CUDA 12.x
    • >= r580 for CUDA 13.x

Installation guidance

For full details of installation methods including from packages and building from source and testing, please see INSTALL.md.

Contributing to Numba-CUDA-MLIR

See the Contribution Guidelines for information on how to set up a development environment and follow the contribution process.

Benchmarks

A small suite of benchmarks can be executed from the source repository by running:

pytest tests/benchmarks/ --benchmark -s

Licensing

Numba-CUDA-MLIR is distributed under the Apache License 2.0.

It incorporates the following third-party projects, each retained under its original license:

  1. numba-cudaBSD 2-Clause License
  2. cloudpickleBSD 3-Clause License
  3. appdirsMIT License
  4. LLVM Project / EUDSLApache License 2.0 WITH LLVM-exception

See NOTICE for the full attribution map and per-component locations in this repository, and THIRD-PARTY-LICENSES for the verbatim upstream license texts.

Contributions are accepted under the terms described in CONTRIBUTING.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

numba_cuda_mlir-0.3.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (85.5 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

numba_cuda_mlir-0.3.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (82.3 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

numba_cuda_mlir-0.3.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (85.5 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

numba_cuda_mlir-0.3.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (82.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

numba_cuda_mlir-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (85.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

numba_cuda_mlir-0.3.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (82.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

numba_cuda_mlir-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (85.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

numba_cuda_mlir-0.3.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (82.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

numba_cuda_mlir-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (85.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

numba_cuda_mlir-0.3.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (82.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

File details

Details for the file numba_cuda_mlir-0.3.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for numba_cuda_mlir-0.3.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0d768620c593af5a8b9983a0aa02e7a32397e22339139782b526ab418f966f75
MD5 e08a4cca2f679115dce00193351d02c6
BLAKE2b-256 60c6f5ec65195b7dececdabb448a6a84e3e61d04165a79fd0ee9c4d1709600d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for numba_cuda_mlir-0.3.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yaml on NVIDIA/numba-cuda-mlir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numba_cuda_mlir-0.3.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for numba_cuda_mlir-0.3.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c2c98b2d9a900271a08d06509fabc03f77456fe7cc09711a983bbc634a5c34d1
MD5 a5b41993f0351f7ca89acfe236fa70d7
BLAKE2b-256 b61ed5e18d24a240b746b0e4e5819d8899a611afdb42a10330847f5cdcfc3f57

See more details on using hashes here.

Provenance

The following attestation bundles were made for numba_cuda_mlir-0.3.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl:

Publisher: publish.yaml on NVIDIA/numba-cuda-mlir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numba_cuda_mlir-0.3.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for numba_cuda_mlir-0.3.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4bd0d200b827856632e3d2b5d8e4f0cd6c45d5f8eb05fc8ebd5d5dfdfa8b1909
MD5 f1406405d21507b88fe5d1a68a08ea5c
BLAKE2b-256 65492904e688eba8780a5116f9f0a2d0015ec73dbed76dc879641c523688003d

See more details on using hashes here.

Provenance

The following attestation bundles were made for numba_cuda_mlir-0.3.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yaml on NVIDIA/numba-cuda-mlir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numba_cuda_mlir-0.3.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for numba_cuda_mlir-0.3.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9a72c7fcf1598fe3cce968ec01018d5dc4c3e03e08f534692e4a0fe6a6763737
MD5 b508893765ae00b71a7447d3cc383ab4
BLAKE2b-256 bd59818f72d82faba5ffce0a2326f04b1f293132cf417e3285c9547d299da476

See more details on using hashes here.

Provenance

The following attestation bundles were made for numba_cuda_mlir-0.3.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl:

Publisher: publish.yaml on NVIDIA/numba-cuda-mlir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numba_cuda_mlir-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for numba_cuda_mlir-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 94b37040f8f9b377e1c2f61faf191a6476c39638f77632640a73b17236db9d7c
MD5 6ef7708e218ae032127a0f0e6e9aecda
BLAKE2b-256 0abb801422404fb801b64d9ece660f1cb263f6be90baa4bd5bc9bce76789788e

See more details on using hashes here.

Provenance

The following attestation bundles were made for numba_cuda_mlir-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yaml on NVIDIA/numba-cuda-mlir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numba_cuda_mlir-0.3.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for numba_cuda_mlir-0.3.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 86722149630f5e277b713c3412b8795158c044fc560e3b288e7ae2bd5daa8229
MD5 1f5d0e020f6532a051cd9d6f0722f4c0
BLAKE2b-256 4931dc406ae01b1328866ddba5e2efe86c071ba1e9669ed3971884f4bb30628c

See more details on using hashes here.

Provenance

The following attestation bundles were made for numba_cuda_mlir-0.3.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl:

Publisher: publish.yaml on NVIDIA/numba-cuda-mlir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numba_cuda_mlir-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for numba_cuda_mlir-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b769887d3bdd9fba81b0bdf629dc300289cd4353021dce6fd167f5574e31b934
MD5 a89791ed4216e5586135ce5fb12ca8f7
BLAKE2b-256 dcc584e62fa1e04cb20283003418b40a1bef8987b8faa4bc9f4cc2a3d8b0e9bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for numba_cuda_mlir-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yaml on NVIDIA/numba-cuda-mlir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numba_cuda_mlir-0.3.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for numba_cuda_mlir-0.3.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5d855e530bf0e924fb3df2fa1d15fa3df2bcdddea50b7525bd2f220cf749699b
MD5 f0be0079f76f6b984205bc5ae12b8013
BLAKE2b-256 489e0cc252a5a450ba05dee0d0fa48e0797b3b2f0ee7a683e92e44498fd2ffad

See more details on using hashes here.

Provenance

The following attestation bundles were made for numba_cuda_mlir-0.3.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl:

Publisher: publish.yaml on NVIDIA/numba-cuda-mlir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numba_cuda_mlir-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for numba_cuda_mlir-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a480344a330a7c8def8c9bb970feece7a145e350931e3548d87023b64c2c9834
MD5 2c9361fb2b65b8d37a938d1e524f2391
BLAKE2b-256 4321d4d28540201751a0d8c3da3cbced6658ef63d1be00f9a01bdefa2b7500b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for numba_cuda_mlir-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yaml on NVIDIA/numba-cuda-mlir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numba_cuda_mlir-0.3.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for numba_cuda_mlir-0.3.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c17fad57bdb27164296c6db26709ab69b40baba66f0d4a1fddcb50ffa24e87ed
MD5 adcf3732a72819dfa1500e7fca03b560
BLAKE2b-256 ffc6db63d1fdf4d10e21514d13ead6967e748ffff71f26178b04fcf30ac36697

See more details on using hashes here.

Provenance

The following attestation bundles were made for numba_cuda_mlir-0.3.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl:

Publisher: publish.yaml on NVIDIA/numba-cuda-mlir

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page