Skip to content

Commit a85c3e7

Browse files
committed
Upgrade PyTorch version to 2.6.0, Add CUDA 12.6 Support and Update GA Workflows
1 parent 511775f commit a85c3e7

File tree

39 files changed

+114
-262
lines changed

39 files changed

+114
-262
lines changed

.github/workflows/build_macos.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ on:
1818

1919
jobs:
2020
build-mac:
21-
name: "macOS 14.4.1 arm64 Xcode (Clang)"
21+
name: "macOS 14 arm64 Xcode (Clang)"
2222
runs-on: macos-14
2323
strategy:
2424
matrix:
25-
xcode: [14.3.1, 15.3]
25+
xcode: [15.3, 16.1]
2626
steps:
2727
- name: Checkout
2828
uses: actions/checkout@v4
2929
- name: Set up CMake
3030
uses: jwlawson/actions-setup-cmake@v2
3131
with:
32-
cmake-version: '3.19.0'
32+
cmake-version: '3.28.6'
3333
- name: Set up Xcode
3434
uses: maxim-lobanov/setup-xcode@v1
3535
with:

.github/workflows/build_ubuntu.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ on:
1818

1919
jobs:
2020
build-ubuntu:
21-
name: "Ubuntu 22.04 GCC"
22-
runs-on: ubuntu-22.04
21+
name: "Ubuntu 24.04 GCC"
22+
runs-on: ubuntu-24.04
2323
strategy:
2424
matrix:
25-
gcc: [11, 12, 13]
25+
gcc: [13, 14]
2626
steps:
2727
- name: Checkout
2828
uses: actions/checkout@v4
2929
- name: Set up CMake
3030
uses: jwlawson/actions-setup-cmake@v2
3131
with:
32-
cmake-version: '3.19.0'
32+
cmake-version: '3.28.6'
3333
- name: Set up GCC
3434
uses: egor-tensin/setup-gcc@v1
3535
with:

.github/workflows/build_windows.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ jobs:
2323
strategy:
2424
matrix:
2525
config:
26-
- {
27-
name: Windows MSVC 2019,
28-
os: windows-2019,
29-
cmake: '3.19.0'
30-
}
3126
- {
3227
name: Windows MSVC 2022,
3328
os: windows-2022,
34-
cmake: '3.24.2'
29+
cmake: '3.28.6'
30+
}
31+
- {
32+
name: Windows MSVC 2025,
33+
os: windows-2025,
34+
cmake: '3.28.6'
3535
}
3636
steps:
3737
- name: Checkout

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
project(pytorch-cpp VERSION 1.0.0 LANGUAGES CXX)
44

@@ -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.3.0")
10+
set(PYTORCH_VERSION "2.6.0")
1111
set(PYTORCH_MIN_VERSION "1.12.0")
1212

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

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ 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.3.0
34+
ARG PYTORCH_VERSION=2.6.0
3535
ARG TORCHVISION_VERSION=0.18.0
3636
ENV NO_CUDA=1
3737
RUN conda install pytorch==${PYTORCH_VERSION} torchvision==${TORCHVISION_VERSION} cpuonly -y -c pytorch && conda clean -ya

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
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.3.0-ee4c2c">
9-
<img src="https://img.shields.io/badge/cmake-3.19-064f8d">
8+
<img src="https://img.shields.io/badge/libtorch-2.6.0-ee4c2c">
9+
<img src="https://img.shields.io/badge/cmake-3.28.6-064f8d">
1010
</p>
1111

1212

