From c35763e6579e34070d21861b678183bd951ef12f Mon Sep 17 00:00:00 2001 From: Ian Su Date: Mon, 8 Dec 2025 14:44:59 -0500 Subject: [PATCH 1/6] refactor cuda setup --- CMakeLists.txt | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da527286d..45f24f7c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,9 +64,6 @@ project(IPCToolkit LANGUAGES CXX VERSION "1.5.0") -include(CheckLanguage) -check_language(CUDA) - if(IPC_TOOLKIT_TOPLEVEL_PROJECT) option(IPC_TOOLKIT_BUILD_TESTS "Build unit-tests" ON) option(IPC_TOOLKIT_BUILD_PYTHON "Build Python bindings" OFF) @@ -77,11 +74,7 @@ else() set(IPC_TOOLKIT_BUILD_PYTHON OFF CACHE BOOL "Build Python bindings" FORCE) endif() -if(CMAKE_CUDA_COMPILER) - option(IPC_TOOLKIT_WITH_CUDA "Enable CUDA CCD" ON) -else() - option(IPC_TOOLKIT_WITH_CUDA "Enable CUDA CCD" OFF) -endif() +option(IPC_TOOLKIT_WITH_CUDA "Enable CUDA CCD" OFF) option(IPC_TOOLKIT_WITH_RATIONAL_INTERSECTION "Use rational edge-triangle intersection check" OFF) option(IPC_TOOLKIT_WITH_ROBIN_MAP "Use Tessil's robin-map rather than std maps" ON) option(IPC_TOOLKIT_WITH_ABSEIL "Use Abseil's hash functions" ON) @@ -245,10 +238,6 @@ target_compile_features(ipc_toolkit PUBLIC cxx_std_17) ################################################################################ if(IPC_TOOLKIT_WITH_CUDA) - if(NOT CMAKE_CUDA_COMPILER) - message(FATAL_ERROR "CUDA support requested but no CUDA compiler found!") - endif() - # Enable CUDA support enable_language(CUDA) @@ -256,10 +245,6 @@ if(IPC_TOOLKIT_WITH_CUDA) # library to be built with -dc as the member functions could be called by # other libraries and executables. set_target_properties(ipc_toolkit PROPERTIES CUDA_SEPARABLE_COMPILATION ON) - - # Use the same CUDA architectures Scalable CCD - get_target_property(CMAKE_CUDA_ARCHITECTURES scalable_ccd CUDA_ARCHITECTURES) - set_target_properties(ipc_toolkit PROPERTIES CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES}") endif() ################################################################################ @@ -311,4 +296,4 @@ if (CMAKE_GENERATOR STREQUAL "Xcode") if(IPC_TOOLKIT_BUILD_PYTHON) set_target_properties(ipctk PROPERTIES XCODE_GENERATE_SCHEME ON) endif() -endif() \ No newline at end of file +endif() From ff7c776253f622e7c58c9f17484119ad91b9c085 Mon Sep 17 00:00:00 2001 From: Ian Su Date: Mon, 8 Dec 2025 20:56:32 -0500 Subject: [PATCH 2/6] set CMAKE_CUDA_ARCHITECTURES to native if not specified --- CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45f24f7c7..024774f1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ else() endif() # Check required CMake version -set(REQUIRED_CMAKE_VERSION "3.18.0") +set(REQUIRED_CMAKE_VERSION "3.24.0") if(IPC_TOOLKIT_TOPLEVEL_PROJECT) cmake_minimum_required(VERSION ${REQUIRED_CMAKE_VERSION}) else() @@ -238,6 +238,15 @@ target_compile_features(ipc_toolkit PUBLIC cxx_std_17) ################################################################################ if(IPC_TOOLKIT_WITH_CUDA) + # If CMAKE_CUDA_ARCHITECTURES was not specified, set it to native. + if(DEFINED CMAKE_CUDA_ARCHITECTURES) + message(STATUS "CMAKE_CUDA_ARCHITECTURES was specified, skipping auto-detection") + else() + message(STATUS "CMAKE_CUDA_ARCHITECTURES was not specified, set it to native") + set(CMAKE_CUDA_ARCHITECTURES "native") + endif() + message(STATUS "Targeting CUDA_ARCHITECTURES \"${CMAKE_CUDA_ARCHITECTURES}\"") + # Enable CUDA support enable_language(CUDA) From 447a34a96e9d604b987bca3be10bf7922e6ea283 Mon Sep 17 00:00:00 2001 From: Ian Su Date: Mon, 8 Dec 2025 21:18:18 -0500 Subject: [PATCH 3/6] update build config --- .github/workflows/cuda.yml | 1 + CMakePresets.json | 4 ++-- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml index 7d5756328..a02ee16aa 100644 --- a/.github/workflows/cuda.yml +++ b/.github/workflows/cuda.yml @@ -70,6 +70,7 @@ jobs: cd build cmake .. \ -DIPC_TOOLKIT_WITH_CUDA=ON \ + -DCMAKE_CUDA_ARCHITECTURES=75 \ -DSCALABLE_CCD_CUDA_ARCHITECTURES=75 \ -DIPC_TOOLKIT_BUILD_TESTS=ON \ -DIPC_TOOLKIT_BUILD_PYTHON=ON \ diff --git a/CMakePresets.json b/CMakePresets.json index 9409f0cde..fee266796 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -2,7 +2,7 @@ "version": 3, "cmakeMinimumRequired": { "major": 3, - "minor": 18 + "minor": 24 }, "configurePresets": [{ "name": "release", @@ -166,4 +166,4 @@ } } ] -} \ No newline at end of file +} diff --git a/pyproject.toml b/pyproject.toml index 2c21cb2ad..c49aa832f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = [ "setuptools>=42", "wheel", "ninja", - # "cmake>=3.14", + # "cmake>=3.24", ] build-backend = "setuptools.build_meta" From 476fa3b5f84f65de74c54b672df297d18e0f30e5 Mon Sep 17 00:00:00 2001 From: Ian Su Date: Mon, 8 Dec 2025 21:18:23 -0500 Subject: [PATCH 4/6] update doc --- docs/source/build/c++.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/source/build/c++.rst b/docs/source/build/c++.rst index 309f8643f..596ecbc07 100644 --- a/docs/source/build/c++.rst +++ b/docs/source/build/c++.rst @@ -53,6 +53,8 @@ You can build the IPC Toolkit using CMake as you would any other CMake project. This will build the IPC Toolkit and all of its dependencies. The ``IPC_TOOLKIT_BUILD_TESTS`` option enables building the unit tests, and the ``IPC_TOOLKIT_BUILD_PYTHON`` option enables building the Python bindings. +CUDA support is disabled by default. Enable it by setting CMake option ``IPC_TOOLKIT_WITH_CUDA`` to ON. + .. warning:: Installing the IPC Toolkit using the ``make install`` has not been tested and is not recommended. The IPC Toolkit is designed to be used as a submodule in your project, and as such does not have a proper install target. @@ -61,4 +63,4 @@ Dependencies **All required dependencies are downloaded through CMake** depending on the build options, and are built automatically when you build the IPC Toolkit. You do not need to install them separately. -A full list of dependencies can be found on the `dependencies page `_. \ No newline at end of file +A full list of dependencies can be found on the `dependencies page `_. From a5b710bcc6765386dd2d20ec5f3b268edf4b9814 Mon Sep 17 00:00:00 2001 From: Ian Su Date: Mon, 8 Dec 2025 21:26:08 -0500 Subject: [PATCH 5/6] update readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 97f2e5dbc..63a456b82 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ This is not a full simulation library. As such it does not include any physics o Instruction for building and including the IPC Toolkit in your CMake project can be found on the website [here](https://ipctk.xyz/build.html). +CUDA support is disabled by default and can be enabled with the CMake option `-DIPC_TOOLKIT_WITH_CUDA=ON`. + ### Dependencies The IPC Toolkit depends on a handful of third-party libraries, which are used to provide various functionality. @@ -93,4 +95,4 @@ This project is licensed under the MIT License. You are free to use, modify, and distribute this code in your projects, even commercial ones, as long as you include the original copyright and license notice. A copy of the full license text can be found in the LICENSE file. -If you use this code in a product you distribute to others, you are required to **include a copy of the original copyright and license notice**. This is typically done in the product's documentation, an "About" or "Third-Party Licenses" section, or in a clear open-source software statement. \ No newline at end of file +If you use this code in a product you distribute to others, you are required to **include a copy of the original copyright and license notice**. This is typically done in the product's documentation, an "About" or "Third-Party Licenses" section, or in a clear open-source software statement. From 3b82be62182f9f1aec9e5c8dc295ea55aaf10b48 Mon Sep 17 00:00:00 2001 From: Zachary Ferguson Date: Mon, 8 Dec 2025 22:29:26 -0500 Subject: [PATCH 6/6] Fix grammar and punctuation in README.md Corrected punctuation and grammar in the README file for clarity. --- README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 63a456b82..2aeaad6c3 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ IPC Toolkit is a set of reusable functions to integrate Incremental Potential Co ### Features -* IPC barrier function and its derivatives and adaptive barrier stiffness algorithm +* IPC barrier function and its derivatives, and adaptive barrier stiffness algorithm * Broad- and narrow-phase continuous collision detection (CCD) of linear and nonlinear trajectories * Distance computation and derivatives between edges in 2D and triangles in 3D * Distance barrier potential and its derivatives @@ -24,13 +24,11 @@ IPC Toolkit is a set of reusable functions to integrate Incremental Potential Co ### Limitations -This is not a full simulation library. As such it does not include any physics or solvers. For a full simulation implementation, we recommend [PolyFEM](https://polyfem.github.io/) (a finite element library) or [Rigid IPC](https://github.com/ipc-sim/rigid-ipc) (rigid-body dynamics) both of which utilize the IPC Toolkit. +This is not a full simulation library. As such, it does not include any physics or solvers. For a full simulation implementation, we recommend [PolyFEM](https://polyfem.github.io/) (a finite element library) or [Rigid IPC](https://github.com/ipc-sim/rigid-ipc) (rigid-body dynamics), both of which utilize the IPC Toolkit. ## Build -Instruction for building and including the IPC Toolkit in your CMake project can be found on the website [here](https://ipctk.xyz/build.html). - -CUDA support is disabled by default and can be enabled with the CMake option `-DIPC_TOOLKIT_WITH_CUDA=ON`. +Instructions for building and including the IPC Toolkit in your CMake project can be found on the website [here](https://ipctk.xyz/build/c++.html). ### Dependencies @@ -44,7 +42,7 @@ A full list of dependencies can be found on the [dependencies page](https://ipct We provide Python bindings for functions in the toolkit using [pybind11](https://github.com/pybind/pybind11). -For more information see the [Python documentation](https://ipctk.xyz/python.html). +For more information, see the [Python documentation](https://ipctk.xyz/python.html). ## Usage @@ -63,7 +61,7 @@ Simply fork this repository and make a Pull Request! We would appreciate: ## Citation -IPC Toolkit is created and maintained by academics: citations let us know our work is having impact! Please cite the IPC Toolkit or otherwise give a shout-out if and when it contributes to published works. +The IPC Toolkit is created and maintained by academics: citations let us know our work is having an impact! Please cite the IPC Toolkit or otherwise give a shout-out if and when it contributes to published works. ```bibtex @software{ipc_toolkit,