pyomp 0.4.0__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. {pyomp-0.4.0 → pyomp-0.5.0}/.github/workflows/build-upload-wheels.yml +11 -5
  2. {pyomp-0.4.0 → pyomp-0.5.0}/.gitlab/jobs/tioga.yml +1 -0
  3. pyomp-0.5.0/MANIFEST.in +1 -0
  4. {pyomp-0.4.0 → pyomp-0.5.0}/PKG-INFO +4 -3
  5. {pyomp-0.4.0 → pyomp-0.5.0}/README.md +1 -0
  6. {pyomp-0.4.0 → pyomp-0.5.0}/buildscripts/cibuildwheel/setup-miniconda3.sh +3 -3
  7. pyomp-0.5.0/buildscripts/conda-recipes/pyomp/meta.yaml +77 -0
  8. {pyomp-0.4.0 → pyomp-0.5.0}/buildscripts/gitlab/build-and-test.sh +8 -3
  9. {pyomp-0.4.0 → pyomp-0.5.0}/examples/ploop.1.py +5 -4
  10. {pyomp-0.4.0 → pyomp-0.5.0}/pyproject.toml +29 -12
  11. pyomp-0.5.0/setup.py +288 -0
  12. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/__init__.py +28 -8
  13. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/_version.py +3 -3
  14. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/compiler.py +13 -1
  15. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/config.py +2 -1
  16. pyomp-0.5.0/src/numba/openmp/libs/openmp/patches/20.1.8/0001-Enable-standalone-build.patch +13 -0
  17. pyomp-0.5.0/src/numba/openmp/libs/openmp/patches/20.1.8/0002-Link-statically-LLVM.patch +24 -0
  18. pyomp-0.5.0/src/numba/openmp/libs/openmp/patches/20.1.8/0003-Do-not-build-liboffload.patch +12 -0
  19. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/libs/pass/CGIntrinsicsOpenMP.cpp +162 -187
  20. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/libs/pass/CGIntrinsicsOpenMP.h +1 -1
  21. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/libs/pass/CMakeLists.txt +2 -2
  22. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/libs/pass/IntrinsicsOpenMP.cpp +21 -15
  23. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/llvm_pass.py +3 -1
  24. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/omp_ir.py +61 -45
  25. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/omp_lower.py +2 -1
  26. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/tests/test_openmp.py +1 -7
  27. {pyomp-0.4.0 → pyomp-0.5.0}/src/pyomp.egg-info/PKG-INFO +4 -3
  28. {pyomp-0.4.0 → pyomp-0.5.0}/src/pyomp.egg-info/SOURCES.txt +11 -8
  29. {pyomp-0.4.0 → pyomp-0.5.0}/src/pyomp.egg-info/requires.txt +1 -1
  30. {pyomp-0.4.0 → pyomp-0.5.0}/src/pyomp.egg-info/top_level.txt +0 -1
  31. pyomp-0.4.0/MANIFEST.in +0 -1
  32. pyomp-0.4.0/buildscripts/conda-recipes/pyomp/meta.yaml +0 -96
  33. pyomp-0.4.0/setup.py +0 -210
  34. {pyomp-0.4.0 → pyomp-0.5.0}/.github/workflows/build-containers.yml +0 -0
  35. {pyomp-0.4.0 → pyomp-0.5.0}/.github/workflows/build-upload-conda.yml +0 -0
  36. {pyomp-0.4.0 → pyomp-0.5.0}/.gitignore +0 -0
  37. {pyomp-0.4.0 → pyomp-0.5.0}/.gitlab/custom-jobs-and-variables.yml +0 -0
  38. {pyomp-0.4.0 → pyomp-0.5.0}/.gitlab/subscribed-pipelines.yml +0 -0
  39. {pyomp-0.4.0 → pyomp-0.5.0}/.gitlab-ci.yml +0 -0
  40. {pyomp-0.4.0 → pyomp-0.5.0}/.gitmodules +0 -0
  41. {pyomp-0.4.0 → pyomp-0.5.0}/.readthedocs.yaml +0 -0
  42. {pyomp-0.4.0 → pyomp-0.5.0}/LICENSE +0 -0
  43. {pyomp-0.4.0 → pyomp-0.5.0}/LICENSE-OPENMP.txt +0 -0
  44. {pyomp-0.4.0 → pyomp-0.5.0}/buildscripts/conda-recipes/pyomp/conda_build_config.yaml +0 -0
  45. {pyomp-0.4.0 → pyomp-0.5.0}/buildscripts/conda-recipes/pyomp/run_test.sh +0 -0
  46. {pyomp-0.4.0 → pyomp-0.5.0}/buildscripts/containers/Dockerfile +0 -0
  47. {pyomp-0.4.0 → pyomp-0.5.0}/buildscripts/containers/examples/hello.py +0 -0
  48. {pyomp-0.4.0 → pyomp-0.5.0}/buildscripts/containers/examples/pi_loop.py +0 -0
  49. {pyomp-0.4.0 → pyomp-0.5.0}/buildscripts/containers/examples/pi_spmd.py +0 -0
  50. {pyomp-0.4.0 → pyomp-0.5.0}/buildscripts/containers/examples/pi_task.py +0 -0
  51. {pyomp-0.4.0 → pyomp-0.5.0}/buildscripts/gitlab/create-conda-pkgs.sh +0 -0
  52. {pyomp-0.4.0 → pyomp-0.5.0}/docs/Makefile +0 -0
  53. {pyomp-0.4.0 → pyomp-0.5.0}/docs/requirements.txt +0 -0
  54. {pyomp-0.4.0 → pyomp-0.5.0}/docs/source/conf.py +0 -0
  55. {pyomp-0.4.0 → pyomp-0.5.0}/docs/source/index.rst +0 -0
  56. {pyomp-0.4.0 → pyomp-0.5.0}/docs/source/installation.rst +0 -0
  57. {pyomp-0.4.0 → pyomp-0.5.0}/docs/source/openmp.rst +0 -0
  58. {pyomp-0.4.0 → pyomp-0.5.0}/docs/source/usage.rst +0 -0
  59. {pyomp-0.4.0 → pyomp-0.5.0}/examples/TestDataEnv.py +0 -0
  60. {pyomp-0.4.0 → pyomp-0.5.0}/examples/dgemm_ompGPU.py +0 -0
  61. {pyomp-0.4.0 → pyomp-0.5.0}/examples/hello-target.py +0 -0
  62. {pyomp-0.4.0 → pyomp-0.5.0}/examples/hello.py +0 -0
  63. {pyomp-0.4.0 → pyomp-0.5.0}/examples/piParLoopGPU_BUD.py +0 -0
  64. {pyomp-0.4.0 → pyomp-0.5.0}/examples/piParLoopGPU_BUD_combined.py +0 -0
  65. {pyomp-0.4.0 → pyomp-0.5.0}/examples/piParLoopGPU_loop.py +0 -0
  66. {pyomp-0.4.0 → pyomp-0.5.0}/examples/pi_loop.py +0 -0
  67. {pyomp-0.4.0 → pyomp-0.5.0}/examples/pi_spmd.py +0 -0
  68. {pyomp-0.4.0 → pyomp-0.5.0}/examples/pi_task.py +0 -0
  69. {pyomp-0.4.0 → pyomp-0.5.0}/setup.cfg +0 -0
  70. {pyomp-0.4.0 → pyomp-0.5.0}/slides/PyOMP_SC24.pdf +0 -0
  71. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/analysis.py +0 -0
  72. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/decorators.py +0 -0
  73. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/exceptions.py +0 -0
  74. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/ir_utils.py +0 -0
  75. {pyomp-0.4.0/src/numba/openmp/libs/libomp → pyomp-0.5.0/src/numba/openmp/libs/openmp}/patches/14.0.6/0001-BACKPORT-Fix-for-CUDA-OpenMP-RTL.patch +0 -0
  76. {pyomp-0.4.0/src/numba/openmp/libs/libomp → pyomp-0.5.0/src/numba/openmp/libs/openmp}/patches/14.0.6/0002-Fix-missing-includes.patch +0 -0
  77. {pyomp-0.4.0/src/numba/openmp/libs/libomp → pyomp-0.5.0/src/numba/openmp/libs/openmp}/patches/14.0.6/0003-Link-static-LLVM-libs.patch +0 -0
  78. {pyomp-0.4.0/src/numba/openmp/libs/libomp → pyomp-0.5.0/src/numba/openmp/libs/openmp}/patches/15.0.7/0001-Fix-missing-includes.patch +0 -0
  79. {pyomp-0.4.0/src/numba/openmp/libs/libomp → pyomp-0.5.0/src/numba/openmp/libs/openmp}/patches/15.0.7/0002-Link-LLVM-statically.patch +0 -0
  80. {pyomp-0.4.0/src/numba/openmp/libs/libomp → pyomp-0.5.0/src/numba/openmp/libs/openmp}/patches/15.0.7/0003-Disable-opaque-pointers-DeviceRTL-bitcode.patch +0 -0
  81. {pyomp-0.4.0/src/numba/openmp/libs/libomp → pyomp-0.5.0/src/numba/openmp/libs/openmp}/patches/16.0.6/0001-Load-plugins-from-install-directory.patch +0 -0
  82. {pyomp-0.4.0/src/numba/openmp/libs/libomp → pyomp-0.5.0/src/numba/openmp/libs/openmp}/patches/16.0.6/0002-Link-LLVM-statically.patch +0 -0
  83. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/libs/pass/DebugOpenMP.cpp +0 -0
  84. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/libs/pass/DebugOpenMP.h +0 -0
  85. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/libs/pass/IntrinsicsOpenMP.h +0 -0
  86. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/libs/pass/IntrinsicsOpenMP_CAPI.h +0 -0
  87. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/link_utils.py +0 -0
  88. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/llvmlite_extensions.py +0 -0
  89. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/omp_context.py +0 -0
  90. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/omp_grammar.py +0 -0
  91. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/omp_runtime.py +0 -0
  92. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/overloads.py +0 -0
  93. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/parser.py +0 -0
  94. {pyomp-0.4.0 → pyomp-0.5.0}/src/numba/openmp/tags.py +0 -0
  95. {pyomp-0.4.0 → pyomp-0.5.0}/src/pyomp.egg-info/dependency_links.txt +0 -0
