Skip to content

Commit

Permalink
* Upgrade presets for PyTorch 2.2.1 (pull #1466)
Browse files Browse the repository at this point in the history
  • Loading branch information
HGuillemet committed Mar 3, 2024
1 parent 5ad9ea5 commit 575a44e
Show file tree
Hide file tree
Showing 1,477 changed files with 7,646 additions and 5,903 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

* Upgrade presets for PyTorch 2.2.1 ([pull #1466](https://github.com/bytedeco/javacpp-presets/pull/1466))

### January 29, 2024 version 1.5.10
* Introduce `macosx-arm64` builds for PyTorch ([pull #1463](https://github.com/bytedeco/javacpp-presets/pull/1463))
* Reenable `linux-arm64` builds for CPython and NumPy ([pull #1386](https://github.com/bytedeco/javacpp-presets/pull/1386))
Expand Down
2 changes: 1 addition & 1 deletion platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>pytorch-platform</artifactId>
<version>2.1.2-${project.version}</version>
<version>2.2.1-${project.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
Expand Down
12 changes: 6 additions & 6 deletions pytorch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Introduction
------------
This directory contains the JavaCPP Presets module for:

* PyTorch 2.1.2 https://pytorch.org/
* PyTorch 2.2.1 https://pytorch.org/

Please refer to the parent README.md file for more detailed information about the JavaCPP Presets.

Expand Down Expand Up @@ -40,36 +40,36 @@ We can use [Maven 3](http://maven.apache.org/) to download and install automatic
<modelVersion>4.0.0</modelVersion>
<groupId>org.bytedeco.pytorch</groupId>
<artifactId>simplemnist</artifactId>
<version>1.5.10</version>
<version>1.5.11-SNAPSHOT</version>
<properties>
<exec.mainClass>SimpleMNIST</exec.mainClass>
</properties>
<dependencies>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>pytorch-platform</artifactId>
<version>2.1.2-1.5.10</version>
<version>2.2.1-1.5.11-SNAPSHOT</version>
</dependency>

<!-- Additional dependencies required to use CUDA, cuDNN, and NCCL -->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>pytorch-platform-gpu</artifactId>
<version>2.1.2-1.5.10</version>
<version>2.2.1-1.5.11-SNAPSHOT</version>
</dependency>

<!-- Additional dependencies to use bundled CUDA, cuDNN, and NCCL -->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>cuda-platform-redist</artifactId>
<version>12.3-8.9-1.5.10</version>
<version>12.3-8.9-1.5.11-SNAPSHOT</version>
</dependency>

<!-- Additional dependencies to use bundled full version of MKL -->
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>mkl-platform-redist</artifactId>
<version>2024.0-1.5.10</version>
<version>2024.0-1.5.11-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
Expand Down
22 changes: 5 additions & 17 deletions pytorch/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if [[ $PLATFORM == windows* ]]; then
export PYTHON_BIN_PATH=$(which python.exe)
fi

PYTORCH_VERSION=2.1.2
PYTORCH_VERSION=2.2.1

export PYTORCH_BUILD_VERSION="$PYTORCH_VERSION"
export PYTORCH_BUILD_NUMBER=1
Expand All @@ -53,8 +53,9 @@ git checkout v$PYTORCH_VERSION
git submodule update --init --recursive
git submodule foreach --recursive 'git reset --hard'

# https://github.com/pytorch/pytorch/pull/66219
#patch -Np1 < ../../../pytorch.patch
# Fix version of this submodule to allow compilation on windows.
# Probably could be removed when we upgrade to next version of PyTorch.
(cd third_party/pocketfft; git checkout 9d3ab05a7fffbc71a492bc6a17be034e83e8f0fe)

CPYTHON_HOST_PATH="$INSTALL_PATH/../../../cpython/cppbuild/$PLATFORM/host/"
CPYTHON_PATH="$INSTALL_PATH/../../../cpython/cppbuild/$PLATFORM/"
Expand Down Expand Up @@ -165,24 +166,11 @@ sedinplace 's/ build_deps()/ build_deps(); sys.exit()/g' setup.py
sedinplace 's/AND NOT DEFINED ENV{CUDAHOSTCXX}//g' cmake/public/cuda.cmake
sedinplace 's/CMAKE_CUDA_FLAGS "/CMAKE_CUDA_FLAGS " --use-local-env /g' CMakeLists.txt

# work around some compiler bugs
sedinplace 's/!defined(__INTEL_COMPILER))/!defined(__INTEL_COMPILER) \&\& (__GNUC__ < 11))/g' third_party/XNNPACK/src/xnnpack/intrinsics-polyfill.h
sedinplace 's/using ExpandingArrayDouble/public: using ExpandingArrayDouble/g' ./torch/csrc/api/include/torch/nn/options/pooling.h
sedinplace 's/typedef c10::variant/public: typedef c10::variant/g' ./torch/csrc/api/include/torch/nn/options/upsampling.h
sedinplace 's/std::copysign/copysignf/g' aten/src/ATen/native/cuda/*.cu
sedinplace 's/std::trunc/truncf/g' aten/src/ATen/native/cuda/*.cu
sedinplace 's/std::floor/floorf/g' aten/src/ATen/native/cuda/*.cu
sedinplace 's/std::ceil/ceilf/g' aten/src/ATen/native/cuda/*.cu
sedinplace 's/round(/roundf(/g' aten/src/ATen/native/cuda/*.cu
sedinplace 's/floor(/floorf(/g' aten/src/ATen/native/cuda/*.cu
sedinplace 's/ceil(/ceilf(/g' aten/src/ATen/native/cuda/*.cu
sedinplace '/#include <thrust\/device_vector.h>/a\
#include <thrust\/host_vector.h>\
' caffe2/utils/math_gpu.cu

# allow setting the build directory and passing CUDA options
sedinplace "s/BUILD_DIR = .build./BUILD_DIR = os.environ['BUILD_DIR'] if 'BUILD_DIR' in os.environ else 'build'/g" tools/setup_helpers/env.py
sedinplace "s/var.startswith(('BUILD_', 'USE_', 'CMAKE_'))/var.startswith(('BUILD_', 'USE_', 'CMAKE_', 'CUDA_'))/g" tools/setup_helpers/cmake.py
sedinplace 's/var.startswith(("BUILD_", "USE_", "CMAKE_"))/var.startswith(("BUILD_", "USE_", "CMAKE_", "CUDA_"))/g' tools/setup_helpers/cmake.py

# allow resizing std::vector<at::indexing::TensorIndex>
sedinplace 's/TensorIndex(c10::nullopt_t)/TensorIndex(c10::nullopt_t none = None)/g' aten/src/ATen/TensorIndexing.h
Expand Down
4 changes: 4 additions & 0 deletions pytorch/include_list.pl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ sub go {

chdir "cppbuild/linux-x86_64-gpu/pytorch/torch/include";

# Doesn't compile on Windows. Waiting for 2.2.1.
#go('torch/csrc/api/include/torch/torch.h', 'torch/script.h', 'torch/csrc/inductor/aoti_model_container_runner.h');
go('torch/csrc/api/include/torch/torch.h', 'torch/script.h');

print <<EOF;
Expand All @@ -62,4 +64,6 @@ sub go {
// c10/cuda/CUDAGuard.h
EOF

# Doesn't compile on Windows. Waiting for 2.2.1.
#go('ATen/cudnn/Descriptors.h', 'ATen/cudnn/Types.h', 'c10/cuda/CUDAGuard.h', '-I/opt/cuda/targets/x86_64-linux/include/', 'torch/csrc/inductor/aoti_model_container_runner_cuda.h');
go('ATen/cudnn/Descriptors.h', 'ATen/cudnn/Types.h', 'c10/cuda/CUDAGuard.h', '-I/opt/cuda/targets/x86_64-linux/include/');
2 changes: 1 addition & 1 deletion pytorch/platform/gpu/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>org.bytedeco</groupId>
<artifactId>pytorch-platform-gpu</artifactId>
<version>2.1.2-${project.parent.version}</version>
<version>2.2.1-${project.parent.version}</version>
<name>JavaCPP Presets Platform GPU for PyTorch</name>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion pytorch/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>org.bytedeco</groupId>
<artifactId>pytorch-platform</artifactId>
<version>2.1.2-${project.parent.version}</version>
<version>2.2.1-${project.parent.version}</version>
<name>JavaCPP Presets Platform for PyTorch</name>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion pytorch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>org.bytedeco</groupId>
<artifactId>pytorch</artifactId>
<version>2.1.2-${project.parent.version}</version>
<version>2.2.1-${project.parent.version}</version>
<name>JavaCPP Presets for PyTorch</name>

<dependencies>
Expand Down
Loading

0 comments on commit 575a44e

Please sign in to comment.