diff options
author | MathieuCarriere <mathieu.carriere3@gmail.com> | 2022-12-13 23:21:47 +0100 |
---|---|---|
committer | MathieuCarriere <mathieu.carriere3@gmail.com> | 2022-12-13 23:21:47 +0100 |
commit | d71f261aec2c5369f71cfde6b520c183dbfc56b3 (patch) | |
tree | 7c1d8bce1cd54d909b17455e78ab20023617b5f0 | |
parent | dde17f59bef478399c224fa57c1b7e809d0b87c7 (diff) | |
parent | 55155afc5e9c9201476b9a2d9096a7ae874a27f6 (diff) |
Merge branch 'master' of https://github.com/GUDHI/gudhi-devel into perslay
-rw-r--r-- | .github/workflows/pip-build-linux.yml | 18 | ||||
-rw-r--r-- | .github/workflows/pip-build-osx.yml | 14 | ||||
-rw-r--r-- | .github/workflows/pip-build-windows.yml | 2 | ||||
-rw-r--r-- | .github/workflows/pip-packaging-linux.yml | 14 | ||||
-rw-r--r-- | .github/workflows/pip-packaging-osx.yml | 19 | ||||
-rw-r--r-- | .github/workflows/pip-packaging-windows.yml | 2 | ||||
-rwxr-xr-x | scripts/build_osx_universal_gmpfr.sh | 47 | ||||
-rw-r--r-- | src/Cech_complex/utilities/cechcomplex.md | 4 | ||||
-rw-r--r-- | src/Tangential_complex/include/gudhi/Tangential_complex.h | 6 |
9 files changed, 108 insertions, 18 deletions
diff --git a/.github/workflows/pip-build-linux.yml b/.github/workflows/pip-build-linux.yml index 11b6271d..bc4f999e 100644 --- a/.github/workflows/pip-build-linux.yml +++ b/.github/workflows/pip-build-linux.yml @@ -12,16 +12,16 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - name: Build wheel for Python 3.10 + - name: Build wheel for Python 3.11 run: | - mkdir build_310 - cd build_310 - cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$PYTHON310/bin/python .. + mkdir build_311 + cd build_311 + cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$PYTHON311/bin/python .. cd src/python - $PYTHON310/bin/python setup.py bdist_wheel + $PYTHON311/bin/python setup.py bdist_wheel auditwheel repair dist/*.whl - - name: Install and test wheel for Python 3.10 + - name: Install and test wheel for Python 3.11 run: | - $PYTHON310/bin/python -m pip install --user pytest build_310/src/python/dist/*.whl - $PYTHON310/bin/python -c "import gudhi; print(gudhi.__version__)" - $PYTHON310/bin/python -m pytest src/python/test/test_alpha_complex.py + $PYTHON311/bin/python -m pip install --user pytest build_311/src/python/dist/*.whl + $PYTHON311/bin/python -c "import gudhi; print(gudhi.__version__)" + $PYTHON311/bin/python -m pytest src/python/test/test_alpha_complex.py diff --git a/.github/workflows/pip-build-osx.yml b/.github/workflows/pip-build-osx.yml index 59e94ca5..a438124a 100644 --- a/.github/workflows/pip-build-osx.yml +++ b/.github/workflows/pip-build-osx.yml @@ -2,13 +2,18 @@ name: pip build osx on: [push, pull_request] +env: + MACOSX_DEPLOYMENT_TARGET: 10.14 + _PYTHON_HOST_PLATFORM: macosx-10.14-universal2 + ARCHFLAGS: "-arch arm64 -arch x86_64" + jobs: build: runs-on: macos-latest strategy: max-parallel: 4 matrix: - python-version: ['3.10'] + python-version: ['3.11'] name: Build wheels for Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v3 @@ -24,14 +29,21 @@ jobs: brew install boost eigen gmp mpfr cgal || true python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt python -m pip install --user twine delocate + ./scripts/build_osx_universal_gmpfr.sh + # Now the universal libraries are in $PWD/deps-uni/lib - name: Build python wheel run: | + export GMP_LIB_DIR=$PWD/deps-uni/lib + export GMPXX_LIB_DIR=$PWD/deps-uni/lib + export MPFR_LIB_DIR=$PWD/deps-uni/lib python --version mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DPython_ADDITIONAL_VERSIONS=3 .. cd src/python python setup.py bdist_wheel + export PATH="$PATH:`python -m site --user-base`/bin" + delocate-wheel --require-archs universal2 -v dist/*.whl - name: Install and test python wheel run: | python -m pip install --user pytest build/src/python/dist/*.whl diff --git a/.github/workflows/pip-build-windows.yml b/.github/workflows/pip-build-windows.yml index b3d75706..50bdfe2c 100644 --- a/.github/workflows/pip-build-windows.yml +++ b/.github/workflows/pip-build-windows.yml @@ -8,7 +8,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ['3.10'] + python-version: ['3.11'] name: Build wheels for Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/pip-packaging-linux.yml b/.github/workflows/pip-packaging-linux.yml index 285cfa00..14b1cf7a 100644 --- a/.github/workflows/pip-packaging-linux.yml +++ b/.github/workflows/pip-packaging-linux.yml @@ -79,6 +79,19 @@ jobs: $PYTHON310/bin/python -m pip install --user pytest build_310/src/python/dist/*.whl $PYTHON310/bin/python -c "import gudhi; print(gudhi.__version__)" $PYTHON310/bin/python -m pytest src/python/test/test_alpha_complex.py + - name: Build wheel for Python 3.11 + run: | + mkdir build_311 + cd build_311 + cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$PYTHON311/bin/python .. + cd src/python + $PYTHON311/bin/python setup.py bdist_wheel + auditwheel repair dist/*.whl + - name: Install and test wheel for Python 3.11 + run: | + $PYTHON311/bin/python -m pip install --user pytest build_311/src/python/dist/*.whl + $PYTHON311/bin/python -c "import gudhi; print(gudhi.__version__)" + $PYTHON311/bin/python -m pytest src/python/test/test_alpha_complex.py - name: Publish on PyPi env: TWINE_USERNAME: __token__ @@ -89,3 +102,4 @@ jobs: $PYTHON36/bin/python -m twine upload build_38/src/python/wheelhouse/* $PYTHON36/bin/python -m twine upload build_39/src/python/wheelhouse/* $PYTHON36/bin/python -m twine upload build_310/src/python/wheelhouse/* + $PYTHON36/bin/python -m twine upload build_311/src/python/wheelhouse/* diff --git a/.github/workflows/pip-packaging-osx.yml b/.github/workflows/pip-packaging-osx.yml index 3ae840c6..9ddbcfce 100644 --- a/.github/workflows/pip-packaging-osx.yml +++ b/.github/workflows/pip-packaging-osx.yml @@ -4,13 +4,18 @@ on: release: types: [published] +env: + MACOSX_DEPLOYMENT_TARGET: 10.15 + _PYTHON_HOST_PLATFORM: macosx-10.15-universal2 + ARCHFLAGS: "-arch arm64 -arch x86_64" + jobs: build: runs-on: macos-latest strategy: max-parallel: 4 matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] name: Build wheels for Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v3 @@ -26,8 +31,13 @@ jobs: brew install boost eigen gmp mpfr cgal || true python -m pip install --user -r ext/gudhi-deploy/build-requirements.txt python -m pip install --user twine delocate + ./scripts/build_osx_universal_gmpfr.sh + # Now the universal libs are in $PWD/deps-uni/lib - name: Build python wheel run: | + export GMP_LIB_DIR=$PWD/deps-uni/lib + export GMPXX_LIB_DIR=$PWD/deps-uni/lib + export MPFR_LIB_DIR=$PWD/deps-uni/lib python --version mkdir build cd build @@ -45,6 +55,7 @@ jobs: TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | mkdir wheelhouse - /Users/runner/.local/bin/delocate-listdeps build/src/python/dist/* - /Users/runner/.local/bin/delocate-wheel --require-archs x86_64 -w wheelhouse build/src/python/dist/* - python -m twine upload wheelhouse/*
\ No newline at end of file + export PATH="$PATH:`python -m site --user-base`/bin" + delocate-listdeps build/src/python/dist/* + delocate-wheel --require-archs universal2 -w wheelhouse build/src/python/dist/* + python -m twine upload wheelhouse/* diff --git a/.github/workflows/pip-packaging-windows.yml b/.github/workflows/pip-packaging-windows.yml index 6f544499..df0db9a5 100644 --- a/.github/workflows/pip-packaging-windows.yml +++ b/.github/workflows/pip-packaging-windows.yml @@ -10,7 +10,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] name: Build wheels for Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v3 diff --git a/scripts/build_osx_universal_gmpfr.sh b/scripts/build_osx_universal_gmpfr.sh new file mode 100755 index 00000000..3dafa3ce --- /dev/null +++ b/scripts/build_osx_universal_gmpfr.sh @@ -0,0 +1,47 @@ +#!/bin/bash +set -e + +# In the working directory, creates deps-uni/lib/* +# Assumes that the user has enough rights to run brew fetch + +# Downloading +mkdir deps-amd64 +cd deps-amd64 +tar xf "`brew fetch --bottle-tag=big_sur gmp | sed -ne 's/^Downloaded to: //p'`" +tar xf "`brew fetch --bottle-tag=big_sur mpfr | sed -ne 's/^Downloaded to: //p'`" +cd .. +mkdir deps-arm64 +cd deps-arm64 +tar xf "`brew fetch --bottle-tag=arm64_big_sur gmp | sed -ne 's/^Downloaded to: //p'`" +tar xf "`brew fetch --bottle-tag=arm64_big_sur mpfr | sed -ne 's/^Downloaded to: //p'`" +cd .. + +# Merging +mkdir -p deps-uni/lib +GMP1=deps-amd64/gmp/*/lib/libgmp.*.dylib +GMP=`basename $GMP1` +GMPXX1=deps-amd64/gmp/*/lib/libgmpxx.*.dylib +GMPXX=`basename $GMPXX1` +MPFR1=deps-amd64/mpfr/*/lib/libmpfr.*.dylib +MPFR=`basename $MPFR1` +lipo -create $GMP1 deps-arm64/gmp/*/lib/$GMP -output deps-uni/lib/$GMP +lipo -create $GMPXX1 deps-arm64/gmp/*/lib/$GMPXX -output deps-uni/lib/$GMPXX +lipo -create $MPFR1 deps-arm64/mpfr/*/lib/$MPFR -output deps-uni/lib/$MPFR + +# Necessary even for libs created by lipo +install_name_tool -id $PWD/deps-uni/lib/$GMP deps-uni/lib/$GMP +install_name_tool -id $PWD/deps-uni/lib/$GMPXX deps-uni/lib/$GMPXX +install_name_tool -id $PWD/deps-uni/lib/$MPFR deps-uni/lib/$MPFR +# Also fix dependencies +BADGMP=`otool -L deps-uni/lib/$MPFR|sed -ne 's/[[:space:]]*\(.*libgmp\..*dylib\).*/\1/p'` +install_name_tool -change $BADGMP $PWD/deps-uni/lib/$GMP deps-uni/lib/$MPFR +BADGMP=`otool -L deps-uni/lib/$GMPXX|sed -ne 's/[[:space:]]*\(.*libgmp\..*dylib\).*/\1/p'` +install_name_tool -change $BADGMP $PWD/deps-uni/lib/$GMP deps-uni/lib/$GMPXX + +ln -s $GMP deps-uni/lib/libgmp.dylib +ln -s $GMPXX deps-uni/lib/libgmpxx.dylib +ln -s $MPFR deps-uni/lib/libmpfr.dylib + +# Debug +ls -l deps-uni/lib +otool -L deps-uni/lib/*.*.dylib diff --git a/src/Cech_complex/utilities/cechcomplex.md b/src/Cech_complex/utilities/cechcomplex.md index 0e82674d..54c4e88d 100644 --- a/src/Cech_complex/utilities/cechcomplex.md +++ b/src/Cech_complex/utilities/cechcomplex.md @@ -36,14 +36,14 @@ where * `-h [ --help ]` Produce help message * `-o [ --output-file ]` Name of file in which the persistence diagram is written. Default print in standard output. -* `-r [ --max-edge-length ]` (default = inf) Maximal length of an edge for the Čech complex construction. +* `-r [ --max-radius ]` (default = inf) Maximal radius for the Čech complex construction. * `-d [ --cpx-dimension ]` (default = 1) Maximal dimension of the Čech complex we want to compute. * `-p [ --field-charac ]` (default = 11) Characteristic p of the coefficient field Z/pZ for computing homology. * `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals. * `-e [ --exact ]` for the exact computation version. * `-f [ --fast ]` for the fast computation version. -Beware: this program may use a lot of RAM and take a lot of time if `max-edge-length` is set to a large value. +Beware: this program may use a lot of RAM and take a lot of time if `max-radius` is set to a large value. **Example 1 with Z/2Z coefficients** diff --git a/src/Tangential_complex/include/gudhi/Tangential_complex.h b/src/Tangential_complex/include/gudhi/Tangential_complex.h index b448db2d..ab203ca5 100644 --- a/src/Tangential_complex/include/gudhi/Tangential_complex.h +++ b/src/Tangential_complex/include/gudhi/Tangential_complex.h @@ -56,6 +56,7 @@ #include <string> #include <cstddef> // for std::size_t #include <optional> +#include <numeric> // for std::iota #ifdef GUDHI_USE_TBB #include <tbb/parallel_for.h> @@ -624,6 +625,11 @@ class Tangential_complex { int max_dim = -1; + // Ordered vertices to be inserted first by the create_complex method to avoid quadratic complexity. + std::vector<typename Simplex_tree_::Vertex_handle> vertices(m_points.size()); + std::iota(vertices.begin(), vertices.end(), 0); + tree.insert_batch_vertices(vertices); + // For each triangulation for (std::size_t idx = 0; idx < m_points.size(); ++idx) { // For each cell of the star |