@@ -35,13 +35,13 @@ jobs:
35
35
  - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
36
36
 
37
37
  - name: Install cibuildwheel
38
- run: python -m pip install cibuildwheel==3.1.4
38
+ run: python -m pip install cibuildwheel==3.3.1
39
39
 
40
40
  - name: Build wheels {{ matrix.os }}
41
41
  # Set LLVM_VERSION for the host to forward to the cibuildwheel
42
42
  # environment.
43
43
  env:
44
- LLVM_VERSION: "15.0.7"
44
+ LLVM_VERSION: "20.1.8"
45
45
  run: python -m cibuildwheel --output-dir wheelhouse
46
46
 
47
47
  - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
@@ -58,7 +58,7 @@ jobs:
58
58
 
59
59
  - name: Build sdist
60
60
  env:
61
- LLVM_VERSION: "15.0.7"
61
+ LLVM_VERSION: "20.1.8"
62
62
  run: pipx run build --sdist
63
63
 
64
64
  - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
@@ -73,8 +73,14 @@ jobs:
73
73
  strategy:
74
74
  matrix:
75
75
  os: [ubuntu-latest, macos-latest, ubuntu-24.04-arm]
76
- python-version: ['3.10', '3.11', '3.12', '3.13']
77
- numba-version: ['0.61.0', '0.61.2']
76
+ python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
77
+ numba-version: ['0.62.0', '0.62.1', '0.63.0', '0.63.1']
78
+ exclude:
79
+ - python-version: '3.14'
80
+ numba-version: '0.62.0'
81
+ - python-version: '3.14'
82
+ numba-version: '0.62.1'
83
+
78
84
  steps:
