Skip to content

STYLE: Replace itkTypeMacro calls with itkOverrideGetNameOfClassMacro #35

STYLE: Replace itkTypeMacro calls with itkOverrideGetNameOfClassMacro

STYLE: Replace itkTypeMacro calls with itkOverrideGetNameOfClassMacro #35

name: 'Package ITKCudaCommon with CUDA'
on: [push,pull_request]
env:
cmake-options: '-DCUDACOMMON_CUDA_VERSION=11.6'
itk-wheel-tag: 'v5.4rc01'
itk-python-package-tag: '5ad02309321621cdc7269b9b68a35013c912271c'
itk-python-package-org: 'InsightSoftwareConsortium'
jobs:
build-linux-cuda-python-packages:
runs-on: self-hosted-linux
strategy:
max-parallel: 2
matrix:
python3-minor-versions: ["7", "8", "9", "10", "11"]
manylinux-platform: ["_2_28-x64","2014-x64"]
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 }}
CMAKE_OPTIONS=(--cmake_options "${{ env.cmake-options }} -DCUDAToolkit_ROOT=/usr/lib64/cuda116 -DCMAKE_CUDA_COMPILER=/usr/lib64/cuda116/bin/nvcc")
export LD_LIBRARY_PATH="/home/srit/Downloads/cuda116:/home/srit/Downloads/cuda116/targets/x86_64-linux/lib:/home/srit/Downloads/cuda116/lib64/stubs"
if test -e ../../ITKPythonBuilds-linux-manylinux2014.tar.zst ; then
mv ../../*zst .
fi
MANYLINUX_PLATFORM=${{ matrix.manylinux-platform }}
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}"
./dockcross-manylinux-download-cache-and-build-module-wheels.sh "${CMAKE_OPTIONS[@]}" -x "libcuda.so;libcuda.so.1;libcudart.so;libcudart.so.11.0;libcublas.so;libcublas.so.11;libcublasLt.so;libcublasLt.so.11;libcufft.so;libcufft.so.10" cp3${{ matrix.python3-minor-versions }}
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-versions }}-cuda116
path: dist/*.whl
build-windows-cuda-python-packages:
runs-on: self-hosted-windows
strategy:
max-parallel: 2
matrix:
python3-minor-version: ["7", "8", "9", "10", "11"]
steps:
- uses: actions/checkout@v3
with:
path: "im"
- name: 'Reduce source path length'
shell: bash
run: |
# Move ITKPythonBuilds archive to the checked-out source
if test -f ../../im/ITKPythonBuilds-windows.zip; then
mv ../../im/*.zip im
fi
rm -fr ../../im
# Move checked-out source to a shorter path to avoid Windows path length issues
mv im ../../
- name: 'Fetch build script'
shell: pwsh
run: |
cd ../../im
$ITKPYTHONPACKAGE_TAG = "${{ env.itk-python-package-tag }}"
$ITKPYTHONPACKAGE_ORG = "${{ env.itk-python-package-org }}"
$SCRIPT_UPSTREAM = "https://raw.githubusercontent.com/$ITKPYTHONPACKAGE_ORG/ITKPythonPackage/$ITKPYTHONPACKAGE_TAG/scripts/windows-download-cache-and-build-module-wheels.ps1"
echo "Fetching $SCRIPT_UPSTREAM"
(new-object net.webclient).DownloadString($SCRIPT_UPSTREAM) > windows-download-cache-and-build-module-wheels.ps1
- name: 'Build 🐍 Python πŸ“¦ package'
shell: pwsh
run: |
if (Test-Path dist) { rm dist -r -fo }
cd ../../im
& "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 }}"
$env:ITKPYTHONPACKAGE_TAG = "${{ env.itk-python-package-tag }}"
$env:ITKPYTHONPACKAGE_ORG = "${{ env.itk-python-package-org }}"
$env:ITK_MODULE_PREQ = "${{ env.itk-module-deps }}"
./windows-download-cache-and-build-module-wheels.ps1 "${{ matrix.python3-minor-version }}" -setup_options "--lib-paths ""C:/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.6/bin"" --exclude-libs ""nvcuda.dll;cudart64_110.dll""" -cmake_options "${{ env.cmake-options }}"
mkdir -p '${{ github.workspace }}\dist'
cp 'dist\*.whl' '${{ github.workspace }}\dist'
- name: Validate build output
shell: pwsh
run: |
python -m pip install twine
ls dist/
$WHEEL_PATTERN = "dist/itk_*cp3${{ matrix.python3-minor-version }}*win*.whl"
echo "Searching for wheels matching pattern ${WHEEL_PATTERN}"
python -m twine check ${WHEEL_PATTERN}
- name: Publish Python package as GitHub Artifact
uses: actions/upload-artifact@v3
with:
name: WindowsWheel3${{ matrix.python3-minor-version }}-cuda116
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@v3
- 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 }}