Initial support for PyTorch C++ API #230
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
Build: | |
name: LFortran CI (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "macos-latest"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment_unix.yml | |
- uses: hendrikmuhs/ccache-action@main | |
with: | |
variant: sccache | |
key: ${{ github.job }}-${{ matrix.os }} | |
- name: Build (Linux / macOS) | |
shell: bash -l {0} | |
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') | |
run: | | |
./build.sh | |
export PATH=$CONDA_PREFIX/bin:$PATH | |
- name: Print runtime library directory | |
shell: bash -l {0} | |
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') | |
run: | | |
lc --get-rtl-header-dir | |
lc --get-rtl-dir | |
# - name: Test (Linux / macOS) | |
# shell: bash -l -e {0} | |
# if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') | |
# run: | | |
# export CPATH=$CONDA_PREFIX/include:$CPATH | |
# git clone https://github.com/czgdp1807/mdspan | |
# cd mdspan | |
# cmake . -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX | |
# make install | |
# cd .. | |
# lc --show-clang-ast tests/test.cpp | |
# lc --show-clang-ast --parse-all-comments tests/parse_comments_01.cpp > parse_comments_01.stdout | |
# grep "TextComment" parse_comments_01.stdout | |
# rm parse_comments_01.stdout | |
# lc examples/expr2.c --show-asr | |
# ./run_tests.py | |
# - name: Test2 (Linux / macOS) | |
# shell: bash -l -e {0} | |
# if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') | |
# run: | | |
# which clang | |
# # Test generating object files | |
# lc examples/expr2.c --backend c -o c_o -c | |
# lc examples/expr2.c --backend llvm -o llvm_o -c | |
# ls -1 | |
# cd examples | |
# lc expr2.c | |
# - name: Test3 (Linux / macOS) | |
# shell: bash -l -e {0} | |
# if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') | |
# run: | | |
# export CPATH=$CONDA_PREFIX/include:$CPATH | |
# ./integration_tests/run_tests.py -b gcc llvm wasm c | |
# ./integration_tests/run_tests.py -b gcc llvm wasm c -f | |
- name: Test4 (macOS) | |
shell: bash -l -e {0} | |
if: contains(matrix.os, 'macos') | |
run: | | |
export CPATH=$CONDA_PREFIX/include:$CPATH | |
conda install --yes pytorch::pytorch | |
cp -r $CONDA_PREFIX/lib/python3.12/site-packages/torch/include/* $CONDA_PREFIX/include/ | |
cp -r $CONDA_PREFIX/lib/python3.12/site-packages/torch/lib/* $CONDA_PREFIX/lib/ | |
cp -r $CONDA_PREFIX/lib/python3.12/site-packages/torch/share/* $CONDA_PREFIX/share/ | |
./integration_tests/run_tests.py -b pytorch |