79
85
  - name: Download built wheels
80
86
  uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
@@ -56,6 +56,7 @@ variables:
56
56
  - "3.11"
57
57
  - "3.12"
58
58
  - "3.13"
59
+ - "3.14"
59
60
 
60
61
  build-and-test-tioga:
61
62
  extends: [.base-job, .python-variants]
@@ -0,0 +1 @@
1
+ recursive-include src/numba/openmp/libs *.py *.so *.a *.bc
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyomp
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Python OpenMP library based on Numba
5
5
  Maintainer-email: Giorgis Georgakoudis <georgakoudis1@llnl.gov>
6
6
  License-Expression: BSD-2-Clause
@@ -11,11 +11,11 @@ Classifier: Operating System :: OS Independent
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Intended Audience :: Developers
13
13
  Classifier: Topic :: Software Development :: Compilers
14
- Requires-Python: <3.14,>=3.10
14
+ Requires-Python: <3.15,>=3.10
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
17
  License-File: LICENSE-OPENMP.txt
18
- Requires-Dist: numba<0.62,>=0.61
18
+ Requires-Dist: numba<0.64,>=0.62
19
19
  Requires-Dist: lark
20
20
  Requires-Dist: cffi
21
21
  Requires-Dist: setuptools
@@ -68,6 +68,7 @@ conda install -c python-for-hpc -c conda-forge pyomp
68
68
 
69
69
  | PyOMP | Numba |
70
70
  | ----- | --------------- |
71
+ | 0.5.x | 0.62.x - 0.63.x |
71
72
  | 0.4.x | 0.61.x |
72
73
  | 0.3.x | 0.57.x - 0.60.x |
73
74
 
@@ -45,6 +45,7 @@ conda install -c python-for-hpc -c conda-forge pyomp
45
45
 
46
46
  | PyOMP | Numba |
47
47
  | ----- | --------------- |
48
+ | 0.5.x | 0.62.x - 0.63.x |
48
49
  | 0.4.x | 0.61.x |
49
50
  | 0.3.x | 0.57.x - 0.60.x |
50
51
 
@@ -23,6 +23,6 @@ echo "Miniconda installed"
23
23
  source "_stage/miniconda3/bin/activate" base
24
24
  export CONDA_PLUGINS_AUTO_ACCEPT_TOS=true
25
25
 
