Skip to content

Commit

Permalink
DRAFT: Test to improve compilation speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Rit committed Jun 10, 2024
1 parent d5b0f36 commit ac0d54c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 330 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/apply-clang-format.yml

This file was deleted.

165 changes: 0 additions & 165 deletions .github/workflows/build-test-cxx-cuda.yml

This file was deleted.

125 changes: 4 additions & 121 deletions .github/workflows/build-test-package-python-cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,106 +4,17 @@ on: [push,pull_request]

env:
itk-wheel-tag: 'v5.4.0'
itk-python-package-tag: 'f38e8b0f38580807809b0412235fb2ba0946deba'
itk-python-package-tag: '9a08b25eece8a3332c6f93cfb1e60580c521bfc3'
itk-python-package-org: 'InsightSoftwareConsortium'
itk-module-deps: "RTKConsortium/[email protected]"

jobs:
build-linux-cuda-python-packages:
runs-on: self-hosted-linux
strategy:
max-parallel: 2
matrix:
python3-minor-version: ["8","9","10","11"]
manylinux-platform: ["_2_28-x64","2014-x64"]
cuda-version: ["116","121"]

steps:
- uses: actions/checkout@v3

- name: 'Fetch build script'
run: |
IPP_DOWNLOAD_GIT_TAG=${{ env.itk-python-package-tag }}
IPP_DOWNLOAD_ORG=${{ env.itk-python-package-org }}
curl -L https://raw.githubusercontent.com/${IPP_DOWNLOAD_ORG:=InsightSoftwareConsortium}/ITKPythonPackage/${IPP_DOWNLOAD_GIT_TAG:=master}/scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh -O
chmod u+x dockcross-manylinux-download-cache-and-build-module-wheels.sh
- name: 'Build 🐍 Python 📦 package'
shell: bash
run: |
rm -rf dist
export ITK_PACKAGE_VERSION=${{ env.itk-wheel-tag }}
export ITKPYTHONPACKAGE_TAG=${{ env.itk-python-package-tag }}
export ITKPYTHONPACKAGE_ORG=${{ env.itk-python-package-org }}
export ITK_MODULE_PREQ=${{ env.itk-module-deps }}
export CUDA_VERSION=${{ matrix.cuda-version }}
export CUDA_VERSION_MAJOR=`(echo ${CUDA_VERSION} | cut -b1-2)`
export CUDA_VERSION_MINOR=`(echo ${CUDA_VERSION} | cut -b3-)`
CMAKE_OPTIONS="-DRTK_CUDA_VERSION=${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}"
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DRTK_BUILD_APPLICATIONS:BOOL=OFF"
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCUDAToolkit_ROOT=/usr/lib64/cuda${CUDA_VERSION}"
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DCMAKE_CUDA_COMPILER=/usr/lib64/cuda${CUDA_VERSION}/bin/nvcc"
# The first two are not library paths but are included to be mounted in the
# docker by dockcross-manylinux-build-module-wheels.sh
export LD_LIBRARY_PATH="/home/srit/Downloads/cuda${CUDA_VERSION}"
export LD_LIBRARY_PATH="/usr/lib64/libcuda.so.1:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/home/srit/Downloads/cuda${CUDA_VERSION}/targets/x86_64-linux/lib:$LD_LIBRARY_PATH"
if test -e ../../ITKPythonBuilds-linux-manylinux2014.tar.zst ; then
mv ../../*zst .
fi
MANYLINUX_PLATFORM=${{ matrix.manylinux-platform }}
if test ${MANYLINUX_PLATFORM} == "_2_28-x64" && test ${CUDA_VERSION} -lt 120; then
export IMAGE_TAG=20230106-1aeaea0
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DITK_USE_PYTHON_LIMITED_API=FALSE"
fi
CMAKE_OPTIONS=(--cmake_options "${CMAKE_OPTIONS}")
echo "Manylinux platform ${MANYLINUX_PLATFORM}"
rm -rf ITKPythonPackage
export MANYLINUX_VERSION=`(echo ${MANYLINUX_PLATFORM} | cut -d '-' -f 1)`
export TARGET_ARCH=`(echo ${MANYLINUX_PLATFORM} | cut -d '-' -f 2)`
export ITK_MODULE_NO_CLEANUP=TRUE
echo "Building for manylinux specialization ${MANYLINUX_VERSION} and target architecture ${TARGET_ARCH}"
LIBCUDART=`basename /home/srit/Downloads/cuda${CUDA_VERSION}/targets/x86_64-linux/lib/libcudart.so.${CUDA_VERSION_MAJOR}*`
LIBCUBLAS=`basename /home/srit/Downloads/cuda${CUDA_VERSION}/targets/x86_64-linux/lib/libcublas.so.${CUDA_VERSION_MAJOR}*`
LIBCUBLASLT=`basename /home/srit/Downloads/cuda${CUDA_VERSION}/targets/x86_64-linux/lib/libcublasLt.so.${CUDA_VERSION_MAJOR}*`
LIBCUFFT=`basename /home/srit/Downloads/cuda${CUDA_VERSION}/targets/x86_64-linux/lib/libcufft.so.$((${CUDA_VERSION_MAJOR}-1))*`
sed -i "s/dependencies = \[/dependencies = [ \"itk-cudacommon-cuda${CUDA_VERSION} == 1.1.*\",/g" pyproject.toml
sed -i "s/itk-rtk/itk-rtk-cuda${CUDA_VERSION}/g" pyproject.toml
./dockcross-manylinux-download-cache-and-build-module-wheels.sh "${CMAKE_OPTIONS[@]}" -x "libcuda.so.1;${LIBCUDART};${LIBCUBLAS};${LIBCUBLASLT};${LIBCUFFT}" cp3${{ matrix.python3-minor-version }}
mv *zst ../..
- name: Validate build output
shell: bash
run: |
/home/srit/miniconda3/envs/py310/bin/python -m pip install twine
ls dist/
MANYLINUX_PLATFORM=${{ matrix.manylinux-platform }}
MANYLINUX_VERSION=`(echo ${MANYLINUX_PLATFORM} | cut -d '-' -f 1)`
TARGET_ARCH_NAME=`(echo ${MANYLINUX_PLATFORM} | cut -d '-' -f 2)`
if [[ ${TARGET_ARCH_NAME} == "x64" ]]; then
TARGET_ARCH_NAME="x86_64" # Match auditwheel naming convention
fi
WHEEL_PATTERN="dist/itk_*cp3${{ matrix.python3-minor-version }}*manylinux${MANYLINUX_VERSION}*${TARGET_ARCH_NAME}.whl"
echo "Searching for wheels matching pattern ${WHEEL_PATTERN}"
/home/srit/miniconda3/envs/py310/bin/python -m twine check ${WHEEL_PATTERN}
- name: Publish Python package as GitHub Artifact
uses: actions/upload-artifact@v3
with:
name: LinuxWheel3${{ matrix.python3-minor-version }}${{ matrix.manylinux-platform }}-cuda${{ matrix.cuda-version }}
path: dist/*.whl

build-windows-cuda-python-packages:
runs-on: self-hosted-windows
strategy:
max-parallel: 2
matrix:
python3-minor-version: ["8","9","10","11"]
python3-minor-version: ["11"]
cuda-version: ["116","121"]

steps:
Expand Down Expand Up @@ -139,7 +50,7 @@ jobs:
if (Test-Path dist) { rm dist -r -fo }
cd ../../im
& "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1" -HostArch amd64 -Arch amd64 -SkipAutomaticLocation
& "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 -SkipAutomaticLocation
$env:CC="cl.exe"
$env:CXX="cl.exe"
$env:ITK_PACKAGE_VERSION = "${{ env.itk-wheel-tag }}"
Expand All @@ -150,7 +61,7 @@ jobs:
$CUDA_VERSION_MAJOR=$CUDA_VERSION.substring(0,2)
$CUDA_VERSION_MINOR=$CUDA_VERSION.substring(2,$CUDA_VERSION.Length-2)
$env:CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}"
$env:CMAKE_GENERATOR_TOOLSET = "cuda=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}"
$env:CUDACXX = "$env:CUDA_PATH\bin\nvcc.exe"
$env:Path = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}\bin;" + $env:Path
$LIBCUDART= (Get-Item "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}\bin\cudart64*dll" ).Name
$LIBCUBLAS= (Get-Item "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}\bin\cublas64*dll" ).Name
Expand Down Expand Up @@ -179,31 +90,3 @@ jobs:
with:
name: WindowsWheel3${{ matrix.python3-minor-version }}-cuda${{ matrix.cuda-version }}
path: dist/*.whl

publish-python-packages-to-pypi:
needs:
- build-linux-cuda-python-packages
- build-windows-cuda-python-packages
runs-on: ubuntu-22.04

steps:
- name: Download Python Packages
uses: actions/download-artifact@v4

- name: Prepare packages for upload
run: |
ls -R
for d in */; do
mv ${d}/*.whl .
done
mkdir dist
mv *.whl dist/
ls dist
- name: Publish 🐍 Python 📦 package to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/[email protected]
with:
skip_existing: true
user: __token__
password: ${{ secrets.pypi_password }}
16 changes: 0 additions & 16 deletions .github/workflows/build-test-package.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/workflows/clang-format-linter.yml

This file was deleted.

7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ classifiers = [
"Operating System :: Unix",
"Programming Language :: C++",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
Expand Down Expand Up @@ -79,6 +80,10 @@ cmake.source-dir = "."
# string will disable this check.
ninja.version = ">=1.11"

# If CMake is not present on the system or is older required, it will be
# downloaded via PyPI if possible. An empty string will disable this check.
ninja.make-fallback = true

# The logging level to display, "DEBUG", "INFO", "WARNING", and "ERROR" are
# possible options.
logging.level = "INFO"
Expand Down Expand Up @@ -110,7 +115,7 @@ editable.mode = "redirect"
editable.rebuild = false

# If set, this will provide a method for scikit-build-core backward compatibility.
minimum-version = "0.8.2"
minimum-version = "0.9.5"

# The build directory. Defaults to a temporary directory, but can be set.
build-dir = "build/{wheel_tag}"

0 comments on commit ac0d54c

Please sign in to comment.