@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.26)
22set_property (GLOBAL PROPERTY USE_FOLDERS ON )
33
44option (USE_CCACHE "Attempt using CCache to wrap the compilation" ON )
5- option (USE_CXX11_ABI "Use the new C++-11 ABI, which is not backwards compatible." ON )
65option (USE_MANYLINUX "Build for manylinux" OFF )
76
87option (BUILD_NVBENCH "Build the nvbench binary" OFF )
@@ -42,15 +41,6 @@ if(NOT CMAKE_BUILD_TYPE)
4241 )
4342endif ()
4443
45- # Convert the bool variable to integer.
46- if (USE_CXX11_ABI)
47- set (USE_CXX11_ABI 1)
48- message (STATUS "Using the C++-11 ABI." )
49- else ()
50- set (USE_CXX11_ABI 0)
51- message (STATUS "Using the pre C++-11 ABI." )
52- endif ()
53-
5444if (USE_CCACHE)
5545 find_program (CCACHE_PROGRAM ccache)
5646 if (CCACHE_PROGRAM)
@@ -111,20 +101,11 @@ else()
111101 set (VCPKG_SOURCE_DIR ${FETCHCONTENT_BASE_DIR} /vcpkg-src)
112102 endif ()
113103
114- if (USE_CXX11_ABI)
115- FetchContent_Declare(vcpkg
116- GIT_REPOSITORY "https://github.com/microsoft/vcpkg.git"
117- GIT_TAG "2024.02.14"
118- SOURCE_DIR ${VCPKG_SOURCE_DIR}
119- )
120- else ()
121- FetchContent_Declare(vcpkg
122- GIT_REPOSITORY "https://github.com/vectorch-ai/vcpkg.git"
123- GIT_TAG "ffc42e97c866ce9692f5c441394832b86548422c" # disable cxx11_abi
124- SOURCE_DIR ${VCPKG_SOURCE_DIR}
125- )
126- message (STATUS "Using custom vcpkg with cxx11_abi disabled" )
127- endif ()
104+ FetchContent_Declare(vcpkg
105+ GIT_REPOSITORY "https://github.com/microsoft/vcpkg.git"
106+ GIT_TAG "2024.02.14"
107+ SOURCE_DIR ${VCPKG_SOURCE_DIR}
108+ )
128109 FetchContent_MakeAvailable(vcpkg)
129110
130111 message (STATUS "Downloading and using vcpkg at ${vcpkg_SOURCE_DIR} " )
@@ -179,12 +160,9 @@ endif()
179160
180161find_package (NCCL REQUIRED)
181162
182- if (USE_CXX11_ABI)
183- # only use jemalloc if using the new C++-11 ABI
184- find_package (Jemalloc)
185- if (Jemalloc_FOUND)
186- link_libraries (Jemalloc::jemalloc)
187- endif ()
163+ find_package (Jemalloc)
164+ if (Jemalloc_FOUND)
165+ link_libraries (Jemalloc::jemalloc)
188166endif ()
189167
190168# Important Note: Always invoke find_package for other dependencies
@@ -195,27 +173,15 @@ if (DEFINED ENV{LIBTORCH_ROOT})
195173 message (STATUS "Using libtorch at $ENV{LIBTORCH_ROOT} " )
196174else ()
197175 include (FetchContent)
198- if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL 12.4)
199- # download libtorch 2.6.0 with cuda 12.4 from pytorch.org
200- if (USE_CXX11_ABI)
201- set (LIBTORCH_URL "https://download.pytorch.org/libtorch/cu124/libtorch-cxx11-abi-shared-with-deps-2.6.0%2Bcu124.zip" )
202- else ()
203- set (LIBTORCH_URL "https://download.pytorch.org/libtorch/cu124/libtorch-shared-with-deps-2.6.0%2Bcu124.zip" )
204- endif ()
205- elseif (CUDAToolkit_VERSION VERSION_GREATER_EQUAL 12.1)
206- # download libtorch 2.6.0 with cuda 12.1 from pytorch.org
207- if (USE_CXX11_ABI)
208- set (LIBTORCH_URL "https://download.pytorch.org/libtorch/cu121/libtorch-cxx11-abi-shared-with-deps-2.6.0%2Bcu121.zip" )
209- else ()
210- set (LIBTORCH_URL "https://download.pytorch.org/libtorch/cu121/libtorch-shared-with-deps-2.6.0%2Bcu121.zip" )
211- endif ()
176+ if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL 12.8)
177+ # download libtorch 2.7.0 with cuda 12.8 from pytorch.org
178+ set (LIBTORCH_URL "https://download.pytorch.org/libtorch/cu128/libtorch-cxx11-abi-shared-with-deps-2.7.0%2Bcu128.zip" )
179+ elseif (CUDAToolkit_VERSION VERSION_GREATER_EQUAL 12.6)
180+ # download libtorch 2.7.0 with cuda 12.6 from pytorch.org
181+ set (LIBTORCH_URL "https://download.pytorch.org/libtorch/cu126/libtorch-cxx11-abi-shared-with-deps-2.7.0%2Bcu126.zip" )
212182 elseif (CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.8)
213- # download libtorch 2.6.0 with cuda 11.8 from pytorch.org
214- if (USE_CXX11_ABI)
215- set (LIBTORCH_URL "https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.6.0%2Bcu118.zip" )
216- else ()
217- set (LIBTORCH_URL "https://download.pytorch.org/libtorch/cu118/libtorch-shared-with-deps-2.6.0%2Bcu118.zip" )
218- endif ()
183+ # download libtorch 2.7.0 with cuda 11.8 from pytorch.org
184+ set (LIBTORCH_URL "https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.7.0%2Bcu118.zip" )
219185 else ()
220186 # error out if cuda version is not supported
221187 message (FATAL_ERROR "Unsupported CUDA version: ${CUDAToolkit_VERSION} " )
@@ -234,18 +200,7 @@ else()
234200 FetchContent_MakeAvailable(libtorch)
235201
236202 find_package (Torch REQUIRED PATHS ${libtorch_SOURCE_DIR} NO_DEFAULT_PATH)
237- message (STATUS "Downloading and using libtorch 2.6.0 for cuda ${CUDA_VERSION} at ${libtorch_SOURCE_DIR} " )
238- endif ()
239-
240- # check if USE_CXX11_ABI is set correctly
241- if (DEFINED USE_CXX11_ABI)
242- parse_make_options(${TORCH_CXX_FLAGS} "TORCH_CXX_FLAGS" )
243- if (DEFINED TORCH_CXX_FLAGS__GLIBCXX_USE_CXX11_ABI
244- AND NOT ${TORCH_CXX_FLAGS__GLIBCXX_USE_CXX11_ABI} EQUAL ${USE_CXX11_ABI} )
245- message (FATAL_ERROR
246- "The libtorch compilation options _GLIBCXX_USE_CXX11_ABI=${TORCH_CXX_FLAGS__GLIBCXX_USE_CXX11_ABI} "
247- "found by CMake conflict with the project setting USE_CXX11_ABI=${USE_CXX11_ABI} ." )
248- endif ()
203+ message (STATUS "Downloading and using libtorch 2.7.0 for cuda ${CUDA_VERSION} at ${libtorch_SOURCE_DIR} " )
249204endif ()
250205
251206# carry over torch flags to the rest of the project
0 commit comments