26
- # Create clangdev ${LLVM_VERSION}
27
- echo "Installing manylinux llvmdev ${LLVM_VERSION}..."
28
- conda create -n llvmdev-${LLVM_VERSION} -c conda-forge -q -y clang=${LLVM_VERSION} clang-tools=${LLVM_VERSION} llvmdev=${LLVM_VERSION}
26
+ # Create conda environment with tools and libraries for the LLVM_VERSION.
27
+ echo "Installing llvmdev ${LLVM_VERSION}..."
28
+ conda create -n llvmdev-${LLVM_VERSION} -c conda-forge -q -y clang=${LLVM_VERSION} clangxx=${LLVM_VERSION} clang-tools=${LLVM_VERSION} llvmdev=${LLVM_VERSION} zstd
@@ -0,0 +1,77 @@
1
+ {% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0').lstrip('v') %}
2
+ {% set LLVM_VERSION = environ.get('LLVM_VERSION', '20.1.8') %}
3
+
4
+ package:
5
+ name: pyomp
6
+ version: {{ version }}
7
+
8
+ source:
9
+ path: ../../..
10
+
11
+ build:
12
+ string: py{{ PY_VER }}h{{ PKG_HASH }}_{{GIT_DESCRIBE_HASH}}_{{ GIT_DESCRIBE_NUMBER }}
13
+ script_env:
14
+ - PY_VCRUNTIME_REDIST # [win]
15
+ script:
16
+ - export LLVM_VERSION={{ LLVM_VERSION }}
17
+ - export LLVM_DIR=${PREFIX}
18
+ - export CC=${PREFIX}/bin/clang
19
+ - export CXX=${PREFIX}/bin/clang++
20
+ - export VERBOSE=1
21
+ - export CPPFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET} -isystem ${PREFIX}/include -D_FORTIFY_SOURCE=2" # [osx]
22
+ - export ENABLE_BUNDLED_LIBOMPTARGET=1 # [linux]
23
+ - rm -rf build dist src/*.egg-info
24
+ - {{ PYTHON }} -m pip install -v .
25
+
26
+ requirements:
27
+ build:
28
+ - {{ compiler('c') }}
29
+ - {{ compiler('cxx') }}
30
+ # Add sysroot to ensure compatibility on linux builds.
31
+ - sysroot_linux-64 # [linux64]
32
+ - sysroot_linux-aarch64 # [aarch64]
33
+ - cmake
34
+ - ninja
35
+ - setuptools_scm
36
+ - elfutils # [linux]
37
+ - libffi # [linux]
38
+ host:
39
+ - python
40
+ - pip
41
+ # Add sysroot to ensure compatibility on linux builds.
42
+ - sysroot_linux-64 # [linux64]
43
+ - sysroot_linux-aarch64 # [aarch64]
44
+ - setuptools
45
+ - setuptools_scm
46
+ - numba >=0.62, <0.64
47
+ - clang {{ LLVM_VERSION }}
48
+ - clangxx {{ LLVM_VERSION }}
49
+ - clang-tools {{ LLVM_VERSION }}
50
+ - llvmdev {{ LLVM_VERSION }}
51
+ - zlib
52
+ # require llvm-openmp for the openmp cpu runtime.
53
+ - llvm-openmp {{ LLVM_VERSION }}
54
+ - elfutils # [linux]
55
+ - libffi # [linux]
56
+ run:
57
+ - python
58
+ - setuptools
59
+ - numba >=0.62, <0.64
60
+ # require llvm-openmp for the openmp cpu runtime.
61
+ - llvm-openmp {{ LLVM_VERSION }}
62
+ - lark
63
+ - cffi
64
+
65
+ test:
66
+ commands:
67
+ - test -f $SP_DIR/numba/openmp/libs/pass/libIntrinsicsOpenMP.dylib # [osx]
68
+ - test -f $SP_DIR/numba/openmp/libs/pass/libIntrinsicsOpenMP.so # [linux]
69
+ - test -f $SP_DIR/numba/openmp/libs/openmp/lib/libomptarget-amdgpu.bc # [linux]
70
+ - test -f $SP_DIR/numba/openmp/libs/openmp/lib/libomptarget-nvptx.bc # [linux]
71
+ - test -f $SP_DIR/numba/openmp/libs/openmp/lib/libomptarget.so # [linux]
72
+
73
+ about:
74
+ home: https://github.com/Python-for-HPC/PyOMP
75
+ license: BSD-2-Clause
76
+ license_file: LICENSE
77
+ summary: "PyOMP: OpenMP for portable CPU/GPU parallel programming in Python using Numba."
@@ -4,11 +4,12 @@ set -e
4
4
 
5
5
  # Create a unique temporary directory for this job.
6
6
  TMPDIR=/tmp/pyomp/${CI_JOB_ID}
7
+ rm -rf ${TMPDIR}
7
8
  mkdir -p ${TMPDIR}
8
9
  pushd ${TMPDIR}
9
10
 
10
11
  # Set the LLVM_VERSION to use.
11
- export LLVM_VERSION="15.0.7"
12
+ export LLVM_VERSION="20.1.8"
12
13
 
13
14
  # Set the envs directory under the temporary directory.
14
15
  export CONDA_ENVS_DIRS="${TMPDIR}/_stage/miniconda3/envs"
@@ -17,14 +18,18 @@ export CONDA_ENVS_DIRS="${TMPDIR}/_stage/miniconda3/envs"
17
18
  source ${CI_PROJECT_DIR}/buildscripts/cibuildwheel/setup-miniconda3.sh
18
19
 
19
20
  # Export environment variables for building and testing.
21
+ export ENABLE_BUNDLED_LIBOMP="1"
22
+ export ENABLE_BUNDLED_LIBOMPTARGET="1"
20
23
  export LLVM_DIR="${CONDA_ENVS_DIRS}/llvmdev-${LLVM_VERSION}"
21
- export PATH="${CONDA_ENVS_DIRS}/llvmdev-${LLVM_VERSION}/bin:${PATH}"
24
+ export CMAKE_PREFIX_PATH="${CONDA_PREFIX}"
22
25
  export USE_CXX11_ABI="1"
23
26
  export PIP_NO_INPUT="1"
24
27
 
25
28
  # Create and activate a conda environment with the desired Python version.
26
29
  conda create -n py-${PYOMP_CI_PYTHON_VERSION} -c conda-forge -y python=${PYOMP_CI_PYTHON_VERSION}
27
30
  conda activate py-${PYOMP_CI_PYTHON_VERSION}
31
+ # Add extra packages needed to build openmp libraries.
32
+ conda install -c conda-forge -y zstd libffi
28
33
 
29
34
  # Clone and fetch the commit with history for package versioning.
30
35
  git clone https://github.com/${GITHUB_PROJECT_ORG}/${GITHUB_PROJECT_NAME}.git --single-branch
@@ -33,7 +38,7 @@ git fetch origin ${CI_COMMIT_SHA}
33
38
  git checkout ${CI_COMMIT_SHA}
34
39
 
35
40
  # Install pyomp.
36
- CC=gcc CXX=g++ python -m pip install -v .
41
+ CC=clang CXX=clang++ python -m pip install -v .
37
42
 
38
43
  # Run host OpenMP tests.
39
44
  TEST_DEVICES=0 RUN_TARGET=0 python -m numba.runtests -v -- numba.openmp.tests.test_openmp
@@ -1,13 +1,14 @@
1
- import numba
1
+ from numba.openmp import njit
2
2
  from numba.openmp import openmp_context as openmp
3
- from numba.openmp import omp_set_num_threads, omp_get_thread_num, omp_get_num_threads, omp_get_wtime
4
3
  import numpy as np
5
4
 
6
- @numba.njit
5
+
6
+ @njit
7
7
  def simple(n, a, b):
8
8
  with openmp("parallel for"):
9
9
  for i in range(1, n):
10
- b[i] = (a[i] + a[i-1]) / 2.0
10
+ b[i] = (a[i] + a[i - 1]) / 2.0
11
+
11
12
 
12
13
  a = np.ones(100)
13
14
  b = np.empty(len(a))
@@ -1,5 +1,5 @@
1
1
  [build-system]
2
- requires = ["setuptools>=75.3", "wheel", "setuptools-scm>=8", "cmake>=3.20"]
2
+ requires = ["setuptools>=75.3", "setuptools-scm>=8", "cmake>=3.20", "ninja"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
@@ -7,7 +7,7 @@ name = "pyomp"
7
7
  dynamic = ["version"]
8
8
  description = "Python OpenMP library based on Numba"
9
9
  readme = "README.md"
10
- requires-python = ">=3.10, <3.14"
10
+ requires-python = ">=3.10, <3.15"
11
11
  license = "BSD-2-Clause"
12
12
  license-files = ["LICENSE", "LICENSE-OPENMP.txt"]
13
13
  classifiers = [
@@ -17,7 +17,7 @@ classifiers = [
17
17
  "Intended Audience :: Developers",
18
18
  "Topic :: Software Development :: Compilers",
19
19
  ]
20
- dependencies = ["numba>=0.61, <0.62", "lark", "cffi", "setuptools"]
20
+ dependencies = ["numba>=0.62, <0.64", "lark", "cffi", "setuptools"]
21
21
  maintainers = [
22
22
  { name = "Giorgis Georgakoudis", email = "georgakoudis1@llnl.gov" },
23
23
  ]
@@ -37,7 +37,7 @@ include = ["numba.openmp*"]
37
37
 
38
38
  # Bundle the CMake-installed artifacts into the wheel.
39
39
  [tool.setuptools.package-data]
40
- "numba.openmp.libs" = ["pass/*", "libomp/**/*"]
40
+ "numba.openmp.libs" = ["pass/*", "openmp/**/*"]
41
41
 
