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/CMakeLists.txt b/CMakeLists.txt index da527286d..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() @@ -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,9 +238,14 @@ 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!") + # 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) @@ -256,10 +254,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 +305,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() 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/README.md b/README.md index 97f2e5dbc..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,11 +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). +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 @@ -42,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 @@ -61,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, @@ -93,4 +93,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. 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 `_. 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"