From c9912c2db179a1b078eb2d05bb07199d03dae406 Mon Sep 17 00:00:00 2001 From: lpossner Date: Thu, 11 Jul 2024 12:35:10 +0200 Subject: [PATCH 01/19] OSX build test --- .github/workflows/main.yml | 217 +++++++++++++++++++------------------ doc/conf.py | 2 +- pygpc/GPC.py | 116 ++++++++++---------- setup.py | 18 +-- 4 files changed, 179 insertions(+), 174 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f2e96660..0e87b6b0 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,55 +6,100 @@ on: pull_request: branches: [ master, develop ] jobs: - linux: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] - include: - - python-version: "3.9" - cibw-string: "cp39-*" - - python-version: "3.10" - cibw-string: "cp310-*" - - python-version: "3.11" - cibw-string: "cp311-*" - - python-version: "3.12" - cibw-string: "cp312-*" - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install Cython cibuildwheel twine - pip install -r requirements.txt - pip install . - - name: Test with unittest - run: | - cd tests - python -m unittest - cd .. - - name: Build with cibuildwheel - run: | - python -m cibuildwheel --output-dir wheelhouse - ls wheelhouse/ - env: - CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" - CIBW_BEFORE_BUILD: "pip install numpy" - CIBW_BUILD: ${{ matrix.cibw-string }} - CIBW_SKIP: "*-musllinux_* *i686*" - - name: Upload with twine - if: "contains(github.event.head_commit.message, 'PyPI')" - run: | - python -m twine upload wheelhouse/*.whl - env: - TWINE_PASSWORD: ${{ secrets.twine_api_key }} - TWINE_USERNAME: __token__ - windows: - runs-on: windows-2019 + # linux: + # runs-on: ubuntu-latest + # strategy: + # matrix: + # python-version: ["3.9", "3.10", "3.11", "3.12"] + # include: + # - python-version: "3.9" + # cibw-string: "cp39-*" + # - python-version: "3.10" + # cibw-string: "cp310-*" + # - python-version: "3.11" + # cibw-string: "cp311-*" + # - python-version: "3.12" + # cibw-string: "cp312-*" + # steps: + # - uses: actions/checkout@v2 + # - name: Set up Python ${{ matrix.python-version }} + # uses: actions/setup-python@v1 + # with: + # python-version: ${{ matrix.python-version }} + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # pip install Cython cibuildwheel twine + # pip install -r requirements.txt + # pip install . + # - name: Test with unittest + # run: | + # cd tests + # python -m unittest + # cd .. + # - name: Build with cibuildwheel + # run: | + # python -m cibuildwheel --output-dir wheelhouse + # ls wheelhouse/ + # env: + # CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" + # CIBW_BEFORE_BUILD: "pip install numpy" + # CIBW_BUILD: ${{ matrix.cibw-string }} + # CIBW_SKIP: "*-musllinux_* *i686*" + # - name: Upload with twine + # if: "contains(github.event.head_commit.message, 'PyPI')" + # run: | + # python -m twine upload wheelhouse/*.whl + # env: + # TWINE_PASSWORD: ${{ secrets.twine_api_key }} + # TWINE_USERNAME: __token__ + # windows: + # runs-on: windows-2019 + # strategy: + # matrix: + # python-version: ["3.9", "3.10", "3.11", "3.12"] + # include: + # - python-version: "3.9" + # cibw-string: "cp39-*" + # - python-version: "3.10" + # cibw-string: "cp310-*" + # - python-version: "3.11" + # cibw-string: "cp311-*" + # - python-version: "3.12" + # cibw-string: "cp312-*" + # steps: + # - uses: actions/checkout@v2 + # - name: Set up Python ${{ matrix.python-version }} + # uses: actions/setup-python@v1 + # with: + # python-version: ${{ matrix.python-version }} + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # pip install Cython cibuildwheel twine + # pip install -r requirements.txt + # pip install . + # - name: Test with unittest + # run: | + # cd tests + # python -m unittest + # cd .. + # - name: Build with cibuildwheel + # run: | + # python -m cibuildwheel --output-dir wheelhouse + # ls wheelhouse/ + # env: + # CIBW_BEFORE_BUILD: "pip install numpy" + # CIBW_BUILD: ${{ matrix.cibw-string }} + # - name: Upload with twine + # if: "contains(github.event.head_commit.message, 'PyPI')" + # run: | + # python -m twine upload wheelhouse/*.whl + # env: + # TWINE_PASSWORD: ${{ secrets.twine_api_key }} + # TWINE_USERNAME: __token__ + macos: + runs-on: macos-11 strategy: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] @@ -75,22 +120,29 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | + brew install gcc@13 python -m pip install --upgrade pip - pip install Cython cibuildwheel twine + pip install Cython matplotlib seaborn cibuildwheel twine pip install -r requirements.txt - pip install . - - name: Test with unittest - run: | - cd tests - python -m unittest - cd .. + CC=gcc-13 CXX=g++-13 pip install . + # - name: Test with unittest + # run: | + # cd tests + # python -m unittest + # cd .. - name: Build with cibuildwheel run: | python -m cibuildwheel --output-dir wheelhouse ls wheelhouse/ env: - CIBW_BEFORE_BUILD: "pip install numpy" + # MACOSX_DEPLOYMENT_TARGET: "10.11" + # CIBW_BEFORE_BUILD: "pip install numpy" + # CIBW_ARCHS_MACOS: x86_64 CIBW_BUILD: ${{ matrix.cibw-string }} + # CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" + CIBW_REPAIR_WHEEL_COMMAND: "" + # CC: gcc-13 + # CXX: g++-13 - name: Upload with twine if: "contains(github.event.head_commit.message, 'PyPI')" run: | @@ -98,54 +150,3 @@ jobs: env: TWINE_PASSWORD: ${{ secrets.twine_api_key }} TWINE_USERNAME: __token__ - macos: - runs-on: macos-11 - strategy: - matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] - include: - - python-version: "3.9" - cibw-string: "cp39-*" - - python-version: "3.10" - cibw-string: "cp310-*" - - python-version: "3.11" - cibw-string: "cp311-*" - - python-version: "3.12" - cibw-string: "cp312-*" - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - brew install gcc@13 - python -m pip install --upgrade pip - pip install Cython matplotlib seaborn cibuildwheel twine - pip install -r requirements.txt - CC=gcc-13 CXX=g++-13 pip install . - - name: Test with unittest - run: | - cd tests - python -m unittest - cd .. - # - name: Build with cibuildwheel - # run: | - # python -m cibuildwheel --output-dir wheelhouse - # ls wheelhouse/ - # env: - # MACOSX_DEPLOYMENT_TARGET: "10.11" - # CIBW_BEFORE_BUILD: "pip install numpy" - # CIBW_ARCHS_MACOS: x86_64 - # CIBW_BUILD: ${{ matrix.cibw-string }} - # CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" - # CC: gcc-13 - # CXX: g++-13 - # - name: Upload with twine - # if: "contains(github.event.head_commit.message, 'PyPI')" - # run: | - # python -m twine upload wheelhouse/*.whl - # env: - # TWINE_PASSWORD: ${{ secrets.twine_api_key }} - # TWINE_USERNAME: __token__ diff --git a/doc/conf.py b/doc/conf.py index b1320c87..6edfc299 100755 --- a/doc/conf.py +++ b/doc/conf.py @@ -21,7 +21,7 @@ # -- Project information ----------------------------------------------------- project = u'pygpc' -copyright = u'2023, Konstantin Weise' +copyright = u'2024, Konstantin Weise' author = u'Konstantin Weise' # The short X.Y version diff --git a/pygpc/GPC.py b/pygpc/GPC.py index f6deeb69..23593d69 100755 --- a/pygpc/GPC.py +++ b/pygpc/GPC.py @@ -12,18 +12,10 @@ from .misc import nrmsd from .misc import mat2ten from .misc import ten2mat -from .pygpc_extensions import create_gpc_matrix_cpu -from .pygpc_extensions import create_gpc_matrix_omp from .ValidationSet import * from .Computation import * from .Grid import * - -try: - from .pygpc_extensions_cuda import create_gpc_matrix_cuda -except ImportError: - pass - try: import fastmat as fm except ImportError: @@ -220,56 +212,44 @@ def create_gpc_matrix(self, b, x, gradient=False, gradient_idx=None, weighted=Fa iprint('Constructing gPC matrix...', verbose=verbose, tab=0) - # Python backend - if self.backend == "python": - if not gradient: - gpc_matrix = np.ones([x.shape[0], len(b)]) - for i_basis in range(len(b)): - for i_dim in range(self.problem.dim): - gpc_matrix[:, i_basis] *= b[i_basis][i_dim](x[:, i_dim]) - else: - gpc_matrix = np.ones([len(self.gradient_idx), len(b), self.problem.dim]) - for i_dim_gradient in range(self.problem.dim): - for i_basis in range(len(b)): - for i_dim in range(self.problem.dim): - if i_dim == i_dim_gradient: - derivative = True - else: - derivative = False - gpc_matrix[:, i_basis, i_dim_gradient] *= b[i_basis][i_dim](x[self.gradient_idx, i_dim], - derivative=derivative) - # CPU backend (CPU single core) - elif self.backend == "cpu": - if not gradient: - # the third dimension is important and should not be removed - # otherwise the code could produce undefined behaviour - gpc_matrix = np.empty([x.shape[0], len(b), 1]) - create_gpc_matrix_cpu(x, self.basis.b_array, gpc_matrix) - gpc_matrix = np.squeeze(gpc_matrix) - else: - gpc_matrix = np.empty([len(self.gradient_idx), len(b), self.problem.dim]) - create_gpc_matrix_cpu(x[self.gradient_idx, :], self.basis.b_array_grad, gpc_matrix) + if self.backend == "cpu": + try: + from .pygpc_extensions import create_gpc_matrix_cpu + if not gradient: + # the third dimension is important and should not be removed + # otherwise the code could produce undefined behaviour + gpc_matrix = np.empty([x.shape[0], len(b), 1]) + create_gpc_matrix_cpu(x, self.basis.b_array, gpc_matrix) + gpc_matrix = np.squeeze(gpc_matrix) + else: + gpc_matrix = np.empty([len(self.gradient_idx), len(b), self.problem.dim]) + create_gpc_matrix_cpu(x[self.gradient_idx, :], self.basis.b_array_grad, gpc_matrix) + except (ImportError): + print("The CPU-extension is not installed. Fall back to pure Python as backend.") + self.backend = "python" # OpenMP backend (CPU multi core) elif self.backend == "omp": - if not gradient: - # the third dimension is important and should not be removed - # otherwise the code could produce undefined behaviour - gpc_matrix = np.empty([x.shape[0], len(b), 1]) - create_gpc_matrix_omp(x, self.basis.b_array, gpc_matrix) - gpc_matrix = np.squeeze(gpc_matrix) - else: - gpc_matrix = np.empty([len(self.gradient_idx), len(b), self.problem.dim]) - create_gpc_matrix_omp(x[self.gradient_idx, :], self.basis.b_array_grad, gpc_matrix) + try: + from .pygpc_extensions import create_gpc_matrix_omp + if not gradient: + # the third dimension is important and should not be removed + # otherwise the code could produce undefined behaviour + gpc_matrix = np.empty([x.shape[0], len(b), 1]) + create_gpc_matrix_omp(x, self.basis.b_array, gpc_matrix) + gpc_matrix = np.squeeze(gpc_matrix) + else: + gpc_matrix = np.empty([len(self.gradient_idx), len(b), self.problem.dim]) + create_gpc_matrix_omp(x[self.gradient_idx, :], self.basis.b_array_grad, gpc_matrix) + except (ImportError): + print("The OMP-extension is not installed. Fall back to pure Python as backend.") + self.backend = "python" # CUDA backend (GPU multi core) elif self.backend == "cuda": try: from .pygpc_extensions_cuda import create_gpc_matrix_cuda - except (ImportError): - raise NotImplementedError("The CUDA-extension is not installed. Use the build script to install.") - else: if not gradient: # the third dimension is important and should not be removed # otherwise the code could produce undefined behaviour @@ -279,7 +259,28 @@ def create_gpc_matrix(self, b, x, gradient=False, gradient_idx=None, weighted=Fa else: gpc_matrix = np.empty([len(self.gradient_idx), len(b), self.problem.dim]) create_gpc_matrix_cuda(x[self.gradient_idx, :], self.basis.b_array_grad, gpc_matrix) + except (ImportError): + print("The CUDA-extension is not installed. Fall back to pure Python as backend.") + self.backend = "python" + # Python backend + if self.backend == "python": + if not gradient: + gpc_matrix = np.ones([x.shape[0], len(b)]) + for i_basis in range(len(b)): + for i_dim in range(self.problem.dim): + gpc_matrix[:, i_basis] *= b[i_basis][i_dim](x[:, i_dim]) + else: + gpc_matrix = np.ones([len(self.gradient_idx), len(b), self.problem.dim]) + for i_dim_gradient in range(self.problem.dim): + for i_basis in range(len(b)): + for i_dim in range(self.problem.dim): + if i_dim == i_dim_gradient: + derivative = True + else: + derivative = False + gpc_matrix[:, i_basis, i_dim_gradient] *= b[i_basis][i_dim](x[self.gradient_idx, i_dim], + derivative=derivative) else: raise NotImplementedError @@ -636,6 +637,15 @@ def get_approximation(self, coeffs, x, output_idx=None): if self.p_matrix is not None: x = np.matmul(x, self.p_matrix.transpose() / self.p_matrix_norm[np.newaxis, :]) + if self.backend == "cuda": + try: + from .pygpc_extensions_cuda import get_approximation_cuda + pce = np.empty([x.shape[0], coeffs.shape[1]]) + get_approximation_cuda(x, self.basis.b_array, coeffs, pce) + except ImportError: + print("The CUDA-extension is not installed. Fall back to pure Python as backend.") + self.backend = "python" + if self.backend == 'python' or self.backend == 'cpu' or self.backend == 'omp': # determine gPC matrix at coordinates x gpc_matrix = self.create_gpc_matrix(self.basis.b, x, gradient=False) @@ -643,14 +653,6 @@ def get_approximation(self, coeffs, x, output_idx=None): # multiply with gPC coeffs pce = np.matmul(gpc_matrix, coeffs) - elif self.backend == "cuda": - try: - from .pygpc_extensions_cuda import get_approximation_cuda - except ImportError: - raise NotImplementedError("The CUDA-extension is not installed. Use the build script to install.") - else: - pce = np.empty([x.shape[0], coeffs.shape[1]]) - get_approximation_cuda(x, self.basis.b_array, coeffs, pce) else: raise NotImplementedError diff --git a/setup.py b/setup.py index 7105815b..f10637a7 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ -import argparse import os +import sys import numpy as np from setuptools import setup, find_packages, Extension @@ -8,7 +8,7 @@ # analysis of complex systems. See also: # https://github.com/pygpc-polynomial-chaos/pygpc # -# Copyright (C) 2017-2023 the original author (Konstantin Weise), +# Copyright (C) 2017-2024 the original author (Konstantin Weise), # the Max-Planck-Institute for Human Cognitive Brain Sciences ("MPI CBS") # and contributors # @@ -32,12 +32,14 @@ pygpc_extensions_include_path = [os.path.join('pckg', 'pygpc_extensions', 'include'), np.get_include()] -extensions = [Extension('pygpc.pygpc_extensions', - sources=pygpc_extensions_src_file_path, - include_dirs=pygpc_extensions_include_path, - extra_compile_args=openmp_compile_args, - extra_link_args=openmp_link_args)] - +if sys.platform == 'darwin': + extensions = [] +else: + extensions = [Extension('pygpc.pygpc_extensions', + sources=pygpc_extensions_src_file_path, + include_dirs=pygpc_extensions_include_path, + extra_compile_args=openmp_compile_args, + extra_link_args=openmp_link_args)] setup(name='pygpc', version='0.3.9', From 642ac6dcad806d68e471aaff4d51639f3c484989 Mon Sep 17 00:00:00 2001 From: lpossner Date: Thu, 11 Jul 2024 13:05:02 +0200 Subject: [PATCH 02/19] Remove OSX build test --- .github/workflows/main.yml | 194 ++++++++++++++++++------------------- 1 file changed, 97 insertions(+), 97 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e87b6b0..0d89e8b2 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,98 +6,98 @@ on: pull_request: branches: [ master, develop ] jobs: - # linux: - # runs-on: ubuntu-latest - # strategy: - # matrix: - # python-version: ["3.9", "3.10", "3.11", "3.12"] - # include: - # - python-version: "3.9" - # cibw-string: "cp39-*" - # - python-version: "3.10" - # cibw-string: "cp310-*" - # - python-version: "3.11" - # cibw-string: "cp311-*" - # - python-version: "3.12" - # cibw-string: "cp312-*" - # steps: - # - uses: actions/checkout@v2 - # - name: Set up Python ${{ matrix.python-version }} - # uses: actions/setup-python@v1 - # with: - # python-version: ${{ matrix.python-version }} - # - name: Install dependencies - # run: | - # python -m pip install --upgrade pip - # pip install Cython cibuildwheel twine - # pip install -r requirements.txt - # pip install . - # - name: Test with unittest - # run: | - # cd tests - # python -m unittest - # cd .. - # - name: Build with cibuildwheel - # run: | - # python -m cibuildwheel --output-dir wheelhouse - # ls wheelhouse/ - # env: - # CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" - # CIBW_BEFORE_BUILD: "pip install numpy" - # CIBW_BUILD: ${{ matrix.cibw-string }} - # CIBW_SKIP: "*-musllinux_* *i686*" - # - name: Upload with twine - # if: "contains(github.event.head_commit.message, 'PyPI')" - # run: | - # python -m twine upload wheelhouse/*.whl - # env: - # TWINE_PASSWORD: ${{ secrets.twine_api_key }} - # TWINE_USERNAME: __token__ - # windows: - # runs-on: windows-2019 - # strategy: - # matrix: - # python-version: ["3.9", "3.10", "3.11", "3.12"] - # include: - # - python-version: "3.9" - # cibw-string: "cp39-*" - # - python-version: "3.10" - # cibw-string: "cp310-*" - # - python-version: "3.11" - # cibw-string: "cp311-*" - # - python-version: "3.12" - # cibw-string: "cp312-*" - # steps: - # - uses: actions/checkout@v2 - # - name: Set up Python ${{ matrix.python-version }} - # uses: actions/setup-python@v1 - # with: - # python-version: ${{ matrix.python-version }} - # - name: Install dependencies - # run: | - # python -m pip install --upgrade pip - # pip install Cython cibuildwheel twine - # pip install -r requirements.txt - # pip install . - # - name: Test with unittest - # run: | - # cd tests - # python -m unittest - # cd .. - # - name: Build with cibuildwheel - # run: | - # python -m cibuildwheel --output-dir wheelhouse - # ls wheelhouse/ - # env: - # CIBW_BEFORE_BUILD: "pip install numpy" - # CIBW_BUILD: ${{ matrix.cibw-string }} - # - name: Upload with twine - # if: "contains(github.event.head_commit.message, 'PyPI')" - # run: | - # python -m twine upload wheelhouse/*.whl - # env: - # TWINE_PASSWORD: ${{ secrets.twine_api_key }} - # TWINE_USERNAME: __token__ + linux: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + include: + - python-version: "3.9" + cibw-string: "cp39-*" + - python-version: "3.10" + cibw-string: "cp310-*" + - python-version: "3.11" + cibw-string: "cp311-*" + - python-version: "3.12" + cibw-string: "cp312-*" + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install Cython cibuildwheel twine + pip install -r requirements.txt + pip install . + - name: Test with unittest + run: | + cd tests + python -m unittest + cd .. + - name: Build with cibuildwheel + run: | + python -m cibuildwheel --output-dir wheelhouse + ls wheelhouse/ + env: + CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" + CIBW_BEFORE_BUILD: "pip install numpy" + CIBW_BUILD: ${{ matrix.cibw-string }} + CIBW_SKIP: "*-musllinux_* *i686*" + - name: Upload with twine + if: "contains(github.event.head_commit.message, 'PyPI')" + run: | + python -m twine upload wheelhouse/*.whl + env: + TWINE_PASSWORD: ${{ secrets.twine_api_key }} + TWINE_USERNAME: __token__ + windows: + runs-on: windows-2019 + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + include: + - python-version: "3.9" + cibw-string: "cp39-*" + - python-version: "3.10" + cibw-string: "cp310-*" + - python-version: "3.11" + cibw-string: "cp311-*" + - python-version: "3.12" + cibw-string: "cp312-*" + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install Cython cibuildwheel twine + pip install -r requirements.txt + pip install . + - name: Test with unittest + run: | + cd tests + python -m unittest + cd .. + - name: Build with cibuildwheel + run: | + python -m cibuildwheel --output-dir wheelhouse + ls wheelhouse/ + env: + CIBW_BEFORE_BUILD: "pip install numpy" + CIBW_BUILD: ${{ matrix.cibw-string }} + - name: Upload with twine + if: "contains(github.event.head_commit.message, 'PyPI')" + run: | + python -m twine upload wheelhouse/*.whl + env: + TWINE_PASSWORD: ${{ secrets.twine_api_key }} + TWINE_USERNAME: __token__ macos: runs-on: macos-11 strategy: @@ -125,11 +125,11 @@ jobs: pip install Cython matplotlib seaborn cibuildwheel twine pip install -r requirements.txt CC=gcc-13 CXX=g++-13 pip install . - # - name: Test with unittest - # run: | - # cd tests - # python -m unittest - # cd .. + - name: Test with unittest + run: | + cd tests + python -m unittest + cd .. - name: Build with cibuildwheel run: | python -m cibuildwheel --output-dir wheelhouse From 8b13d045bd191d2ac23ca028b6a44dd8c92c9f35 Mon Sep 17 00:00:00 2001 From: lpossner Date: Tue, 16 Jul 2024 22:12:14 +0200 Subject: [PATCH 03/19] [MOD] - updated numpy version in requirements.txt to <2.0.0 --- build_pygpc_extensions_cuda.py | 19 +++++++++++-------- requirements.txt | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/build_pygpc_extensions_cuda.py b/build_pygpc_extensions_cuda.py index ed76528a..b4b73acd 100755 --- a/build_pygpc_extensions_cuda.py +++ b/build_pygpc_extensions_cuda.py @@ -5,18 +5,21 @@ def build_pygpc_extensions_cuda(): - ext_prefix = sysconfig.get_config_var('EXT_SUFFIX').split('.') + ext_prefix = sysconfig.get_config_var("EXT_SUFFIX").split(".") ext_prefix = ext_prefix[1] - configure_command = ['cmake', '-B'+os.path.join('build', 'pygpc_extensions_cuda'), - '-H'+os.path.join('pckg','pygpc_extensions_cuda'), - '-DPROJECT_ROOT_PATH='+os.getcwd(), - '-DNumPy_INCLUDE_DIRS='+np.get_include(), - '-DEXT_PREFIX='+ext_prefix] + configure_command = [ + "cmake", + "-B" + os.path.join("build", "pygpc_extensions_cuda"), + "-H" + os.path.join("pckg", "pygpc_extensions_cuda"), + "-DPROJECT_ROOT_PATH=" + os.getcwd(), + "-DNumPy_INCLUDE_DIRS=" + np.get_include(), + "-DEXT_PREFIX=" + ext_prefix, + ] subprocess.run(configure_command) - build_commad = ['cmake', '--build', os.path.join('build', 'pygpc_extensions_cuda')] + build_commad = ["cmake", "--build", os.path.join("build", "pygpc_extensions_cuda")] print(build_commad) subprocess.run(build_commad) -if __name__ == '__main__': +if __name__ == "__main__": build_pygpc_extensions_cuda() diff --git a/requirements.txt b/requirements.txt index 79b9d622..6ad4d61a 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ scipy>=1.10.0 -numpy>=1.24.1 +numpy>=1.24.1,<2.0.0 fastmat>=0.2.post0 scikit-learn>=1.2.0 h5py>=3.7.0 From b1b2199aaf2e3f7db29337d4aabb6d50b4ba258e Mon Sep 17 00:00:00 2001 From: lpossner Date: Tue, 16 Jul 2024 23:04:49 +0200 Subject: [PATCH 04/19] [MOD] - GPC.py --- pygpc/GPC.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/pygpc/GPC.py b/pygpc/GPC.py index 23593d69..2a1fb548 100755 --- a/pygpc/GPC.py +++ b/pygpc/GPC.py @@ -212,8 +212,11 @@ def create_gpc_matrix(self, b, x, gradient=False, gradient_idx=None, weighted=Fa iprint('Constructing gPC matrix...', verbose=verbose, tab=0) - # CPU backend (CPU single core) + if self.backend not in ["cpu", "omp", "cuda", "python"]: + raise NotImplementedError(f"Backend {self.backend} is not implemented") + if self.backend == "cpu": + # CPU backend (CPU single core) try: from .pygpc_extensions import create_gpc_matrix_cpu if not gradient: @@ -228,9 +231,8 @@ def create_gpc_matrix(self, b, x, gradient=False, gradient_idx=None, weighted=Fa except (ImportError): print("The CPU-extension is not installed. Fall back to pure Python as backend.") self.backend = "python" - - # OpenMP backend (CPU multi core) elif self.backend == "omp": + # OpenMP backend (CPU multi core) try: from .pygpc_extensions import create_gpc_matrix_omp if not gradient: @@ -245,9 +247,8 @@ def create_gpc_matrix(self, b, x, gradient=False, gradient_idx=None, weighted=Fa except (ImportError): print("The OMP-extension is not installed. Fall back to pure Python as backend.") self.backend = "python" - - # CUDA backend (GPU multi core) elif self.backend == "cuda": + # CUDA backend (GPU multi core) try: from .pygpc_extensions_cuda import create_gpc_matrix_cuda if not gradient: @@ -262,9 +263,9 @@ def create_gpc_matrix(self, b, x, gradient=False, gradient_idx=None, weighted=Fa except (ImportError): print("The CUDA-extension is not installed. Fall back to pure Python as backend.") self.backend = "python" - - # Python backend + if self.backend == "python": + # Python backend if not gradient: gpc_matrix = np.ones([x.shape[0], len(b)]) for i_basis in range(len(b)): @@ -281,8 +282,6 @@ def create_gpc_matrix(self, b, x, gradient=False, gradient_idx=None, weighted=Fa derivative = False gpc_matrix[:, i_basis, i_dim_gradient] *= b[i_basis][i_dim](x[self.gradient_idx, i_dim], derivative=derivative) - else: - raise NotImplementedError if gpc_matrix.ndim == 1 and x.shape[0] == 1: gpc_matrix = gpc_matrix[np.newaxis, :] From 97019b34c729c9973988be94cb73eff2f5452bc9 Mon Sep 17 00:00:00 2001 From: lpossner Date: Tue, 16 Jul 2024 23:10:42 +0200 Subject: [PATCH 05/19] [MOD] - updated osx runner to osx-14 --- .github/workflows/main.yml | 2 +- setup.py | 88 ++++++++++++++++++++++---------------- 2 files changed, 52 insertions(+), 38 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0d89e8b2..64b254b4 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -99,7 +99,7 @@ jobs: TWINE_PASSWORD: ${{ secrets.twine_api_key }} TWINE_USERNAME: __token__ macos: - runs-on: macos-11 + runs-on: macos-14 strategy: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] diff --git a/setup.py b/setup.py index f10637a7..e0325dae 100755 --- a/setup.py +++ b/setup.py @@ -25,43 +25,57 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see -openmp_compile_args = ['-fopenmp'] -openmp_link_args = ['-lgomp'] -pygpc_extensions_src_file_path = [os.path.join('pckg', 'pygpc_extensions', - 'src', 'pygpc_extensions.cpp')] -pygpc_extensions_include_path = [os.path.join('pckg', 'pygpc_extensions', - 'include'), np.get_include()] +openmp_compile_args = ["-fopenmp"] +openmp_link_args = ["-lgomp"] +pygpc_extensions_src_file_path = [ + os.path.join("pckg", "pygpc_extensions", "src", "pygpc_extensions.cpp") +] +pygpc_extensions_include_path = [ + os.path.join("pckg", "pygpc_extensions", "include"), + np.get_include(), +] -if sys.platform == 'darwin': - extensions = [] -else: - extensions = [Extension('pygpc.pygpc_extensions', - sources=pygpc_extensions_src_file_path, - include_dirs=pygpc_extensions_include_path, - extra_compile_args=openmp_compile_args, - extra_link_args=openmp_link_args)] +# if sys.platform == 'darwin': +# extensions = [] +# else: +# extensions = [Extension('pygpc.pygpc_extensions', +# sources=pygpc_extensions_src_file_path, +# include_dirs=pygpc_extensions_include_path, +# extra_compile_args=openmp_compile_args, +# extra_link_args=openmp_link_args)] -setup(name='pygpc', - version='0.3.9', - description='A sensitivity and uncertainty analysis toolbox for Python', - author='Konstantin Weise', - author_email='kweise@cbs.mpg.de', - license='GPL3', - packages=find_packages(exclude=['tests', - 'tests.*', - 'templates', - 'templates.*']), - install_requires=['scipy', - 'numpy', - 'scikit-learn', - 'h5py', - 'tqdm', - 'pandas', - ], - ext_modules=extensions, - package_data={'pygpc': ['*.so', '*.dll', '*.dylib']}, - project_urls={ +extensions = [ + Extension( + "pygpc.pygpc_extensions", + sources=pygpc_extensions_src_file_path, + include_dirs=pygpc_extensions_include_path, + extra_compile_args=openmp_compile_args, + extra_link_args=openmp_link_args, + ) +] + +setup( + name="pygpc", + version="0.3.9", + description="A sensitivity and uncertainty analysis toolbox for Python", + author="Konstantin Weise", + author_email="kweise@cbs.mpg.de", + license="GPL3", + packages=find_packages(exclude=["tests", "tests.*", "templates", "templates.*"]), + install_requires=[ + "scipy", + "numpy", + "scikit-learn", + "h5py", + "tqdm", + "pandas", + ], + ext_modules=extensions, + package_data={"pygpc": ["*.so", "*.dll", "*.dylib"]}, + project_urls={ "Documentation": "https://pygpc.readthedocs.io/en/latest/", - "Source Code": "https://github.com/pygpc-polynomial-chaos/pygpc"}, - zip_safe=False, - include_package_data=True) \ No newline at end of file + "Source Code": "https://github.com/pygpc-polynomial-chaos/pygpc", + }, + zip_safe=False, + include_package_data=True, +) From 2ba4603d609bbcbbdbbc506558646573e5eee33d Mon Sep 17 00:00:00 2001 From: lpossner Date: Tue, 16 Jul 2024 23:11:53 +0200 Subject: [PATCH 06/19] [MOD] - changed delocate config --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 64b254b4..ef9828b7 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -136,13 +136,13 @@ jobs: ls wheelhouse/ env: # MACOSX_DEPLOYMENT_TARGET: "10.11" - # CIBW_BEFORE_BUILD: "pip install numpy" + CIBW_BEFORE_BUILD: "pip install numpy" # CIBW_ARCHS_MACOS: x86_64 CIBW_BUILD: ${{ matrix.cibw-string }} - # CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" - CIBW_REPAIR_WHEEL_COMMAND: "" - # CC: gcc-13 - # CXX: g++-13 + CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" + # CIBW_REPAIR_WHEEL_COMMAND: "" + CC: gcc-13 + CXX: g++-13 - name: Upload with twine if: "contains(github.event.head_commit.message, 'PyPI')" run: | From eb30a33450c902f48cd128a953efd9a6f2d475ca Mon Sep 17 00:00:00 2001 From: lpossner Date: Wed, 17 Jul 2024 09:15:56 +0200 Subject: [PATCH 07/19] [MOD] - changed GihHub Actions checkout and setup-python versions --- .github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ef9828b7..4fa5174d 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,9 +21,9 @@ jobs: - python-version: "3.12" cibw-string: "cp312-*" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -68,9 +68,9 @@ jobs: - python-version: "3.12" cibw-string: "cp312-*" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -113,9 +113,9 @@ jobs: - python-version: "3.12" cibw-string: "cp312-*" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies From 3b7a4ce817be6420692f02e852fea61b978e6d59 Mon Sep 17 00:00:00 2001 From: lpossner Date: Wed, 17 Jul 2024 09:47:54 +0200 Subject: [PATCH 08/19] OSX build test --- .github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4fa5174d..dc4432ab 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -125,11 +125,11 @@ jobs: pip install Cython matplotlib seaborn cibuildwheel twine pip install -r requirements.txt CC=gcc-13 CXX=g++-13 pip install . - - name: Test with unittest - run: | - cd tests - python -m unittest - cd .. + # - name: Test with unittest + # run: | + # cd tests + # python -m unittest + # cd .. - name: Build with cibuildwheel run: | python -m cibuildwheel --output-dir wheelhouse @@ -139,7 +139,7 @@ jobs: CIBW_BEFORE_BUILD: "pip install numpy" # CIBW_ARCHS_MACOS: x86_64 CIBW_BUILD: ${{ matrix.cibw-string }} - CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" + CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} --require-target-macos-version 10.14 -w {dest_dir} -v {wheel}" # CIBW_REPAIR_WHEEL_COMMAND: "" CC: gcc-13 CXX: g++-13 From 28fa77b3fc68f1a96b721fcf0ab32ce639fd61a0 Mon Sep 17 00:00:00 2001 From: lpossner Date: Wed, 17 Jul 2024 10:03:50 +0200 Subject: [PATCH 09/19] Another OSX build test --- .github/workflows/main.yml | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dc4432ab..170b003b 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -122,27 +122,38 @@ jobs: run: | brew install gcc@13 python -m pip install --upgrade pip - pip install Cython matplotlib seaborn cibuildwheel twine + pip install Cython matplotlib seaborn setuptools wheel delocate twine pip install -r requirements.txt CC=gcc-13 CXX=g++-13 pip install . + # - name: Install dependencies + # run: | + # brew install gcc@13 + # python -m pip install --upgrade pip + # pip install Cython matplotlib seaborn cibuildwheel twine + # pip install -r requirements.txt + # CC=gcc-13 CXX=g++-13 pip install . # - name: Test with unittest # run: | # cd tests # python -m unittest # cd .. - - name: Build with cibuildwheel + # - name: Build with cibuildwheel + # run: | + # python -m cibuildwheel --output-dir wheelhouse + # ls wheelhouse/ + # env: + # # MACOSX_DEPLOYMENT_TARGET: "10.11" + # CIBW_BEFORE_BUILD: "pip install numpy" + # # CIBW_ARCHS_MACOS: x86_64 + # CIBW_BUILD: ${{ matrix.cibw-string }} + # CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} --require-target-macos-version 10.14 -w {dest_dir} -v {wheel}" + # # CIBW_REPAIR_WHEEL_COMMAND: "" + # CC: gcc-13 + # CXX: g++-13 + - name: Build on GitHub runner run: | - python -m cibuildwheel --output-dir wheelhouse - ls wheelhouse/ - env: - # MACOSX_DEPLOYMENT_TARGET: "10.11" - CIBW_BEFORE_BUILD: "pip install numpy" - # CIBW_ARCHS_MACOS: x86_64 - CIBW_BUILD: ${{ matrix.cibw-string }} - CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} --require-target-macos-version 10.14 -w {dest_dir} -v {wheel}" - # CIBW_REPAIR_WHEEL_COMMAND: "" - CC: gcc-13 - CXX: g++-13 + CC=gcc-13 CXX=g++-13 python setup.py bdist_wheel + delocate-listdeps dist/*.whl && delocate-wheel -w wheelhouse -v dist/*.whl - name: Upload with twine if: "contains(github.event.head_commit.message, 'PyPI')" run: | From 674cb506238a8bb8659cdc8db495c62c018592f3 Mon Sep 17 00:00:00 2001 From: lpossner Date: Wed, 17 Jul 2024 10:08:38 +0200 Subject: [PATCH 10/19] Yet another OSX build test --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 170b003b..ac61ac03 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -153,7 +153,7 @@ jobs: - name: Build on GitHub runner run: | CC=gcc-13 CXX=g++-13 python setup.py bdist_wheel - delocate-listdeps dist/*.whl && delocate-wheel -w wheelhouse -v dist/*.whl + delocate-listdeps dist/*.whl && delocate-wheel --require-archs universal2 -w wheelhouse -v dist/*.whl - name: Upload with twine if: "contains(github.event.head_commit.message, 'PyPI')" run: | From df36513eaedffad81f573b34b3a9b95ec8c45893 Mon Sep 17 00:00:00 2001 From: lpossner Date: Wed, 17 Jul 2024 10:10:45 +0200 Subject: [PATCH 11/19] Yet another OSX build test --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ac61ac03..44ffa804 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -153,7 +153,7 @@ jobs: - name: Build on GitHub runner run: | CC=gcc-13 CXX=g++-13 python setup.py bdist_wheel - delocate-listdeps dist/*.whl && delocate-wheel --require-archs universal2 -w wheelhouse -v dist/*.whl + delocate-listdeps dist/*.whl && delocate-wheel --require-archs arm64 -w wheelhouse -v dist/*.whl - name: Upload with twine if: "contains(github.event.head_commit.message, 'PyPI')" run: | From 10b859159b95f117e7c15648de43dc958d9fcf43 Mon Sep 17 00:00:00 2001 From: lpossner Date: Wed, 17 Jul 2024 12:32:55 +0200 Subject: [PATCH 12/19] Yet another OSX build test --- .github/workflows/main.yml | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 44ffa804..afa5af5e 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -122,7 +122,7 @@ jobs: run: | brew install gcc@13 python -m pip install --upgrade pip - pip install Cython matplotlib seaborn setuptools wheel delocate twine + pip install Cython matplotlib seaborn cibuildwheel twine pip install -r requirements.txt CC=gcc-13 CXX=g++-13 pip install . # - name: Install dependencies @@ -137,23 +137,18 @@ jobs: # cd tests # python -m unittest # cd .. - # - name: Build with cibuildwheel - # run: | - # python -m cibuildwheel --output-dir wheelhouse - # ls wheelhouse/ - # env: - # # MACOSX_DEPLOYMENT_TARGET: "10.11" - # CIBW_BEFORE_BUILD: "pip install numpy" - # # CIBW_ARCHS_MACOS: x86_64 - # CIBW_BUILD: ${{ matrix.cibw-string }} - # CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} --require-target-macos-version 10.14 -w {dest_dir} -v {wheel}" - # # CIBW_REPAIR_WHEEL_COMMAND: "" - # CC: gcc-13 - # CXX: g++-13 - - name: Build on GitHub runner + - name: Build with cibuildwheel run: | - CC=gcc-13 CXX=g++-13 python setup.py bdist_wheel - delocate-listdeps dist/*.whl && delocate-wheel --require-archs arm64 -w wheelhouse -v dist/*.whl + python -m cibuildwheel --output-dir wheelhouse + ls wheelhouse/ + env: + MACOSX_DEPLOYMENT_TARGET: "10.14" + CIBW_BEFORE_BUILD: "pip install numpy" + # CIBW_ARCHS_MACOS: x86_64 + CIBW_BUILD: ${{ matrix.cibw-string }} + CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} --require-target-macos-version 10.14 -w {dest_dir} -v {wheel}" + CC: gcc-13 + CXX: g++-13 - name: Upload with twine if: "contains(github.event.head_commit.message, 'PyPI')" run: | From 5f87454ed403fbb7a8f94b31da831bb1b7fbc9ff Mon Sep 17 00:00:00 2001 From: lpossner Date: Wed, 17 Jul 2024 12:39:26 +0200 Subject: [PATCH 13/19] Yet another OSX build test --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index afa5af5e..2cb464eb 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -146,7 +146,7 @@ jobs: CIBW_BEFORE_BUILD: "pip install numpy" # CIBW_ARCHS_MACOS: x86_64 CIBW_BUILD: ${{ matrix.cibw-string }} - CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} --require-target-macos-version 10.14 -w {dest_dir} -v {wheel}" + CIBW_REPAIR_WHEEL_COMMAND: "MACOSX_DEPLOYMENT_TARGET=10.14 delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} --require-target-macos-version 10.14 -w {dest_dir} -v {wheel}" CC: gcc-13 CXX: g++-13 - name: Upload with twine From e02d4f362081c3cae4d9a53b43d0f726e56998ed Mon Sep 17 00:00:00 2001 From: lpossner Date: Wed, 17 Jul 2024 12:42:56 +0200 Subject: [PATCH 14/19] Yet another OSX build test --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2cb464eb..17cc8fdb 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -142,11 +142,11 @@ jobs: python -m cibuildwheel --output-dir wheelhouse ls wheelhouse/ env: - MACOSX_DEPLOYMENT_TARGET: "10.14" + MACOSX_DEPLOYMENT_TARGET: "14.0" CIBW_BEFORE_BUILD: "pip install numpy" # CIBW_ARCHS_MACOS: x86_64 CIBW_BUILD: ${{ matrix.cibw-string }} - CIBW_REPAIR_WHEEL_COMMAND: "MACOSX_DEPLOYMENT_TARGET=10.14 delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} --require-target-macos-version 10.14 -w {dest_dir} -v {wheel}" + CIBW_REPAIR_WHEEL_COMMAND: "MACOSX_DEPLOYMENT_TARGET=14.0 delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} --require-target-macos-version 10.14 -w {dest_dir} -v {wheel}" CC: gcc-13 CXX: g++-13 - name: Upload with twine From a1ba02b6d4bc68470b69f254da575cac2da0fe93 Mon Sep 17 00:00:00 2001 From: lpossner Date: Wed, 17 Jul 2024 12:45:54 +0200 Subject: [PATCH 15/19] Yet another OSX build test --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 17cc8fdb..a95a72a6 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -142,11 +142,11 @@ jobs: python -m cibuildwheel --output-dir wheelhouse ls wheelhouse/ env: - MACOSX_DEPLOYMENT_TARGET: "14.0" + MACOSX_DEPLOYMENT_TARGET: "14" CIBW_BEFORE_BUILD: "pip install numpy" # CIBW_ARCHS_MACOS: x86_64 CIBW_BUILD: ${{ matrix.cibw-string }} - CIBW_REPAIR_WHEEL_COMMAND: "MACOSX_DEPLOYMENT_TARGET=14.0 delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} --require-target-macos-version 10.14 -w {dest_dir} -v {wheel}" + CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} --require-target-macos-version 10.14 -w {dest_dir} -v {wheel}" CC: gcc-13 CXX: g++-13 - name: Upload with twine From d48ec12baac6aee2927e99c98433ff386411cd9e Mon Sep 17 00:00:00 2001 From: lpossner Date: Wed, 17 Jul 2024 12:56:31 +0200 Subject: [PATCH 16/19] Yet another OSX build test --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a95a72a6..b95f1f66 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -143,7 +143,7 @@ jobs: ls wheelhouse/ env: MACOSX_DEPLOYMENT_TARGET: "14" - CIBW_BEFORE_BUILD: "pip install numpy" + CIBW_BEFORE_BUILD: "pip install numpy delocate==0.10.7" # CIBW_ARCHS_MACOS: x86_64 CIBW_BUILD: ${{ matrix.cibw-string }} CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} --require-target-macos-version 10.14 -w {dest_dir} -v {wheel}" From 331d03a874f7e2b4d20b52134ef9cac89a29602d Mon Sep 17 00:00:00 2001 From: lpossner Date: Wed, 17 Jul 2024 12:58:17 +0200 Subject: [PATCH 17/19] Yet another OSX build test --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b95f1f66..43f1cfac 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -142,11 +142,11 @@ jobs: python -m cibuildwheel --output-dir wheelhouse ls wheelhouse/ env: - MACOSX_DEPLOYMENT_TARGET: "14" + # MACOSX_DEPLOYMENT_TARGET: "14" CIBW_BEFORE_BUILD: "pip install numpy delocate==0.10.7" # CIBW_ARCHS_MACOS: x86_64 CIBW_BUILD: ${{ matrix.cibw-string }} - CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} --require-target-macos-version 10.14 -w {dest_dir} -v {wheel}" + CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" CC: gcc-13 CXX: g++-13 - name: Upload with twine From 7fc15863395b4e2961220a4debf9a08e132f567f Mon Sep 17 00:00:00 2001 From: lpossner Date: Wed, 17 Jul 2024 13:03:45 +0200 Subject: [PATCH 18/19] Yet another OSX build test --- .github/workflows/main.yml | 119 ++++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 43f1cfac..72feefe6 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -98,7 +98,7 @@ jobs: env: TWINE_PASSWORD: ${{ secrets.twine_api_key }} TWINE_USERNAME: __token__ - macos: + macos_arm: runs-on: macos-14 strategy: matrix: @@ -142,9 +142,122 @@ jobs: python -m cibuildwheel --output-dir wheelhouse ls wheelhouse/ env: - # MACOSX_DEPLOYMENT_TARGET: "14" + MACOSX_DEPLOYMENT_TARGET: "10.14" + CIBW_BEFORE_BUILD: "pip install numpy delocate==0.10.7" + CIBW_BUILD: ${{ matrix.cibw-string }} + CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" + CC: gcc-13 + CXX: g++-13 + - name: Upload with twine + if: "contains(github.event.head_commit.message, 'PyPI')" + run: | + python -m twine upload wheelhouse/*.whl + env: + TWINE_PASSWORD: ${{ secrets.twine_api_key }} + TWINE_USERNAME: __token__ + macos_arm64: + runs-on: macos-14 + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + include: + - python-version: "3.9" + cibw-string: "cp39-*" + - python-version: "3.10" + cibw-string: "cp310-*" + - python-version: "3.11" + cibw-string: "cp311-*" + - python-version: "3.12" + cibw-string: "cp312-*" + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + brew install gcc@13 + python -m pip install --upgrade pip + pip install Cython matplotlib seaborn cibuildwheel twine + pip install -r requirements.txt + CC=gcc-13 CXX=g++-13 pip install . + # - name: Install dependencies + # run: | + # brew install gcc@13 + # python -m pip install --upgrade pip + # pip install Cython matplotlib seaborn cibuildwheel twine + # pip install -r requirements.txt + # CC=gcc-13 CXX=g++-13 pip install . + # - name: Test with unittest + # run: | + # cd tests + # python -m unittest + # cd .. + - name: Build with cibuildwheel + run: | + python -m cibuildwheel --output-dir wheelhouse + ls wheelhouse/ + env: + MACOSX_DEPLOYMENT_TARGET: "10.14" + CIBW_BEFORE_BUILD: "pip install numpy delocate==0.10.7" + CIBW_BUILD: ${{ matrix.cibw-string }} + CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" + CC: gcc-13 + CXX: g++-13 + - name: Upload with twine + if: "contains(github.event.head_commit.message, 'PyPI')" + run: | + python -m twine upload wheelhouse/*.whl + env: + TWINE_PASSWORD: ${{ secrets.twine_api_key }} + TWINE_USERNAME: __token__ + macos_x86_64: + runs-on: macos-13 + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + include: + - python-version: "3.9" + cibw-string: "cp39-*" + - python-version: "3.10" + cibw-string: "cp310-*" + - python-version: "3.11" + cibw-string: "cp311-*" + - python-version: "3.12" + cibw-string: "cp312-*" + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + brew install gcc@13 + python -m pip install --upgrade pip + pip install Cython matplotlib seaborn cibuildwheel twine + pip install -r requirements.txt + CC=gcc-13 CXX=g++-13 pip install . + # - name: Install dependencies + # run: | + # brew install gcc@13 + # python -m pip install --upgrade pip + # pip install Cython matplotlib seaborn cibuildwheel twine + # pip install -r requirements.txt + # CC=gcc-13 CXX=g++-13 pip install . + # - name: Test with unittest + # run: | + # cd tests + # python -m unittest + # cd .. + - name: Build with cibuildwheel + run: | + python -m cibuildwheel --output-dir wheelhouse + ls wheelhouse/ + env: + MACOSX_DEPLOYMENT_TARGET: "10.14" CIBW_BEFORE_BUILD: "pip install numpy delocate==0.10.7" - # CIBW_ARCHS_MACOS: x86_64 CIBW_BUILD: ${{ matrix.cibw-string }} CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" CC: gcc-13 From b70fb198674f544bc414bfcdc66ccc1d552bfe51 Mon Sep 17 00:00:00 2001 From: lpossner Date: Wed, 17 Jul 2024 13:11:42 +0200 Subject: [PATCH 19/19] PyPI Version 0.4.0 --- .github/workflows/main.yml | 92 ++++++-------------------------------- setup.py | 11 +---- 2 files changed, 15 insertions(+), 88 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 72feefe6..b769862e 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -98,7 +98,7 @@ jobs: env: TWINE_PASSWORD: ${{ secrets.twine_api_key }} TWINE_USERNAME: __token__ - macos_arm: + macos_arm64: runs-on: macos-14 strategy: matrix: @@ -125,18 +125,11 @@ jobs: pip install Cython matplotlib seaborn cibuildwheel twine pip install -r requirements.txt CC=gcc-13 CXX=g++-13 pip install . - # - name: Install dependencies - # run: | - # brew install gcc@13 - # python -m pip install --upgrade pip - # pip install Cython matplotlib seaborn cibuildwheel twine - # pip install -r requirements.txt - # CC=gcc-13 CXX=g++-13 pip install . - # - name: Test with unittest - # run: | - # cd tests - # python -m unittest - # cd .. + - name: Test with unittest + run: | + cd tests + python -m unittest + cd .. - name: Build with cibuildwheel run: | python -m cibuildwheel --output-dir wheelhouse @@ -155,8 +148,8 @@ jobs: env: TWINE_PASSWORD: ${{ secrets.twine_api_key }} TWINE_USERNAME: __token__ - macos_arm64: - runs-on: macos-14 + macos_x86_64: + runs-on: macos-13 strategy: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] @@ -182,56 +175,6 @@ jobs: pip install Cython matplotlib seaborn cibuildwheel twine pip install -r requirements.txt CC=gcc-13 CXX=g++-13 pip install . - # - name: Install dependencies - # run: | - # brew install gcc@13 - # python -m pip install --upgrade pip - # pip install Cython matplotlib seaborn cibuildwheel twine - # pip install -r requirements.txt - # CC=gcc-13 CXX=g++-13 pip install . - # - name: Test with unittest - # run: | - # cd tests - # python -m unittest - # cd .. - - name: Build with cibuildwheel - run: | - python -m cibuildwheel --output-dir wheelhouse - ls wheelhouse/ - env: - MACOSX_DEPLOYMENT_TARGET: "10.14" - CIBW_BEFORE_BUILD: "pip install numpy delocate==0.10.7" - CIBW_BUILD: ${{ matrix.cibw-string }} - CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" - CC: gcc-13 - CXX: g++-13 - - name: Upload with twine - if: "contains(github.event.head_commit.message, 'PyPI')" - run: | - python -m twine upload wheelhouse/*.whl - env: - TWINE_PASSWORD: ${{ secrets.twine_api_key }} - TWINE_USERNAME: __token__ - macos_x86_64: - runs-on: macos-13 - strategy: - matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] - include: - - python-version: "3.9" - cibw-string: "cp39-*" - - python-version: "3.10" - cibw-string: "cp310-*" - - python-version: "3.11" - cibw-string: "cp311-*" - - python-version: "3.12" - cibw-string: "cp312-*" - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - name: Install dependencies run: | brew install gcc@13 @@ -239,24 +182,17 @@ jobs: pip install Cython matplotlib seaborn cibuildwheel twine pip install -r requirements.txt CC=gcc-13 CXX=g++-13 pip install . - # - name: Install dependencies - # run: | - # brew install gcc@13 - # python -m pip install --upgrade pip - # pip install Cython matplotlib seaborn cibuildwheel twine - # pip install -r requirements.txt - # CC=gcc-13 CXX=g++-13 pip install . - # - name: Test with unittest - # run: | - # cd tests - # python -m unittest - # cd .. + - name: Test with unittest + run: | + cd tests + python -m unittest + cd .. - name: Build with cibuildwheel run: | python -m cibuildwheel --output-dir wheelhouse ls wheelhouse/ env: - MACOSX_DEPLOYMENT_TARGET: "10.14" + MACOSX_DEPLOYMENT_TARGET: "10.13" CIBW_BEFORE_BUILD: "pip install numpy delocate==0.10.7" CIBW_BUILD: ${{ matrix.cibw-string }} CIBW_REPAIR_WHEEL_COMMAND: "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" diff --git a/setup.py b/setup.py index e0325dae..bca69f29 100755 --- a/setup.py +++ b/setup.py @@ -35,15 +35,6 @@ np.get_include(), ] -# if sys.platform == 'darwin': -# extensions = [] -# else: -# extensions = [Extension('pygpc.pygpc_extensions', -# sources=pygpc_extensions_src_file_path, -# include_dirs=pygpc_extensions_include_path, -# extra_compile_args=openmp_compile_args, -# extra_link_args=openmp_link_args)] - extensions = [ Extension( "pygpc.pygpc_extensions", @@ -56,7 +47,7 @@ setup( name="pygpc", - version="0.3.9", + version="0.4.0", description="A sensitivity and uncertainty analysis toolbox for Python", author="Konstantin Weise", author_email="kweise@cbs.mpg.de",