42
42
  # setuptools-scm config
43
43
  [tool.setuptools_scm]
@@ -49,7 +49,6 @@ archs = ["native"]
49
49
  # Pass LLVM_VERSION from the host environment to cibuildwheel.
50
50
  environment-pass = ["LLVM_VERSION"]
51
51
  # We use miniconda3 to get the clang/llvm toolchain on Linux.
52
- before-all = ["bash buildscripts/cibuildwheel/setup-miniconda3.sh"]
53
52
  before-build = ["rm -rf build dist src/*.egg-info"]
54
53
  skip = ["*-musllinux_*", "cp38-*"]
55
54
  test-command = [
@@ -59,14 +58,32 @@ test-command = [
59
58
  "OMP_TARGET_OFFLOAD=mandatory TEST_DEVICES=1 RUN_TARGET=1 python -m numba.runtests -v -- numba.openmp.tests.test_openmp.TestOpenmpTarget",
60
59
  ]
61
60
 
61
+ [tool.cibuildwheel.environment]
62
+ USE_CXX11_ABI = "1"
63
+ PIP_NO_INPUT = "1"
64
+
62
65
  [tool.cibuildwheel.linux]
63
66
  before-all = [
64
- "yum install -y elfutils-libelf-devel libffi-devel",
65
- "bash buildscripts/cibuildwheel/setup-miniconda3.sh",
67
+ "yum install -y elfutils-libelf-devel libffi-devel clang-devel-20.1.8 llvm-devel-20.1.8",
66
68
  ]
67
69
 
68
- [tool.cibuildwheel.environment]
69
- LLVM_DIR = "${PWD}/_stage/miniconda3/envs/llvmdev-${LLVM_VERSION}"
70
- PATH = "${PWD}/_stage/miniconda3/envs/llvmdev-${LLVM_VERSION}/bin:${PATH}"
71
- USE_CXX11_ABI = "1"
72
- PIP_NO_INPUT = "1"
70
+ [tool.cibuildwheel.linux.environment]
71
+ ENABLE_BUNDLED_LIBOMP = "1"
72
+ ENABLE_BUNDLED_LIBOMPTARGET = "1"
73
+ LLVM_DIR = "/usr/lib64/cmake/llvm"
74
+ CC = "/usr/bin/clang"
75
+ CXX = "/usr/bin/clang++"
76
+
77
+ [tool.cibuildwheel.macos]
78
+ before-all = ["bash buildscripts/cibuildwheel/setup-miniconda3.sh"]
79
+
80
+ [tool.cibuildwheel.macos.environment]
81
+ ENABLE_BUNDLED_LIBOMP = "1"
82
+ LLVM_DIR = "${PWD}/_stage/miniconda3/envs/llvmdev-${LLVM_VERSION}/lib/cmake/llvm"
83
+ CC = "${PWD}/_stage/miniconda3/envs/llvmdev-${LLVM_VERSION}/bin/clang"
84
+ CXX = "${PWD}/_stage/miniconda3/envs/llvmdev-${LLVM_VERSION}/bin/clang++"
85
+ # Set the deplioyment target to macOS 11.0.
86
+ MACOSX_DEPLOYMENT_TARGET = "11.0"
87
+ # Set the cmake prefix path to find libraries in the conda environment which is
88
+ # compatible with the macos target.
89
+ CMAKE_PREFIX_PATH = "${PWD}/_stage/miniconda3/envs/llvmdev-${LLVM_VERSION}/"
pyomp-0.5.0/setup.py ADDED
@@ -0,0 +1,288 @@
1
+ from pathlib import Path
2
+ import subprocess
3
+ import shutil
4
+ import tarfile
5
+ import urllib
6
+ import sys
7
+ import os
8
+ from setuptools import setup, Extension
9
+ from setuptools import Command
10
+ from setuptools.command.build_ext import build_ext
11
+ from setuptools.command.bdist_wheel import bdist_wheel
12
+
13
+
14
+ class CleanCommand(Command):
15
+ """Custom clean command to tidy up the project root."""
16
+
17
+ user_options = []
18
+
19
+ def initialize_options(self):
20
+ pass
21
+
22
+ def finalize_options(self):
23
+ pass
24
+
25
+ def run(self):
26
+ for path in ["build", "dist", "src/numba/openmp/libs"]:
27
+ shutil.rmtree(path, ignore_errors=True)
28
+ for egg_info in Path("src").rglob("*.egg-info"):
29
+ shutil.rmtree(egg_info, ignore_errors=True)
30
+
31
+
32
+ class CustomBdistWheel(bdist_wheel):
33
+ def run(self):
34
+ # Ensure all build steps are run before bdist_wheel
35
+ self.run_command("build_ext")
36
+ super().run()
37
+
38
+
39
+ class CMakeExtension(Extension):
40
+ def __init__(
41
+ self,
42
+ name,
43
+ *,
44
+ source_dir=None,
45
+ install_dir=None,
46
+ url=None,
47
+ sha256=None,
48
+ cmake_args=[],
49
+ ):
50
+ # Don't invoke the original build_ext for this special extension.
51
+ super().__init__(name, sources=[])
52
+ if source_dir and url:
53
+ raise ValueError(
54
+ "CMakeExtension should have either a source_dir or a url, not both."
55
+ )
56
+ self.source_dir = source_dir
57
+ self.install_dir = install_dir
58
+ self.url = url
59
+ self.sha256 = sha256
60
+ self.cmake_args = cmake_args
61
+
62
+
63
+ class BuildCMakeExt(build_ext):
64
+ def run(self):
65
+ for ext in self.extensions:
66
+ if isinstance(ext, CMakeExtension):
67
+ self._build_cmake(ext)
68
+ else:
69
+ super().run()
70
+
71
+ def finalize_options(self):
72
+ super().finalize_options()
73
+ # Create placeholder directories for package-data validation.
74
+ Path("src/numba/openmp/libs/openmp/lib").mkdir(parents=True, exist_ok=True)
75
+
76
+ def _build_cmake(self, ext: CMakeExtension):
77
+ print("Build CMake extension:", ext.name)
78
+ # Delete build directory if it exists to avoid errors with stale
79
+ # CMakeCache.txt leftovers.
80
+ build_dir = Path(self.build_temp) / ext.name
81
+ shutil.rmtree(build_dir, ignore_errors=True)
82
+ build_dir.mkdir(parents=True, exist_ok=True)
83
+
84
+ lib_dir = Path(
85
+ self.get_finalized_command("build_py").get_package_dir("numba.openmp.libs")
86
+ )
87
+
88
+ extra_cmake_args = self._env_toolchain_args(ext)
89
+ # Set RPATH.
90
+ if sys.platform.startswith("linux"):
91
+ extra_cmake_args.append(r"-DCMAKE_INSTALL_RPATH=$ORIGIN")
92
+ elif sys.platform == "darwin":
93
+ extra_cmake_args.append(r"-DCMAKE_INSTALL_RPATH=@loader_path")
94
+
95
+ if ext.install_dir is None:
96
+ install_dir = Path(lib_dir) / ext.name
97
+ else:
98
+ install_dir = Path(lib_dir) / ext.install_dir
99
+ install_dir.mkdir(parents=True, exist_ok=True)
100
+
101
+ cfg = (
102
+ [
103
+ "cmake",
104
+ "-S",
105
+ ext.source_dir,
106
+ "-B",
107
+ build_dir,
108
+ "-G",
109
+ "Ninja",
110
+ "-DCMAKE_BUILD_TYPE=Release",
111
+ f"-DCMAKE_INSTALL_PREFIX={install_dir}",
112
+ ]
113
+ + ext.cmake_args
114
+ + extra_cmake_args
115
+ )
116
+ print("Configure cmake with args:", cfg)
117
+ subprocess.run(cfg, check=True, stdin=subprocess.DEVNULL)
118
+
119
+ print("Build at dir ", build_dir)
120
+ subprocess.run(
121
+ ["cmake", "--build", build_dir, "-j"], check=True, stdin=subprocess.DEVNULL
122
+ )
123
+ print("Install at dir ", install_dir)
124
+ subprocess.run(
125
+ ["cmake", "--install", build_dir], check=True, stdin=subprocess.DEVNULL
126
+ )
127
+
128
+ # Remove unnecessary files after installing libomp.
129
+ if ext.name.startswith("libomp"):
130
+ # Remove include directory after install.
131
+ include_dir = install_dir / "include"
132
+ if include_dir.exists():
133
+ shutil.rmtree(include_dir)
134
+ # Remove cmake directory after install.
135
+ include_dir = install_dir / "lib/cmake"
136
+ if include_dir.exists():
137
+ shutil.rmtree(include_dir)
138
+
139
+ def _env_toolchain_args(self, ext):
140
+ args = []
141
+ # Forward LLVM_DIR if provided.
142
+ if os.environ.get("LLVM_DIR"):
143
+ args.append(f"-DLLVM_DIR={os.environ['LLVM_DIR']}")
144
+ # Forward CC, CXX if provided.
145
+ if os.environ.get("CC"):
146
+ args.append(f"-DCMAKE_C_COMPILER={os.environ['CC']}")
147
+ if os.environ.get("CXX"):
148
+ args.append(f"-DCMAKE_CXX_COMPILER={os.environ['CXX']}")
149
+ return args
150
+
151
+
152
+ def _prepare_source_openmp(sha256=None):
153
+ LLVM_VERSION = os.environ.get("LLVM_VERSION", None)
154
+ assert LLVM_VERSION is not None, "LLVM_VERSION environment variable must be set."
155
+ url = f"https://github.com/llvm/llvm-project/releases/download/llvmorg-{LLVM_VERSION}/llvm-project-{LLVM_VERSION}.src.tar.xz"
156
+
157
+ tmp = Path("_downloads/libomp") / f"llvm-project-{LLVM_VERSION}.tar.gz"
158
+ tmp.parent.mkdir(parents=True, exist_ok=True)
159
+
160
+ # Download the source tarball if it does not exist.
161
+ if not tmp.exists():
162
+ print(f"Downloading llvm-project version {LLVM_VERSION} url:", url)
163
+ with urllib.request.urlopen(url) as r:
164
+ with tmp.open("wb") as f:
165
+ f.write(r.read())
166
+ else:
167
+ print(f"Using downloaded llvm-project at {tmp}")
168
+
169
+ if sha256:
170
+ import hashlib
171
+
172
+ hasher = hashlib.sha256()
173
+ with tmp.open("rb") as f:
174
+ hasher.update(f.read())
175
+ if hasher.hexdigest() != sha256:
176
+ raise ValueError(f"SHA256 mismatch for {url}")
177
+
178
+ print("Extracting llvm-project...")
179
+ with tarfile.open(tmp) as tf:
180
+ # The root dir llvm-project-20.1.8.src
181
+ root_name = tf.getnames()[0]
182
+
183
+ # Extract only needed subdirectories
184
+ members = [
185
+ m
186
+ for m in tf.getmembers()
187
+ if m.name.startswith(f"{root_name}/openmp/")
188
+ or m.name.startswith(f"{root_name}/offload/")
189
+ or m.name.startswith(f"{root_name}/runtimes/")
190
+ or m.name.startswith(f"{root_name}/cmake/")
191
+ or m.name.startswith(f"{root_name}/llvm/cmake/")
192
+ or m.name.startswith(f"{root_name}/llvm/utils/")
193
+ or m.name.startswith(f"{root_name}/libc/")
194
+ ]
195
+
196
+ parentdir = tmp.parent
197
+ # Base arguments for extractall.
198
+ kwargs = {"path": parentdir, "members": members}
199
+
200
+ # Check if data filter is available.
201
+ if hasattr(tarfile, "data_filter"):
202
+ # If this exists, the 'filter' argument is guaranteed to work
203
+ kwargs["filter"] = "data"
204
+
205
+ tf.extractall(**kwargs)
206
+
207
+ source_dir = parentdir / root_name
208
+ print("Extracted llvm-project to:", source_dir)
209
+
210
+ print("Applying patches to llvm-project...")
211
+ for patch in sorted(
212
+ Path(f"src/numba/openmp/libs/openmp/patches/{LLVM_VERSION}")
213
+ .absolute()
214
+ .glob("*.patch")
215
+ ):
216
+ print("applying patch", patch)
217
+ subprocess.run(
218
+ ["patch", "-p1", "-i", str(patch)],
219
+ cwd=source_dir,
220
+ check=True,
221
+ stdin=subprocess.DEVNULL,
222
+ )
223
+
224
+ return f"{source_dir}/runtimes"
225
+
226
+
227
+ def _check_true(env_var):
228
+ val = os.environ.get(env_var, "0")
229
+ return val.lower() in ("1", "true", "yes", "on")
230
+
231
+
232
+ # Build extensions: always include 'pass', conditionally include 'openmp'
233
+ # libraries.
234
+ ext_modules = [CMakeExtension("pass", source_dir="src/numba/openmp/libs/pass")]
235
+
236
+
237
+ # Prepare source directory if either bundled libomp or libomptarget is enabled.
238
+ if _check_true("ENABLE_BUNDLED_LIBOMP") or _check_true("ENABLE_BUNDLED_LIBOMPTARGET"):
239
+ openmp_source_dir = _prepare_source_openmp()
240
+
241
+ # Optionally enable bundled libomp build via ENABLE_BUNDLED_LIBOMP=1. We want
242
+ # to avoid bundling for conda builds to avoid duplicate OpenMP runtime conflicts
243
+ # (e.g., numba 0.62+ and libopenblas already require llvm-openmp).
244
+ if _check_true("ENABLE_BUNDLED_LIBOMP"):
245
+ ext_modules.append(
246
+ CMakeExtension(
247
+ "libomp",
248
+ source_dir=openmp_source_dir,
249
+ install_dir="openmp",
250
+ cmake_args=[
251
+ "-DOPENMP_STANDALONE_BUILD=ON",
252
+ "-DLLVM_ENABLE_RUNTIMES=openmp",
253
+ "-DLIBOMP_OMPD_SUPPORT=OFF",
254
+ "-DOPENMP_ENABLE_OMPT_TOOLS=OFF",
255
+ # Avoid conflicts in manylinux builds with packaged clang/llvm
256
+ # under /usr/include and its gcc-toolset provided header files.
257
+ "-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON",
258
+ ],
259
+ )
260
+ )
261
+
262
+ # Optionally enable bundled libomptarget build via ENABLE_BUNDLED_LIBOMPTARGET=1.
263
+ # We avoid building and bundling for unsupported platforms.
264
+ if _check_true("ENABLE_BUNDLED_LIBOMPTARGET"):
265
+ ext_modules.append(
266
+ CMakeExtension(
267
+ "libomptarget",
268
+ source_dir=openmp_source_dir,
269
+ install_dir="openmp",
270
+ cmake_args=[
271
+ "-DOPENMP_STANDALONE_BUILD=ON",
272
+ "-DLLVM_ENABLE_RUNTIMES=offload",
273
+ # Avoid conflicts in manylinux builds with packaged clang/llvm
274
+ # under /usr/include and its gcc-toolset provided header files.
275
+ "-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON",
276
+ ],
277
+ )
278
+ )
279
+
280
+
281
+ setup(
282
+ ext_modules=ext_modules,
283
+ cmdclass={
284
+ "clean": CleanCommand,
285
+ "build_ext": BuildCMakeExt,
286
+ **({"bdist_wheel": CustomBdistWheel} if CustomBdistWheel else {}),
287
+ },
288
+ )
@@ -60,25 +60,45 @@ from .decorators import jit, njit # noqa: F401
60
60
 
61
61
  def _init():
62
62
  sys_platform = sys.platform
63
+ from ctypes.util import find_library
63
64
 
64
65
  omplib = (
65
66
  libpath
66
- / "libomp"
67
+ / "openmp"
67
68
  / "lib"
68
69
  / f"libomp{'.dylib' if sys_platform == 'darwin' else '.so'}"
69
70
  )
70
- if DEBUG_OPENMP >= 1:
71
- print("Found OpenMP runtime library at", omplib)
72
- ll.load_library_permanently(str(omplib))
71
+
72
+ # Prefer bundled libomp if it exists.
73
+ if omplib.exists():
74
+ if DEBUG_OPENMP >= 1:
75
+ print("Found bundled OpenMP runtime library at", omplib)
76
+ ll.load_library_permanently(str(omplib))
77
+ else:
78
+ # There is no bundled libomp, try to find it in standard library paths.
79
+ system_omplib = find_library("omp")
80
+ if system_omplib:
81
+ if DEBUG_OPENMP >= 1:
82
+ print(f"Found system OpenMP runtime library: {system_omplib}")
83
+ ll.load_library_permanently(system_omplib)
84
+ else:
85
+ raise RuntimeError(
86
+ f"OpenMP runtime not found. Bundled library missing at {omplib} "
87
+ "and no system libomp found via ctypes.util.find_library('omp'). "
88
+ "Ensure libomp is available in library paths."
89
+ )
73
90
 
74
91
  # libomptarget is unavailable on apple, windows, so return.
75
92
  if sys_platform.startswith("darwin") or sys_platform.startswith("win32"):
76
93
  return
77
94
 
78
- omptargetlib = libpath / "libomp" / "lib" / "libomptarget.so"
79
- if DEBUG_OPENMP >= 1:
80
- print("Found OpenMP target runtime library at", omptargetlib)
81
- ll.load_library_permanently(str(omptargetlib))
95
+ omptargetlib = libpath / "openmp" / "lib" / "libomptarget.so"
96
+ if omptargetlib.exists():
97
+ if DEBUG_OPENMP >= 1:
98
+ print("Found OpenMP target runtime library at", omptargetlib)
99
+ ll.load_library_permanently(str(omptargetlib))
100
+ else:
101
+ raise RuntimeError(f"OpenMP target runtime not found at {omptargetlib}")
82
102
 
83
103
 
84
104
  _init()
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.4.0'
32
- __version_tuple__ = version_tuple = (0, 4, 0)
31
+ __version__ = version = '0.5.0'
32
+ __version_tuple__ = version_tuple = (0, 5, 0)
33
33
 
34
- __commit_id__ = commit_id = 'gd8780ff7f'
34
+ __commit_id__ = commit_id = 'g6d955c9a6'