Skip to content

Commit

Permalink
ENH: Update to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Rit committed Jun 5, 2024
1 parent ab6406d commit 5f41dc3
Show file tree
Hide file tree
Showing 14 changed files with 151 additions and 360 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.

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

env:
itk-wheel-tag: 'v5.4.0'
itk-python-package-tag: 'v5.4.0'
itk-python-package-tag: 'f38e8b0f38580807809b0412235fb2ba0946deba'
itk-python-package-org: 'InsightSoftwareConsortium'
itk-module-deps: "RTKConsortium/ITKCudaCommon@v1.1.0"

Expand All @@ -14,9 +14,9 @@ jobs:
strategy:
max-parallel: 2
matrix:
python3-minor-version: ["8","9","10","11"]
manylinux-platform: ["_2_28-x64","2014-x64"]
cuda-version: ["116","121"]
python3-minor-version: ["11"]
manylinux-platform: ["_2_28-x64"]
cuda-version: ["121"]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -68,6 +68,8 @@ jobs:
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 ../..
Expand Down Expand Up @@ -95,89 +97,9 @@ jobs:
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"]
cuda-version: ["116","121"]

steps:
- uses: actions/checkout@v4
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 }}"
$CUDA_VERSION = "${{ matrix.cuda-version }}"
$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: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
$LIBCUBLASLT= (Get-Item "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}\bin\cublasLt64*dll" ).Name
$LIBCUFFT= (Get-Item "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}\bin\cufft64*dll" ).Name
./windows-download-cache-and-build-module-wheels.ps1 "${{ matrix.python3-minor-version }}" -setup_options "--lib-paths ""C:/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}/bin"" --exclude-libs ""nvcuda.dll;concrt140.dll;${LIBCUDART};${LIBCUBLAS};${LIBCUBLASLT};${LIBCUFFT}""" -cmake_options "-DRTK_CUDA_VERSION=${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}"
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@v4
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:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build-test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ jobs:
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-cxx.yml@main

python-build-workflow:
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-package-python.yml@main
uses: SimonRit/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-package-python.yml@4ead98d367e8d7065c93672abfaec553360db86f
with:
cmake-options: '-DRTK_BUILD_APPLICATIONS:BOOL=OFF'
itk-wheel-tag: 'v5.4.0'
itk-python-package-tag: 'v5.4.0'
itk-python-package-tag: 'f38e8b0f38580807809b0412235fb2ba0946deba'
itk-module-deps: "RTKConsortium/ITKCudaCommon@v1.1.0"
secrets:
pypi_password: ${{ secrets.pypi_password }}
12 changes: 0 additions & 12 deletions .github/workflows/clang-format-linter.yml

This file was deleted.

10 changes: 0 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,6 @@ option(RTK_BUILD_APPLICATIONS "Build RTK applications" ON)
if(RTK_BUILD_APPLICATIONS)
add_subdirectory(applications)
endif()
if(ITK_WRAP_PYTHON)
# Install Python application
install(FILES applications/rtkconjugategradient/rtkconjugategradient.py
applications/rtkelektasynergygeometry/rtkelektasynergygeometry.py
applications/rtkorageometry/rtkorageometry.py
applications/rtksimulatedgeometry/rtksimulatedgeometry.py
applications/rtkvarianobigeometry/rtkvarianobigeometry.py
DESTINATION ${RTK_INSTALL_LIB_DIR}
COMPONENT PythonWheelRuntimeLibraries)
endif()

# --------------------------------------------------------
# Setup KWStyle from ITK
Expand Down
5 changes: 4 additions & 1 deletion applications/rtkconjugategradient/rtkconjugategradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def GetCudaImageFromImage(img):
else:
return img

if __name__ == '__main__':
def main():
# argument parsing
parser = argparse.ArgumentParser(description=
'Reconstructs a 3D volume from a sequence of projections with a conjugate gradient technique',
Expand Down Expand Up @@ -131,3 +131,6 @@ def GetCudaImageFromImage(img):
writer.SetFileName(args_info.output)
writer.SetInput(conjugategradient.GetOutput())
writer.Update()

if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import itk
from itk import RTK as rtk

if __name__ == '__main__':
def main():
# Argument parsing
parser = argparse.ArgumentParser(description=
"Creates an RTK geometry file from an Elekta Synergy acquisition.")
Expand All @@ -27,3 +27,6 @@
xmlWriter.SetFilename(args.output)
xmlWriter.SetObject(reader.GetGeometry())
xmlWriter.WriteFile()

if __name__ == '__main__':
main()
5 changes: 4 additions & 1 deletion applications/rtkorageometry/rtkorageometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import itk
from itk import RTK as rtk

if __name__ == '__main__':
def main():
# Argument parsing
parser = argparse.ArgumentParser(description=
"Creates an RTK geometry file from a Varian OBI acquisition.")
Expand Down Expand Up @@ -37,3 +37,6 @@
xmlWriter.SetFilename(args.output)
xmlWriter.SetObject(reader.GetGeometry())
xmlWriter.WriteFile()

if __name__ == '__main__':
main()
Loading

0 comments on commit 5f41dc3

Please sign in to comment.