Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • tasmith4/pyopencl
  • fikl2/pyopencl
  • inducer/pyopencl
  • wence-/pyopencl
  • isuruf/pyopencl
  • kif/pyopencl
  • kaushikcfd/pyopencl
7 results
Show changes
Commits on Source (1421)
Showing
with 926 additions and 220 deletions
#! /bin/bash
# https://github.com/conda-forge/intel-compiler-repack-feedstock/issues/7
sed -i 's/- pocl/- intel-opencl-rt!=2022.2/g' "$CONDA_ENVIRONMENT"
# https://editorconfig.org/
# https://github.com/editorconfig/editorconfig-vim
# https://github.com/editorconfig/editorconfig-emacs
root = true
[*]
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.py]
indent_size = 4
[*.rst]
indent_size = 4
[*.cpp]
indent_size = 2
[*.hpp]
indent_size = 2
# There may be one in doc/
[Makefile]
indent_style = tab
# https://github.com/microsoft/vscode/issues/1679
[*.md]
trim_trailing_whitespace = false
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Environment (please complete the following information):**
- OS: [e.g. Linux]
- ICD Loader and version: [e.g. ocl-icd 2.3.1]
- ICD and version: [e.g. pocl 1.8]
- CPU/GPU: [e.g. Nvidia Titan V]
- Python version: [e.g. 3.10]
- PyOpenCL version: [e.g. 2021.1]
**Additional context**
Add any other context about the problem here.
blank_issues_enabled: true
contact_links:
- name: ❓ Question
url: https://github.com/inducer/pyopencl/discussions/categories/q-a
about: Ask and answer questions about PyOpenCL on Discussions
- name: 🔧 Troubleshooting
url: https://github.com/inducer/pyopencl/discussions/categories/troubleshooting
about: For troubleshooting help, see the Discussions
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
version: 2
updates:
# Set update schedule for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
# vim: sw=4
name: Gitlab mirror
on:
push:
branches:
- main
jobs:
autopush:
name: Automatic push to gitlab.tiker.net
if: startsWith(github.repository, 'inducer/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
curl -L -O https://tiker.net/ci-support-v0
. ./ci-support-v0
mirror_github_to_gitlab
env:
GITLAB_AUTOPUSH_KEY: ${{ secrets.GITLAB_AUTOPUSH_KEY }}
# vim: sw=4
name: CI
on:
push:
branches:
- main
tags:
- v*
pull_request:
schedule:
- cron: '17 3 * * 0'
jobs:
ruff:
name: Ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
- name: "Main Script"
run: |
pip install ruff
ruff check
typos:
name: Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@master
pylint:
name: Pylint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Main Script"
run: |
CONDA_ENVIRONMENT=.test-conda-env-py3.yml
echo "- matplotlib" >> $CONDA_ENVIRONMENT
echo "- pyopengl" >> $CONDA_ENVIRONMENT
echo "- ipython" >> $CONDA_ENVIRONMENT
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_conda_env
# Avoid linting local directory, where native module
# cannot be imported.
rm -Rf "$(get_proj_name)"
run_pylint "$(get_proj_name)" test/*.py
mypy:
name: Mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Main Script"
run: |
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
export CL_USE_SHIPPED_EXT=on
build_py_project_in_conda_env
python -m pip install mypy importlib-resources
./run-mypy.sh
pytest:
name: Pytest Linux POCL
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Main Script"
run: |
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
export CL_USE_SHIPPED_EXT=on
build_py_project_in_conda_env
test_py_project
pytest_intel:
name: Pytest Linux Intel CL
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Main Script"
run: |
export CONDA_ENVIRONMENT=.test-conda-env-py3.yml
.ci/hack-intel-cl-into-conda-env.sh
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
export CL_USE_SHIPPED_EXT=on
build_py_project_in_conda_env
test_py_project
pytest_win:
name: Pytest Windows Intel CL
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: "Main Script"
shell: bash
run: |
set -x
export CONDA_ENVIRONMENT=.test-conda-env-py3.yml
sed -i 's/- ocl-icd/- khronos-opencl-icd-loader/g' "$CONDA_ENVIRONMENT"
sed -i '/- git/d' "$CONDA_ENVIRONMENT"
.ci/hack-intel-cl-into-conda-env.sh
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
export CL_USE_SHIPPED_EXT=on
build_py_project_in_conda_env
test_py_project
pytest_mac:
name: Pytest Mac POCL
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: "Main Script"
run: |
export CC=gcc
CONDA_ENVIRONMENT=.test-conda-env.yml
grep -v ocl-icd .test-conda-env-py3.yml > $CONDA_ENVIRONMENT
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_conda_env
test_py_project
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
-
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: "Main Script"
run: |
CONDA_ENVIRONMENT=.test-conda-env-py3.yml
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
export CL_USE_SHIPPED_EXT=on
build_py_project_in_conda_env
build_docs
examples:
name: Examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Main Script"
run: |
EXTRA_INSTALL="pillow cgen mako imageio"
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_conda_env
(cd examples; rm -f gl_*)
run_examples --no-require-main
downstream_tests:
strategy:
matrix:
downstream_project: [loopy, boxtree, meshmode]
name: Tests for downstream project ${{ matrix.downstream_project }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Main Script"
env:
DOWNSTREAM_PROJECT: ${{ matrix.downstream_project }}
run: |
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
prepare_downstream_build "https://github.com/inducer/$DOWNSTREAM_PROJECT.git"
sed -i 's/pyopencl/ocl-icd/' .test-conda-env-py3.yml
build_py_project_in_conda_env
test_py_project
# vim: sw=4
name: Build and upload to PyPI
# Build on every branch push, tag push, and pull request change:
on:
push:
branches:
- main
tags:
- v*
pull_request:
schedule:
- cron: '17 3 * * 0'
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.22.0
- name: Build wheels
shell: bash
run: |
set -x
if [[ ${{ matrix.os }} == windows-* ]]; then
export CL_INC_DIR="D:/a/pyopencl/pyopencl/OpenCL-Headers/install/include"
export CL_LIB_DIR="C:/Program Files/OpenCL-ICD-Loader/lib"
fi
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
environment: pypi
permissions:
id-token: write
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
_skbuild
.pydevproject
.project
.settings
......@@ -8,7 +10,6 @@
*.pyc
build
*.prof
siteconf.py
doc/hedge-notes.pdf
*.vtk
*.silo
......@@ -64,3 +65,13 @@ build-and-test-py-project.sh
cffi_build.py
.cache
.pytest_cache
.idea
wheelhouse
memray-*.bin
memray-*.html
.pylintrc.yml
.run-pylint.py
"Python 2.7 AMD CPU (+GL and special func)":
script:
- export PY_EXE=python2.7
- export PYOPENCL_TEST=amd:pu
- export EXTRA_INSTALL="numpy mako scipy pyfmmlib"
- echo "CL_ENABLE_GL = True" > siteconf.py
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh
- ". ./build-and-test-py-project.sh"
allow_failure: true
tags:
- python2.7
- amd-cl-cpu
- opengl
except:
- tags
variables:
GIT_SUBMODULE_STRATEGY: recursive
Python 3.5 Intel CPU:
script:
- export PY_EXE=python3.5
- export PYOPENCL_TEST="intel(r):pu"
- export EXTRA_INSTALL="numpy mako"
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh
- ". ./build-and-test-py-project.sh"
Python 3 Intel CPU:
script: |
source /opt/enable-intel-cl.sh
export PYOPENCL_TEST="intel(r):pu"
export EXTRA_INSTALL="numpy mako"
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_venv
test_py_project
tags:
- python3.5
- python3
- intel-cl-cpu
except:
- tags
artifacts:
reports:
junit: test/pytest.xml
Python 3 Nvidia Titan X:
script: |
export PYOPENCL_TEST=nvi:titan
export EXTRA_INSTALL="numpy mako"
Python 3.5 AMD CPU:
script:
- export PY_EXE=python3.5
- export PYOPENCL_TEST=amd:pu
- export EXTRA_INSTALL="numpy mako"
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh
- ". ./build-and-test-py-project.sh"
allow_failure: true
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_venv
test_py_project
tags:
- python3.5
- amd-cl-cpu
- python3
- nvidia-titan-x
except:
- tags
artifacts:
reports:
junit: test/pytest.xml
Python 3 Nvidia Titan V:
script: |
export PYOPENCL_TEST=nvi:titan
export EXTRA_INSTALL="numpy mako"
Python 2.6 AMD CPU:
script:
- export PY_EXE=python2.6
- export PYOPENCL_TEST=amd:pu
- export EXTRA_INSTALL="numpy mako"
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh
- ". ./build-and-test-py-project.sh"
allow_failure: true
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_venv
test_py_project
tags:
- python2.6
- amd-cl-cpu
- python3
- nvidia-titan-v
except:
- tags
artifacts:
reports:
junit: test/pytest.xml
Python 3.5 Titan X:
script:
- export PY_EXE=python3.5
- export PYOPENCL_TEST=nvi:titan
- export EXTRA_INSTALL="numpy mako"
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh
- ". ./build-and-test-py-project.sh"
Python 3 Nvidia K40:
script: |
export PYOPENCL_TEST=nvi:k40
export EXTRA_INSTALL="numpy mako"
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_venv
test_py_project
tags:
- python3.5
- nvidia-titan-x
- python3
- nvidia-k40
except:
- tags
artifacts:
reports:
junit: test/pytest.xml
Python 3 POCL:
script: |
export PYOPENCL_TEST=portable:cpu
export EXTRA_INSTALL="numpy mako"
Python 3.5 K40:
script:
- export PY_EXE=python3.5
- export PYOPENCL_TEST=nvi:k40
- export EXTRA_INSTALL="numpy mako"
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh
- ". ./build-and-test-py-project.sh"
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_venv
test_py_project
tags:
- python3.5
- nvidia-k40
- python3
- pocl
except:
- tags
artifacts:
reports:
junit: test/pytest.xml
Python 3 POCL CL 1.1:
script: |
export PYOPENCL_TEST=portable:cpu
export EXTRA_INSTALL="numpy mako"
export PYOPENCL_PRETEND_CL_VERSION='1.1'
Python 3.5 AMD GPU:
script:
- export PY_EXE=python3.5
- export PYOPENCL_TEST=amd:fiji
- export EXTRA_INSTALL="numpy mako"
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh
- ". ./build-and-test-py-project.sh"
allow_failure: true
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_venv
test_py_project
tags:
- python3.5
- amd-fiji
- python3
- pocl
except:
- tags
artifacts:
reports:
junit: test/pytest.xml
Python 3 POCL K40:
script: |
export PYOPENCL_TEST=portable:k40
export EXTRA_INSTALL="numpy mako"
Python 3.6 POCL:
script:
- export PY_EXE=python3.6
- export PYOPENCL_TEST=portable
- export EXTRA_INSTALL="numpy mako"
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh
- ". ./build-and-test-py-project.sh"
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_venv
test_py_project
tags:
- python3.6
- python3
- pocl
- nvidia-k40
except:
- tags
artifacts:
reports:
junit: test/pytest.xml
Python 3 POCL Titan V:
script: |
export PYOPENCL_TEST=portable:titan
export EXTRA_INSTALL="numpy mako"
Python 3.5 POCL CL 1.1:
script:
- export PY_EXE=python3.5
- export PYOPENCL_TEST=portable
- export EXTRA_INSTALL="numpy mako"
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh
- echo "CL_PRETEND_VERSION = '1.1'" > siteconf.py
- ". ./build-and-test-py-project.sh"
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_venv
test_py_project
tags:
- python3.5
- python3
- pocl
- nvidia-titan-v
except:
- tags
artifacts:
reports:
junit: test/pytest.xml
Python 2.7 POCL:
script:
- export PY_EXE=python2.7
- export PYOPENCL_TEST=portable
- export EXTRA_INSTALL="numpy mako"
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh
- ". ./build-and-test-py-project.sh"
Python 3 POCL (+GL and special functions):
script: |
export PYOPENCL_TEST=portable:cpu
export EXTRA_INSTALL="numpy mako scipy pyfmmlib"
export PYOPENCL_ENABLE_GL=ON
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_venv
test_py_project
tags:
- python2.7
- python3
- pocl
except:
- tags
artifacts:
reports:
junit: test/pytest.xml
Python 2.7 Apple:
script:
- export PY_EXE=python2.7
- export PYOPENCL_TEST=app:cpu
- export EXTRA_INSTALL="numpy mako"
- export PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh
- ". ./build-and-test-py-project.sh"
Ruff:
script: |
pipx install ruff
ruff check
tags:
- python2.7
- apple
- docker-runner
except:
- tags
Python 3.5 Conda Apple:
script:
- CONDA_ENVIRONMENT=.test-conda-env-py3.yml
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project-within-miniconda.sh
- ". ./build-and-test-py-project-within-miniconda.sh"
Pylint:
script: |
export EXTRA_INSTALL="numpy mako matplotlib PyOpenGl IPython"
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_venv
# Avoid linting local directory, where native module
# cannot be imported.
rm -Rf "$(get_proj_name)"
run_pylint "$(get_proj_name)" test/*.py
tags:
- apple
- python3
except:
- tags
PyPy POCL:
script:
- export PY_EXE=pypy
- export PYOPENCL_TEST=portable
- export EXTRA_INSTALL="numpy mako"
- export NO_DOCTESTS=1
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh
- ". ./build-and-test-py-project.sh"
Mypy:
script: |
export EXTRA_INSTALL="numpy mako mypy importlib-resources"
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_venv
python -m mypy --show-error-codes pyopencl test
tags:
- pypy
- pocl
- python3
except:
- tags
Documentation:
script:
- EXTRA_INSTALL="numpy mako"
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-docs.sh
- ". ./build-docs.sh"
tags:
- python3.5
only:
- master
Flake8:
script:
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-flake8.sh
- ". ./prepare-and-run-flake8.sh pyopencl test"
script: |
export EXTRA_INSTALL="numpy mako"
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_venv
build_docs
maybe_upload_docs
tags:
- python3.5
- linux
Examples:
script: |
export EXTRA_INSTALL="pillow cgen mako imageio"
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
build_py_project_in_venv
(cd examples; rm -f gl_*)
run_examples --no-require-main
except:
- tags
tags:
- python3
- pocl
Downstream:
parallel:
matrix:
- DOWNSTREAM_PROJECT: [loopy, boxtree, meshmode]
tags:
- large-node
- docker-runner
script: |
curl -L -O https://tiker.net/ci-support-v0
. ci-support-v0
prepare_downstream_build "https://github.com/inducer/$DOWNSTREAM_PROJECT.git"
sed -i 's/pyopencl/ocl-icd/' .test-conda-env-py3.yml
build_py_project_in_conda_env
test_py_project
# vim: sw=2
[submodule "pyopencl/compyte"]
path = pyopencl/compyte
url = https://github.com/inducer/compyte
[submodule "src/c_wrapper/mingw-std-threads"]
path = src/c_wrapper/mingw-std-threads
url = https://github.com/meganz/mingw-std-threads.git
- arg: ignore
val: compyte
- arg: generated-members
val:
- cltypes.*
- gl_platform.*
- mako.template
name: test-conda-env-py3
name: test-conda-env
channels:
- inducer
- conda-forge
- defaults
- nodefaults
dependencies:
- python=3
- git
- conda-forge::numpy
- numpy
- ocl-icd
- pocl
- osx-pocl-opencl
- mako
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Kloeckner"
given-names: "Andreas"
orcid: "https://orcid.org/0000-0003-1228-519X"
- family-names: "Yu"
given-names: "Yichao"
- family-names: "Wala"
given-names: "Matt"
- family-names: "Fernando"
given-names: "Isuru"
- family-names: "Bencun"
given-names: "Marko"
- family-names: "Kulkarni"
given-names: "Kaushik"
- family-names: "Diener"
given-names: "Matthias"
- family-names: "Gao"
given-names: "Hao"
- family-names: "Fikl"
given-names: "Alex"
- family-names: "Weiner"
given-names: "Zach"
- family-names: "Weigert"
given-names: "Martin"
- family-names: "Palmer"
given-names: "Rebecca"
- family-names: "Latham"
given-names: "Shane"
- family-names: "Magno"
given-names: "Gonçalo"
- family-names: "Fuller"
given-names: "Henry"
- family-names: "Mackenzie"
given-names: "Jonathan"
- family-names: "Niarchos"
given-names: "Sotiris"
- family-names: "Gill"
given-names: "Shahzaib"
- family-names: "Gohlke"
given-names: "Christoph"
- family-names: "Bhosale"
given-names: "Aditya"
- family-names: "Rothberg"
given-names: "Alex"
- family-names: "Ey"
given-names: "Emanuel"
- family-names: "Rapp"
given-names: "Holger"
- family-names: "van der Walt"
given-names: "Stefan"
# Removed pending resolution of https://github.com/zenodo/zenodo/issues/2343
# - alias: "gw0"
- family-names: "Thalhammer"
given-names: "Gregor"
- family-names: "Kieffer"
given-names: "Jerome"
- family-names: "Poliarnyi"
given-names: "Nikolai"
- family-names: "Bollinger"
given-names: "Drew"
- family-names: "Nitz"
given-names: "Alex"
- family-names: "Bokota"
given-names: "Grzegorz"
orcid: 'https://orcid.org/0000-0002-5470-1676'
title: "PyOpenCL"
version: 2022.1.3
doi: 10.5281/zenodo.6533956
date-released: 2022-03-10
url: "https://github.com/inducer/pyopencl"
license: MIT
cmake_minimum_required(VERSION 3.17...3.26)
project(pyopencl LANGUAGES CXX VERSION ${SKBUILD_PROJECT_VERSION})
if(NOT SKBUILD)
message(WARNING "\
This CMake file is meant to be executed using 'scikit-build'. Running
it directly will almost certainly not produce the desired result. If
you are a user trying to install this package, please use the command
below, which will install all necessary build dependencies, compile
the package in an isolated environment, and then install it.
=====================================================================
$ pip install .
=====================================================================
If you are a software developer, and this is your own package, then
it is usually much more efficient to install the build dependencies
in your environment once and use the following command that avoids
a costly creation of a new virtual environment at every compilation:
=====================================================================
$ pip install nanobind scikit-build-core[pyproject]
$ pip install --no-build-isolation -ve .
=====================================================================
You may optionally add -Ceditable.rebuild=true to auto-rebuild when
the package is imported. Otherwise, you need to re-run the above
after editing C++ files.")
endif()
# {{{ Options
option(PYOPENCL_TRACE "Enable OpenCL tracing" $ENV{PYOPENCL_TRACE})
option(PYOPENCL_ENABLE_GL "Enable OpenGL interoperability" $ENV{PYOPENCL_ENABLE_GL})
option(PYOPENCL_USE_SHIPPED_EXT "Use shipped CL extension header" $ENV{PYOPENCL_USE_SHIPPED_EXT})
set(CL_INC_DIR CACHE STRING "OpenCL include directory")
set(CL_LIB_DIR CACHE STRING "OpenCL library directory")
set(CL_LIBNAME CACHE STRING "OpenCL library name")
set(PYOPENCL_PRETEND_CL_VERSION CACHE STRING "Pretend to be a different OpenCL version")
if(NOT CL_INC_DIR)
message(STATUS "CL_INC_DIR not set, trying to guess it from environment variables.")
if(DEFINED ENV{CL_INC_DIR})
message(STATUS "Using OpenCL include directory from environment '$ENV{CL_INC_DIR}'")
set(CL_INC_DIR $ENV{CL_INC_DIR})
endif()
if(DEFINED ENV{CL_LIB_DIR})
message(STATUS "Using OpenCL library directory from environment '$ENV{CL_INC_DIR}'")
set(CL_LIB_DIR $ENV{CL_LIB_DIR})
endif()
if(DEFINED ENV{CL_LIBNAME})
message(STATUS "Using OpenCL library name from environment '$ENV{CL_LIBNAME}'")
set(CL_LIBNAME $ENV{CL_LIBNAME})
endif()
endif(NOT CL_INC_DIR)
if(NOT CL_INC_DIR)
message(STATUS "CL_INC_DIR not set, trying to guess it from conda environment.")
if(DEFINED ENV{CONDA_PREFIX})
# Linux/MacOS:
if(EXISTS $ENV{CONDA_PREFIX}/lib/libOpenCL${CMAKE_SHARED_LIBRARY_SUFFIX})
message(STATUS "Found OpenCL in conda environment '$ENV{CONDA_PREFIX}'")
set(CL_INC_DIR $ENV{CONDA_PREFIX}/include)
set(CL_LIB_DIR $ENV{CONDA_PREFIX}/lib)
set(CL_LIBNAME OpenCL)
# Windows:
elseif(EXISTS $ENV{CONDA_PREFIX}/Library/lib/OpenCL${CMAKE_STATIC_LIBRARY_SUFFIX})
message(STATUS "Found OpenCL in conda environment '$ENV{CONDA_PREFIX}'")
set(CL_INC_DIR $ENV{CONDA_PREFIX}/Library/include)
set(CL_LIB_DIR $ENV{CONDA_PREFIX}/Library/lib)
set(CL_LIBNAME OpenCL)
endif()
endif(DEFINED ENV{CONDA_PREFIX})
endif(NOT CL_INC_DIR)
if(NOT PYOPENCL_PRETEND_CL_VERSION)
if(DEFINED ENV{PYOPENCL_PRETEND_CL_VERSION})
set(PYOPENCL_PRETEND_CL_VERSION $ENV{PYOPENCL_PRETEND_CL_VERSION})
endif()
endif()
if(PYOPENCL_PRETEND_CL_VERSION)
# Split the version string into a list
string(REPLACE "." ";" VERSION_LIST ${PYOPENCL_PRETEND_CL_VERSION})
# Get the major and minor version numbers
list(GET VERSION_LIST 0 MAJOR)
list(GET VERSION_LIST 1 MINOR)
# Calculate the numerical value
math(EXPR ARG "0x1000*${MAJOR} + 0x10*${MINOR}")
message(STATUS "Pretending to use OpenCL version ${PYOPENCL_PRETEND_CL_VERSION} (${ARG})")
set(PYOPENCL_PRETEND_CL_VERSION ${ARG})
endif()
message(STATUS "CL_INC_DIR ${CL_INC_DIR}")
message(STATUS "CL_LIB_DIR ${CL_LIB_DIR}")
message(STATUS "CL_LIBNAME ${CL_LIBNAME}")
# }}}
# {{{ Get version information
find_program(GIT git)
if(GIT AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
# Exact tag match => released version
execute_process(COMMAND git describe --exact-match --dirty=*
OUTPUT_VARIABLE PYOPENCL_VERSION_GIT
RESULT_VARIABLE git_result
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if(NOT ${git_result} EQUAL 0)
# No exact tag match => development version
execute_process(COMMAND git describe --long --always --dirty=*
OUTPUT_VARIABLE PYOPENCL_VERSION_GIT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(PYOPENCL_REL "(dev)")
else()
set(PYOPENCL_REL "(release)")
endif()
else()
set(PYOPENCL_VERSION_GIT "v${PROJECT_VERSION}")
set(PYOPENCL_REL "(non-git)")
endif()
# }}}
find_package(Python COMPONENTS Interpreter Development.Module NumPy REQUIRED)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# {{{ Detect nanobind and import it
execute_process(
COMMAND
"${PYTHON_EXECUTABLE}" -c "import nanobind; print(nanobind.__version__)"
OUTPUT_VARIABLE NANOBIND_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT)
execute_process(
COMMAND
"${PYTHON_EXECUTABLE}" -c "import nanobind; print(nanobind.cmake_dir())"
OUTPUT_VARIABLE NANOBIND_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT)
list(APPEND CMAKE_PREFIX_PATH "${NANOBIND_DIR}")
# }}}
link_directories(${CL_LIB_DIR})
include_directories(${CL_INC_DIR} ${Python_NumPy_INCLUDE_DIRS})
find_package(nanobind CONFIG REQUIRED)
set(OpenCL_ROOT ${CL_LIB_DIR})
set(OpenCL_INCLUDE_DIR ${CL_INC_DIR})
set(OpenCL_LIBRARY ${CL_LIBNAME})
find_package(OpenCL REQUIRED)
nanobind_add_module(
_cl
NB_STATIC # Build static libnanobind (the extension module itself remains a shared library)
LTO
NOMINSIZE
src/wrap_constants.cpp
src/wrap_cl.cpp
src/wrap_cl_part_1.cpp
src/wrap_cl_part_2.cpp
src/wrap_mempool.cpp
src/bitlog.cpp
)
target_link_libraries(_cl PRIVATE ${OpenCL_LIBRARY})
target_compile_definitions(_cl
PRIVATE
PYGPU_PACKAGE=pyopencl
PYGPU_PYOPENCL
)
if (PYOPENCL_PRETEND_CL_VERSION)
target_compile_definitions(
_cl PRIVATE PYOPENCL_PRETEND_CL_VERSION=${PYOPENCL_PRETEND_CL_VERSION})
endif()
if (PYOPENCL_ENABLE_GL)
target_compile_definitions(_cl PRIVATE HAVE_GL=1)
endif()
if (PYOPENCL_TRACE)
target_compile_definitions(_cl PRIVATE PYOPENCL_TRACE=1)
endif()
if (PYOPENCL_USE_SHIPPED_EXT)
target_compile_definitions(_cl PRIVATE PYOPENCL_USE_SHIPPED_EXT=1)
endif()
install(TARGETS _cl LIBRARY DESTINATION pyopencl)
# {{{ Print configuration
message("==============================")
message("PyOpenCL ${PYOPENCL_VERSION_GIT} ${PYOPENCL_REL} configuration: ")
message(" PyOpenCL options: PYOPENCL_TRACE=${PYOPENCL_TRACE} PYOPENCL_ENABLE_GL=${PYOPENCL_ENABLE_GL} PYOPENCL_USE_SHIPPED_EXT=${PYOPENCL_USE_SHIPPED_EXT} PYOPENCL_PRETEND_CL_VERSION=${PYOPENCL_PRETEND_CL_VERSION}")
message(" OpenCL: ${OpenCL_LIBRARIES} [${OpenCL_VERSION_STRING}]")
message(" Python: ${Python_EXECUTABLE} [${Python_VERSION}]")
message(" Build type: ${CMAKE_BUILD_TYPE}")
message(" C++ compiler: ${CMAKE_CXX_COMPILER} [${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}]")
message(" CMake: ${CMAKE_COMMAND} [${CMAKE_VERSION}]")
message(" Nanobind: ${NANOBIND_DIR} [${NANOBIND_VERSION}]")
message(" Build tool: ${CMAKE_MAKE_PROGRAM}")
message("==============================")
# }}}
# vim: foldmethod=marker:sw=2
......@@ -24,7 +24,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
PyOpenCL includes derivatives of parts of the `Thrust
<https://github.com/thrust/thrust/>`_ computing package (in particular the scan
<https://github.com/NVIDIA/thrust>`_ computing package (in particular the scan
implementation). These parts are licensed as follows:
Copyright 2008-2011 NVIDIA Corporation
......@@ -33,7 +33,7 @@ implementation). These parts are licensed as follows:
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
<http://www.apache.org/licenses/LICENSE-2.0>
<https://www.apache.org/licenses/LICENSE-2.0>
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
......@@ -78,26 +78,3 @@ PyOpenCL includes parts of the Random123 suite of random number generators:
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PyOpenCL includes the RANLUXCL random number generator:
Copyright (c) 2011 Ivar Ursin Nikolaisen
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
recursive-include pyopencl/cl *.h *.cl
include src/c_wrapper/*.hpp
include src/c_wrapper/*.h
include src/c_wrapper/*.cpp
include src/c_wrapper/mingw-std-threads/mingw.*.h
include src/c_wrapper/mingw-std-threads/README.md
include *.h
include test/*.py
include test/*.h
include examples/*.py
include examples/*.ipynb
include doc/*.rst
include doc/Makefile
include doc/*.py
include doc/conf.py
include doc/_static/*.css
include doc/_templates/*.html
include *.py.in
include configure.py
include Makefile.in
include aksetup_helper.py
include README_SETUP.txt
include README.rst
include LICENSE
recursive-include contrib *.vim *.py README
.PHONY : all install clean tags dist userdoc devdoc
all: tags
${PYTHON_EXE} setup.py build
dist:
${PYTHON_EXE} setup.py sdist
install: tags
${PYTHON_EXE} setup.py install
clean:
rm -Rf build
rm -f tags
tags:
ctags -R src || true
tests:
echo "running tests"
find ./test -type f -name "*.py" -exec python {} \;