Skip to content

Commit bc8858c

Browse files
authored
Upgrade libtorch v2.1.1 (#120)
* Upgrade libtorch to v2.1.1. * Upgrade image_io cxx standard.
1 parent 2d4669c commit bc8858c

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
77
option(DOWNLOAD_DATASETS "Automatically download required datasets at build-time." ON)
88
option(CREATE_SCRIPTMODULES "Automatically create all required scriptmodule files at build-time (requires python3)." OFF)
99

10-
set(PYTORCH_VERSION "2.0.0")
10+
set(PYTORCH_VERSION "2.1.1")
1111
set(PYTORCH_MIN_VERSION "1.12.0")
1212

1313
find_package(Torch QUIET PATHS "${CMAKE_SOURCE_DIR}/libtorch")

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ RUN curl --silent --show-error --location --output ~/miniconda.sh https://repo.a
3131

3232
FROM conda AS conda-installs
3333
# Install pytorch for CPU and torchvision.
34-
ARG PYTORCH_VERSION=2.0.0
35-
ARG TORCHVISION_VERSION=0.15.1
34+
ARG PYTORCH_VERSION=2.1.1
35+
ARG TORCHVISION_VERSION=0.16.1
3636
ENV NO_CUDA=1
3737
RUN conda install pytorch==${PYTORCH_VERSION} torchvision==${TORCHVISION_VERSION} cpuonly -y -c pytorch && conda clean -ya
3838

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
C++ Implementation of PyTorch Tutorials for Everyone
66
<br />
77
<img src="https://img.shields.io/github/license/prabhuomkar/pytorch-cpp">
8-
<img src="https://img.shields.io/badge/libtorch-2.0.0-ee4c2c">
8+
<img src="https://img.shields.io/badge/libtorch-2.1.1-ee4c2c">
99
<img src="https://img.shields.io/badge/cmake-3.14-064f8d">
1010
</p>
1111

1212

13-
| OS (Compiler)\\LibTorch | 2.0.0 |
13+
| OS (Compiler)\\LibTorch | 2.1.1 |
1414
| :--------------------- | :--------------------------------------------------------------------------------------------------- |
1515
| macOS (clang 11, 12, 13) | [![Status](https://github.com/prabhuomkar/pytorch-cpp/actions/workflows/build_macos.yml/badge.svg?branch=master)](https://github.com/prabhuomkar/pytorch-cpp/actions?query=workflow%3Aci-build-macos) |
1616
| Linux (gcc 9, 10, 11) | [![Status](https://github.com/prabhuomkar/pytorch-cpp/actions/workflows/build_ubuntu.yml/badge.svg?branch=master)](https://github.com/prabhuomkar/pytorch-cpp/actions?query=workflow%3Aci-build-ubuntu) |
@@ -52,7 +52,7 @@ This repository provides tutorial code in C++ for deep learning researchers to l
5252

5353
1. [C++-17](http://www.cplusplus.com/doc/tutorial/introduction/) compatible compiler
5454
2. [CMake](https://cmake.org/download/) (minimum version 3.14)
55-
3. [LibTorch version >= 1.12.0 and <= 2.0.0](https://pytorch.org/cppdocs/installing.html)
55+
3. [LibTorch version >= 1.12.0 and <= 2.1.1](https://pytorch.org/cppdocs/installing.html)
5656
4. [Conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html)
5757

5858

@@ -89,7 +89,7 @@ Some useful options:
8989

9090
| Option | Default | Description |
9191
| :------------- |:------------|-----:|
92-
| `-D CUDA_V=(11.7\|11.8\|none)` | `none` | Download LibTorch for a CUDA version (`none` = download CPU version). |
92+
| `-D CUDA_V=(11.8\|12.1\|none)` | `none` | Download LibTorch for a CUDA version (`none` = download CPU version). |
9393
| `-D LIBTORCH_DOWNLOAD_BUILD_TYPE=(Release\|Debug)` | `Release` | Determines which libtorch build type version to download (only relevant on **Windows**).|
9494
| `-D DOWNLOAD_DATASETS=(OFF\|ON)` | `ON` | Download required datasets during build (only if they do not already exist in `pytorch-cpp/data`). |
9595
|`-D CREATE_SCRIPTMODULES=(OFF\|ON)` | `OFF` | Create all required scriptmodule files for prelearned models / weights during build. Requires installed python3 with pytorch and torchvision. |

cmake/fetch_libtorch.cmake

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
22

33
include(FetchContent)
44

5-
set(CUDA_V "none" CACHE STRING "Determines libtorch CUDA version to download (11.7, 11.8 or none).")
5+
set(CUDA_V "none" CACHE STRING "Determines libtorch CUDA version to download (11.8, 12.1 or none).")
66

77
if(${CUDA_V} STREQUAL "none")
88
set(LIBTORCH_DEVICE "cpu")
9-
elseif(${CUDA_V} STREQUAL "11.7")
10-
set(LIBTORCH_DEVICE "cu117")
119
elseif(${CUDA_V} STREQUAL "11.8")
1210
set(LIBTORCH_DEVICE "cu118")
11+
elseif(${CUDA_V} STREQUAL "12.1")
12+
set(LIBTORCH_DEVICE "cu121")
1313
else()
14-
message(FATAL_ERROR "Invalid CUDA version specified, must be 11.7, 11.8 or none!")
14+
message(FATAL_ERROR "Invalid CUDA version specified, must be 11.8, 12.1 or none!")
1515
endif()
1616

1717
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")

utils/image_io/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ target_include_directories(image-io PUBLIC include)
1616
target_link_libraries(image-io ${TORCH_LIBRARIES} stb-image stb-image-write stb-image-resize2)
1717

1818
set_target_properties(image-io PROPERTIES
19-
CXX_STANDARD 14
19+
CXX_STANDARD 17
2020
CXX_STANDARD_REQUIRED YES
2121
)

0 commit comments

Comments
 (0)