Skip to content

Commit

Permalink
feat: try using 3.25
Browse files Browse the repository at this point in the history
  • Loading branch information
wiryls committed Jan 19, 2024
1 parent fb846e5 commit dde4c15
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions dipu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 3.25)
project(torch_dipu LANGUAGES CXX)

option(DIPU_ENABLE_TESTS "Build unit tests" OFF)
Expand All @@ -18,16 +18,16 @@ generate_supported_diopi_functions(

# abi_v, torch dir, abi flag, cmake path
execute_process(
COMMAND
COMMAND
sh -c
"python -c 'import torch, builtins; from pathlib import Path; \
print(next(item[-4:-2] for item in dir(builtins) \
if \"__pybind11_internals_v4_gcc_libstdcpp_cxxabi10\" in item)); \
print(Path(torch.__path__[0]).parent.absolute()); \
print(1 if torch.compiled_with_cxx11_abi() else 0); \
print(torch.utils.cmake_prefix_path); '"
OUTPUT_VARIABLE CHECK_TORCH_OUT
OUTPUT_STRIP_TRAILING_WHITESPACE)
OUTPUT_VARIABLE CHECK_TORCH_OUT
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "\n" ";" CHECK_TORCH_OUT_LIST "${CHECK_TORCH_OUT}")
message(STATUS "CHECK_TORCH_OUT_LIST: " "${CHECK_TORCH_OUT_LIST}")

Expand Down Expand Up @@ -75,7 +75,8 @@ list(APPEND DIPU_SUPPORT_TORCHS "2.0.0" "2.1.1")
find_package(Torch REQUIRED)

message(STATUS "Found Torch Version: ${Torch_VERSION}")
if (NOT ${Torch_VERSION} IN_LIST DIPU_SUPPORT_TORCHS)

if(NOT ${Torch_VERSION} IN_LIST DIPU_SUPPORT_TORCHS)
message(FATAL_ERROR "this torch version is not supported by DIPU ${DIPU_SUPPORT_TORCHS}")
endif()

Expand All @@ -88,6 +89,7 @@ string(REGEX REPLACE "^.*(..)\$" "\\1" Torch_VERSION_MINOR "0000${Torch_VERSION_
string(REGEX REPLACE "^.*(..)\$" "\\1" Torch_VERSION_PATCH "0000${Torch_VERSION_PATCH}")

string(CONCAT Torch_VERSION ${Torch_VERSION_MAJOR}${Torch_VERSION_MINOR}${Torch_VERSION_PATCH})

# expand to pattern XYYZZ by leading zero on minor and patch ver
message(STATUS "change to dipu Torch Version: ${Torch_VERSION}")

Expand All @@ -97,8 +99,6 @@ add_compile_definitions(DIPU_TORCH_VERSION=${Torch_VERSION})
link_directories(${PYTORCH_DIR}/torch/lib)
set(DIPU_TORCH_VERSION ${Torch_VERSION})

# end torch find

if(DIPU_ENABLE_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
Expand Down

0 comments on commit dde4c15

Please sign in to comment.