From a5ba00588861d8d6b576f7fc3c056f4327525f4c Mon Sep 17 00:00:00 2001 From: Marco Barbone Date: Tue, 25 Feb 2025 12:04:02 -0500 Subject: [PATCH] using shared linking in cufinufft --- .github/workflows/build_cufinufft_wheels.yml | 2 +- .github/workflows/build_finufft_wheels.yml | 2 +- python/cufinufft/pyproject.toml | 2 +- src/cuda/CMakeLists.txt | 9 ++++++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_cufinufft_wheels.yml b/.github/workflows/build_cufinufft_wheels.yml index e1936c7d7..f847fe9d3 100644 --- a/.github/workflows/build_cufinufft_wheels.yml +++ b/.github/workflows/build_cufinufft_wheels.yml @@ -12,7 +12,7 @@ jobs: buildplat: - [ ubuntu-22.04, manylinux_x86_64 ] - [ windows-2019, win_amd64 ] - python: [ "cp310", "cp311", "cp312", "cp313" ] # exclude pp313t for now + python: [ "cp38", "cp39", "cp310", "cp311", "cp312", "cp313" ] # exclude pp313t for now steps: - uses: actions/checkout@v4 - uses: ilammy/msvc-dev-cmd@v1 diff --git a/.github/workflows/build_finufft_wheels.yml b/.github/workflows/build_finufft_wheels.yml index c477df02e..c4141b823 100644 --- a/.github/workflows/build_finufft_wheels.yml +++ b/.github/workflows/build_finufft_wheels.yml @@ -15,7 +15,7 @@ jobs: - [ macos-13, macosx_x86_64 ] - [ macos-14, macosx_arm64 ] - [ windows-2019, win_amd64 ] - python: [ "cp311", "cp312", "cp313" ] # exclude pp313t for now + python: [ "cp38", "cp39", "cp310", "cp311", "cp312", "cp313" ] # exclude pp313t for now steps: - uses: actions/checkout@v4 - name: Install dependencies diff --git a/python/cufinufft/pyproject.toml b/python/cufinufft/pyproject.toml index 221cbc052..885add4d2 100644 --- a/python/cufinufft/pyproject.toml +++ b/python/cufinufft/pyproject.toml @@ -78,7 +78,7 @@ input = "cufinufft/__init__.py" # Necessary to see build output from the actual compilation build-verbosity = 1 skip = "cp36-* cp37-* cp-38* pp37-* *-manylinux_i686 *_ppc64le *_s390x *_universal2" -config-settings = {"cmake.define.CMAKE_CUDA_ARCHITECTURES" = "50;60;70;80"} +config-settings = {"cmake.define.CMAKE_CUDA_ARCHITECTURES" = "50;60;70;80", "cmake.define.CIBUILDWHEEL" = "ON"} [tool.cibuildwheel.linux] manylinux-x86_64-image = "manylinux2014" diff --git a/src/cuda/CMakeLists.txt b/src/cuda/CMakeLists.txt index 32a068e53..212eb4b03 100644 --- a/src/cuda/CMakeLists.txt +++ b/src/cuda/CMakeLists.txt @@ -70,6 +70,13 @@ set_target_properties( PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}" ) +if(DEFINED CIBUILDWHEEL) + set(CUDA_LINK_TYPE Shared) + message(STATUS RUNNING FROM CIBUILDWHEEL) +else() + set(CUDA_LINK_TYPE Static) +endif() + set_target_properties( cufinufft PROPERTIES @@ -79,7 +86,7 @@ set_target_properties( CUDA_STANDARD_REQUIRED ON WINDOWS_EXPORT_ALL_SYMBOLS ON ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" - CUDA_RUNTIME_LIBRARY Static + CUDA_RUNTIME_LIBRARY ${CUDA_LINK_TYPE} ) target_compile_features(cufinufft PRIVATE cxx_std_17) target_compile_options(cufinufft PRIVATE ${FINUFFT_CUDA_FLAGS})