Skip to content

Commit fb11630

Browse files
authored
Upgrade to libtorch v1.12.0. (#98)
1 parent d0fb49b commit fb11630

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
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 "1.10.1")
10+
set(PYTORCH_VERSION "1.12.0")
1111

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

Dockerfile

Lines changed: 2 additions & 2 deletions
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=1.10.1
35-
ARG TORCHVISION_VERSION=0.11.2
34+
ARG PYTORCH_VERSION=1.12.0
35+
ARG TORCHVISION_VERSION=0.13.0
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

Lines changed: 6 additions & 6 deletions
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-1.10.1-ee4c2c">
8+
<img src="https://img.shields.io/badge/libtorch-1.12.0-ee4c2c">
99
<img src="https://img.shields.io/badge/cmake-3.14-064f8d">
1010
</p>
1111

1212

13-
| OS (Compiler)\\LibTorch | 1.10.1 |
13+
| OS (Compiler)\\LibTorch | 1.12.0 |
1414
| :--------------------- | :--------------------------------------------------------------------------------------------------- |
1515
| macOS (clang 11.0, 12.0) | [![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 8, 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 v1.10.1](https://pytorch.org/cppdocs/installing.html)
55+
3. [LibTorch v1.12.0](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=(10.2\|11.1\|11.3\|none)` | `none` | Download LibTorch for a CUDA version (`none` = download CPU version). |
92+
| `-D CUDA_V=(11.3\|11.6\|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. |
@@ -116,14 +116,14 @@ cmake -B build \
116116
<summary><b>Example Windows</b></summary>
117117

118118
##### Aim
119-
* Automatically download LibTorch for CUDA 11.3 (Release version) and all necessary datasets.
119+
* Automatically download LibTorch for CUDA 11.6 (Release version) and all necessary datasets.
120120
* Do not create scriptmodule files.
121121

122122
##### Command
123123
```bash
124124
cmake -B build \
125125
-A x64 \
126-
-D CUDA_V=11.3
126+
-D CUDA_V=11.6
127127
```
128128
</details>
129129

cmake/fetch_libtorch.cmake

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +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 (10.2, 11.1, 11.3 or none).")
5+
set(CUDA_V "none" CACHE STRING "Determines libtorch CUDA version to download (11.3, 11.6 or none).")
66

77
if(${CUDA_V} STREQUAL "none")
88
set(LIBTORCH_DEVICE "cpu")
9-
elseif(${CUDA_V} STREQUAL "10.2")
10-
set(LIBTORCH_DEVICE "cu102")
11-
elseif(${CUDA_V} STREQUAL "11.1")
12-
set(LIBTORCH_DEVICE "cu111")
139
elseif(${CUDA_V} STREQUAL "11.3")
1410
set(LIBTORCH_DEVICE "cu113")
11+
elseif(${CUDA_V} STREQUAL "11.6")
12+
set(LIBTORCH_DEVICE "cu116")
1513
else()
16-
message(FATAL_ERROR "Invalid CUDA version specified, must be 10.2, 11.1, 11.3 or none!")
14+
message(FATAL_ERROR "Invalid CUDA version specified, must be 11.3, 11.6 or none!")
1715
endif()
1816

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

0 commit comments

Comments
 (0)