Skip to main content

An easy to use CUDA/OpenCL kernel tuner in Python

Project description


Build Status CodeCov Badge PyPi Badge Zenodo Badge SonarCloud Badge OpenSSF Badge FairSoftware Badge

Create optimized GPU applications in any mainstream GPU programming language (CUDA, HIP, OpenCL, OpenACC, OpenMP).

What Kernel Tuner does:

Installation

  • First, make sure you have your CUDA, OpenCL, or HIP compiler installed
  • Then type: pip install kernel_tuner[cuda], pip install kernel_tuner[opencl], or pip install kernel_tuner[hip]
  • or why not all of them: pip install kernel_tuner[cuda,opencl,hip]

More information on installation, also for other languages, in the installation guide.

Example

import numpy as np
from kernel_tuner import tune_kernel

kernel_string = """
__global__ void vector_add(float *c, float *a, float *b, int n) {
    int i = blockIdx.x * block_size_x + threadIdx.x;
    if (i<n) {
        c[i] = a[i] + b[i];
    }
}
"""

n = np.int32(10000000)

a = np.random.randn(n).astype(np.float32)
b = np.random.randn(n).astype(np.float32)
c = np.zeros_like(a)

args = [c, a, b, n]

tune_params = {"block_size_x": [32, 64, 128, 256, 512]}

tune_kernel("vector_add", kernel_string, n, args, tune_params)

More examples here.

Resources

Kernel Tuner ecosystem


C++ magic to integrate auto-tuned kernels into C++ applications


C++ data types for mixed-precision CUDA kernel programming


Monitor, analyze, and visualize auto-tuning runs

Communication & Contribution

  • GitHub Issues: Bug reports, install issues, feature requests, work in progress
  • GitHub Discussion group: General questions, Q&A, thoughts

Contributions are welcome! For feature requests, bug reports, or usage problems, please feel free to create an issue. For more extensive contributions, check the contribution guide.

Citation

If you use Kernel Tuner in research or research software, please cite the most relevant among the publications on Kernel Tuner. To refer to the project as a whole, please cite:

@article{kerneltuner,
  author  = {Ben van Werkhoven},
  title   = {Kernel Tuner: A search-optimizing GPU code auto-tuner},
  journal = {Future Generation Computer Systems},
  year = {2019},
  volume  = {90},
  pages = {347-358},
  url = {https://www.sciencedirect.com/science/article/pii/S0167739X18313359},
  doi = {https://doi.org/10.1016/j.future.2018.08.004}
}

Project details


Download files

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

Source Distribution

kernel_tuner-1.3.1.tar.gz (191.0 kB view details)

Uploaded Source

Built Distribution

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

kernel_tuner-1.3.1-py3-none-any.whl (180.4 kB view details)

Uploaded Python 3

File details

Details for the file kernel_tuner-1.3.1.tar.gz.

File metadata

  • Download URL: kernel_tuner-1.3.1.tar.gz
  • Upload date:
  • Size: 191.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kernel_tuner-1.3.1.tar.gz
Algorithm Hash digest
SHA256 b53c9dd1d89d75d0ee1a1e85692bb4e8aa8b80cc52aba20c8800f85f0dfe58a9
MD5 eb9c9f4800b6cd505cb69671b46d4d7d
BLAKE2b-256 3ceefb93d9d5f777dbdb024e605a47d8759fe636448add9e928cba6564bce1ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for kernel_tuner-1.3.1.tar.gz:

Publisher: publish-python-package.yml on KernelTuner/kernel_tuner

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

File details

Details for the file kernel_tuner-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: kernel_tuner-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 180.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kernel_tuner-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7db130fca35f89c3a33abdf5b2cd8f955e99bb5ec2d80a06c0faaeaa0cc5eb72
MD5 cbe03656bfb03105642384d4e280f7bf
BLAKE2b-256 7fad8b06dd8f59ffd55c3c2e48036ac2622df04d5c48525699bc06f545d3b3e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for kernel_tuner-1.3.1-py3-none-any.whl:

Publisher: publish-python-package.yml on KernelTuner/kernel_tuner

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