Skip to content

Commit

Permalink
[runtime] update libtorch to latest version (#1582)
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhendong authored Nov 24, 2022
1 parent 99cc64b commit 1da0acc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 32 deletions.
2 changes: 1 addition & 1 deletion runtime/binding/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def read_long_description():

setuptools.setup(
name=package_name,
version='1.0.11',
version='1.0.12',
author="Binbin Zhang",
author_email="[email protected]",
package_dir={
Expand Down
54 changes: 23 additions & 31 deletions runtime/core/cmake/libtorch.cmake
Original file line number Diff line number Diff line change
@@ -1,54 +1,47 @@
if(TORCH)
add_definitions(-DUSE_TORCH)
if(NOT ANDROID)
set(PYTORCH_VERSION "1.10.0")
if(GPU)
add_definitions(-DUSE_GPU)
set(CUDA_NAME "cu113")
endif()
if(IOS)
add_definitions(-DIOS)
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
message(FATAL_ERROR "GPU is supported only Linux, you can use CPU version")
else()
add_definitions(-DUSE_GPU)
endif()
endif()

if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
if(GPU)
message(FATAL_ERROR "GPU on Windows is unsupported, you can use CPU version")
endif()
if(${CMAKE_BUILD_TYPE} MATCHES "Release")
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip")
set(URL_HASH "SHA256=d7043b7d7bdb5463e5027c896ac21b83257c32c533427d4d0d7b251548db8f4b")
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-1.13.0%2Bcpu.zip")
set(URL_HASH "SHA256=bece54d36377990257e9d028c687c5b6759c5cfec0a0153da83cf6f0f71f648f")
else()
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-${PYTORCH_VERSION}%2Bcpu.zip")
set(URL_HASH "SHA256=d98c1b6d425ce62a6d65c16d496ef808fb2e7053d706202c536a7e437a5ade86")
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-1.13.0%2Bcpu.zip")
set(URL_HASH "SHA256=3cc7ba3c3865d86f03d78c2f0878fdbed8b764359476397a5c95cf3bba0d665a")
endif()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if(CXX11_ABI)
if(NOT GPU)
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip")
set(URL_HASH "SHA256=6d7be1073d1bd76f6563572b2aa5548ad51d5bc241d6895e3181b7dc25554426")
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.13.0%2Bcpu.zip")
set(URL_HASH "SHA256=d52f63577a07adb0bfd6d77c90f7da21896e94f71eb7dcd55ed7835ccb3b2b59")
else()
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/${CUDA_NAME}/libtorch-cxx11-abi-shared-with-deps-${PYTORCH_VERSION}%2B${CUDA_NAME}.zip")
set(URL_HASH "SHA256=190e963e739d5f7c2dcf94b3994de8fcd335706a4ebb333812ea7d8c841beb06")
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cu113/libtorch-cxx11-abi-shared-with-deps-1.12.0%2Bcu113.zip")
set(URL_HASH "SHA256=80f089939de20e68e3fcad4dfa72a26c8bf91b5e77b11042f671f39ebac35865")
endif()
else()
if(NOT GPU)
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-${PYTORCH_VERSION}%2Bcpu.zip")
set(URL_HASH "SHA256=16961222938b205a6a767b0b0b9f5e3b1f8740aa1f3475580e33cfd5952b1a44")
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-1.13.0%2Bcpu.zip")
set(URL_HASH "SHA256=bee1b7be308792aa60fc95a4f5274d9658cb7248002d0e333d49eb81ec88430c")
else()
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/${CUDA_NAME}/libtorch-shared-with-deps-${PYTORCH_VERSION}%2B${CUDA_NAME}.zip")
set(URL_HASH "SHA256=0996a6a4ea8bbc1137b4fb0476eeca25b5efd8ed38955218dec1b73929090053")
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cu113/libtorch-shared-with-deps-1.11.0%2Bcu113.zip")
set(URL_HASH "SHA256=90159ecce3ff451f3ef3f657493b6c7c96759c3b74bbd70c1695f2ea2f81e1ad")
endif()
endif()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
if(GPU)
message(FATAL_ERROR "GPU on Darwin is unsupported, you can use CPU version")
endif()
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-macos-${PYTORCH_VERSION}.zip")
set(URL_HASH "SHA256=07cac2c36c34f13065cb9559ad5270109ecbb468252fb0aeccfd89322322a2b5")
set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-macos-1.13.0.zip")
set(URL_HASH "SHA256=a8f80050b95489b4e002547910410c2c230e9f590ffab2482e19e809afe4f7aa")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
if(GPU)
message(FATAL_ERROR "GPU on iOS is unsupported, you can use CPU version")
endif()
add_definitions(-DIOS)
else()
message(FATAL_ERROR "Unsupported CMake System Name '${CMAKE_SYSTEM_NAME}' (expected 'Windows', 'Linux' or 'Darwin')")
message(FATAL_ERROR "Unsupported System '${CMAKE_SYSTEM_NAME}' (expected 'Windows', 'Linux', 'Darwin' or 'iOS')")
endif()

# iOS use LibTorch from pod install
Expand Down Expand Up @@ -83,5 +76,4 @@ if(TORCH)
${PYTORCH_INCLUDE_DIRS}/torch/csrc/api/include
)
endif()
add_definitions(-DUSE_TORCH)
endif()

0 comments on commit 1da0acc

Please sign in to comment.