13-
| OS (Compiler)\\LibTorch | 2.3.0 |
13+
| OS (Compiler)\\LibTorch | 2.6.0 |
1414
| :--------------------- | :--------------------------------------------------------------------------------------------------- |
15-
| 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) |
16-
| 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) |
17-
| Windows (msvc 2019, 2022) | [![Status](https://github.com/prabhuomkar/pytorch-cpp/actions/workflows/build_windows.yml/badge.svg?branch=master)](https://github.com/prabhuomkar/pytorch-cpp/actions?query=workflow%3Aci-build-windows) |
15+
| macOS (clang 15, 16) | [![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) |
16+
| Linux (gcc 13, 14) | [![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) |
17+
| Windows (msvc 2022, 2025) | [![Status](https://github.com/prabhuomkar/pytorch-cpp/actions/workflows/build_windows.yml/badge.svg?branch=master)](https://github.com/prabhuomkar/pytorch-cpp/actions?query=workflow%3Aci-build-windows) |
1818

1919
## Table of Contents
2020

@@ -51,8 +51,8 @@ This repository provides tutorial code in C++ for deep learning researchers to l
5151
## Requirements
5252

5353
1. [C++-17](http://www.cplusplus.com/doc/tutorial/introduction/) compatible compiler
54-
2. [CMake](https://cmake.org/download/) (minimum version 3.19)
55-
3. [LibTorch version >= 1.12.0 and <= 2.3.0](https://pytorch.org/cppdocs/installing.html)
54+
2. [CMake](https://cmake.org/download/) (minimum version 3.28.6)
55+
3. [LibTorch version >= 1.12.0 and <= 2.6.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=(11.8\|12.1\|none)` | `none` | Download LibTorch for a CUDA version (`none` = download CPU version). |
92+
| `-D CUDA_V=(11.8\|12.1\|12.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. |

cmake/check_files.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
function(check_files BASE_DIR FILES_TO_CHECK FILE_MD5S MISSING_FILES)
44
foreach(FILE_TO_CHECK ${${FILES_TO_CHECK}})

cmake/copy_torch_dlls.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
function(copy_torch_dlls TARGET_NAME)
44
# According to https://github.com/pytorch/pytorch/issues/25457

cmake/cpplint.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
find_program(CPPLINT cpplint)
44

cmake/create_torch_dll_hardlinks.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
file(GLOB TORCH_DLLS "${TORCH_INSTALL_PREFIX}/lib/*.dll")
44

cmake/fetch_cifar10.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
function(fetch_cifar10 DATA_DIR)
44
set(CIFAR_DIR "${DATA_DIR}/cifar10")

cmake/fetch_datasets.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
include(${CMAKE_CURRENT_LIST_DIR}/fetch_mnist.cmake)
44
include(${CMAKE_CURRENT_LIST_DIR}/fetch_cifar10.cmake)

cmake/fetch_flickr8k.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
function(fetch_flickr8k DATA_DIR)
44
set(FLICKR8K_DIR "${DATA_DIR}/flickr_8k")

cmake/fetch_imagenette.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
function(fetch_imagenette DATA_DIR)
44
set(IMAGENETTE_DIR "${DATA_DIR}/imagenette2-160")

cmake/fetch_libtorch.cmake

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
include(FetchContent)
44

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

77
if(${CUDA_V} STREQUAL "none")
88
set(LIBTORCH_DEVICE "cpu")
99
elseif(${CUDA_V} STREQUAL "11.8")
1010
set(LIBTORCH_DEVICE "cu118")
1111
elseif(${CUDA_V} STREQUAL "12.1")
1212
set(LIBTORCH_DEVICE "cu121")
13+
elseif(${CUDA_V} STREQUAL "12.6")
14+
set(LIBTORCH_DEVICE "cu126")
1315
else()
14-
message(FATAL_ERROR "Invalid CUDA version specified, must be 11.8, 12.1 or none!")
16+
message(FATAL_ERROR "Invalid CUDA version specified, must be 11.8, 12.1, 12.6 or none!")
1517
endif()
1618

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

cmake/fetch_mnist.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
function(fetch_mnist DATA_DIR)
44
set(MNIST_DOWNLOAD_DIR "${DATA_DIR}/mnist/download")

cmake/fetch_neural_style_transfer_images.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
function(fetch_neural_style_transfer_imagers DATA_DIR)
44
set(NEURAL_STYLE_TRANSFER_IMAGES_DIR

cmake/fetch_penntreebank.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
function(fetch_penntreebank DATA_DIR)
44
set(PENNTREEBANK_DIR "${DATA_DIR}/penntreebank")

cmake/find_gz_extractor.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
# Find program that can extract .gz files.
44
# Based on: https://github.com/Amber-MD/cmake-buildscripts/blob/master/gzip.cmake

extern/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.28.6 FATAL_ERROR)
22

33
project(extern VERSION 1.0.0 LANGUAGES CXX)
44

0 commit comments

Comments
 (0)