Skip to content

LibTorch Mac x86_64

LibTorch Mac x86_64 #4

name: LibTorch Mac x86_64
on:
workflow_dispatch:
inputs:
branch:
type: string
description: The name of the branch you want to build.
required: true
jobs:
build:
runs-on: ['macos-latest']
timeout-minutes: 120
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1
with:
cmake-version: "3.30.5"
- name: Clone
run: |
git clone -b ${{ github.event.inputs.branch }} --recurse-submodule https://github.com/pytorch/pytorch.git
- run: |
cd pytorch
pip install -r requirements.txt
- name: Build Libtorch
run: |
mkdir pytorch-build
cd pytorch-build
cmake \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DBUILD_PYTHON=OFF \
-DUSE_OPENMP=OFF \
-DUSE_KINETO=OFF \
-DUSE_CUDA=OFF \
-DUSE_XPU=OFF \
-DCMAKE_INSTALL_PREFIX:PATH=../libtorch \
-DUSE_MPS=OFF \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
../pytorch
cmake --build . --target install --parallel 8
- name: Create archive
run: |
zip -r libtorch-${{ github.event.inputs.branch }}.zip libtorch/
- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: libtorch-x86_64-${{ github.event.inputs.branch }}.zip
overwrite: true
file_glob: true
tag: LibTorch-for-R