Skip to content

Update LFortran to 0.43.0 #107

Update LFortran to 0.43.0

Update LFortran to 0.43.0 #107

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
env:
LFORTRAN_VERSION: 0.43.0
MACOSX_DEPLOYMENT_TARGET: 14.0
jobs:
Build:
name: Conda-Forge LFortran Test ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["windows-2019", "macos-latest", "ubuntu-latest"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
create-args: >-
lfortran=${{ env.LFORTRAN_VERSION }}
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}
- name: Print installed packages information
shell: bash -e -x -l {0}
run: |
which lfortran
micromamba env list
micromamba activate lf
micromamba list
which lfortran
- name: Clone LFortran Source Repository
shell: bash -e -x -l {0}
run: |
git clone https://github.com/lfortran/lfortran.git
cd lfortran
git fetch https://github.com/lfortran/lfortran.git --tags -f
git checkout v${{ env.LFORTRAN_VERSION }}
- name: Run LFortran Integration Tests
if: ${{ !startsWith(matrix.os, 'windows-2019') }}
shell: bash -e -x -l {0}
run: |
cd lfortran/integration_tests
./run_tests.py -b llvm wasm
- name: Run LFortran Fast Integration Tests
if: ${{ !startsWith(matrix.os, 'windows-2019') }}
shell: bash -e -x -l {0}
run: |
cd lfortran/integration_tests
./run_tests.py -b llvm wasm -f
- name: Run LFortran Reference Tests
if: ${{ !startsWith(matrix.os, 'windows-2019') }}
shell: bash -e -x -l {0}
run: |
cd lfortran
./run_tests.py --skip-run-with-dbg --no-llvm
third_party_code_compile:
name: Check Third Party Code Compilation ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "ubuntu-latest"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
create-args: >-
lfortran=${{ env.LFORTRAN_VERSION }}
python=3.10
openblas=0.3.21
llvm-openmp=14.0.4
fypp=3.2
- name: Remove GFortran (Linux)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
shell: bash -e -x -l {0}
run: |
sudo apt-get remove -y gfortran
- name: Print installed packages information
shell: bash -e -x -l {0}
run: |
which lfortran
micromamba env list
micromamba activate lf
micromamba list
which lfortran
lfortran --version
if [[ "$(which gfortran)" != "" ]]; then
echo "GFortran is installed and should not be."
exit 1
fi
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-ubuntu-latest
- name: Test Modern Minpack (Fortran-Lang)
shell: bash -e -x -l {0}
run: |
git clone https://github.com/fortran-lang/minpack modern_minpack_01
cd modern_minpack_01
git checkout c0b5aea9fcd2b83865af921a7a7e881904f8d3c2
lfortran ./src/minpack.f90 -c --legacy-array-sections
lfortran ./examples/example_hybrd.f90 --legacy-array-sections
lfortran ./examples/example_hybrd1.f90 --legacy-array-sections
lfortran ./examples/example_lmdif1.f90 --legacy-array-sections
lfortran ./examples/example_lmder1.f90 --legacy-array-sections
- name: Test dftatom
shell: bash -e -x -l {0}
run: |
git clone https://github.com/certik/dftatom.git
cd dftatom
git checkout b838e858e046a36dd2235713ba111199bcf718bd
make -f Makefile.manual F90=lfortran F90FLAGS="-I../../src"
make -f Makefile.manual test
git clean -dfx
make -f Makefile.manual F90="lfortran --skip-pass=inline_function_calls,fma --fast" F90FLAGS="-I../../src"
make -f Makefile.manual test
- name: Test fastGPT
shell: bash -e -x -l {0}
run: |
git clone https://github.com/certik/fastGPT.git
cd fastGPT
git clean -dfx
git checkout -t origin/namelist
git checkout d3eef520c1be8e2db98a3c2189740af1ae7c3e06
curl -o model.dat -L https://huggingface.co/datasets/certik/fastGPT/resolve/main/model_fastgpt_124M_v1.dat
mkdir lf
cd lf
FC=lfortran CMAKE_PREFIX_PATH=$CONDA_PREFIX cmake -DFASTGPT_BLAS=OpenBLAS -DCMAKE_BUILD_TYPE=Debug ..
make VERBOSE=1
ln -s ../model.dat .
./gpt2
./test_basic_input
./test_more_inputs
cd ..
- name: Test fastGPT --fast (Linux)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
shell: bash -e -x -l {0}
run: |
cd fastGPT
mkdir lf-fast
cd lf-fast
FC="lfortran --fast" CMAKE_PREFIX_PATH=$CONDA_PREFIX cmake -DFASTGPT_BLAS=OpenBLAS -DCMAKE_BUILD_TYPE=Release ..
make VERBOSE=1
ln -s ../model.dat .
./gpt2
./test_basic_input
./test_more_inputs
cd ..
- name: Test stdlib
shell: bash -e -x -l {0}
run: |
git clone https://github.com/czgdp1807/stdlib.git
cd stdlib
git checkout lf20
git checkout abb1d33d6ae02d8b62a13be7f9e51f6117c67ba4
FC=lfortran cmake . -DTEST_DRIVE_BUILD_TESTING=OFF -DBUILD_EXAMPLE=ON -DCMAKE_Fortran_COMPILER_WORKS=TRUE -DCMAKE_Fortran_FLAGS="--cpp --realloc-lhs"
make -j2
ctest
cd ..
- name: Test SNAP
shell: bash -e -x -l {0}
run: |
git clone https://github.com/certik/SNAP.git
cd SNAP
git checkout lf11
git checkout 169a9216f2c922e94065a519efbb0a6c8b55149e
cd ./src
make -j8 FORTRAN=lfortran FFLAGS= MPI=no OPENMP=no
./gsnap ../qasnap/sample/inp out
make clean
make -j8 FORTRAN=lfortran FFLAGS="--fast --skip-pass=promote_allocatable_to_nonallocatable" MPI=no OPENMP=no
./gsnap ../qasnap/sample/inp out
cd ../..
test_scipy:
name: Check SciPy Build and Test Run ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"] # test only on ubuntu for now
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: mamba-org/setup-micromamba@v1
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-ubuntu-latest
- name: Build SciPy
shell: bash -e -x -l {0}
run: |
git clone https://github.com/scipy/scipy
cd scipy
git remote add ondrej https://github.com/certik/scipy
git fetch ondrej
git checkout -t ondrej/merge_special_minpack_fitpack_02
git checkout a32e743e53550533d44a8f7c44a71132eca750bf
micromamba env create -f environment.yml
micromamba activate scipy-dev
micromamba install -c conda-forge lfortran=${{ env.LFORTRAN_VERSION }}
git submodule update --init
mkdir lfortran-build/
cd lfortran-build/
LIBRARY_PATH="$CONDA_PREFIX/share/lfortran/lib"
FC=lfortran cmake \
-DCMAKE_Fortran_FLAGS=--verbose \
-DLFORTRAN_RUNTIME_LIBRARY_PATH=$LIBRARY_PATH \
..
make install
cp $LIBRARY_PATH/liblfortran_runtime.* $CONDA_PREFIX/lib
cd ../
python dev.py build
- name: Test SciPy Special (Specfun, Amos, Mach and Cdflib)
shell: bash -e -x -l {0}
run: |
cd scipy/
micromamba activate scipy-dev
python dev.py test -t scipy.special -v
- name: Test SciPy Minpack
shell: bash -e -x -l {0}
run: |
cd scipy/
micromamba activate scipy-dev
python dev.py test -t scipy.optimize -v
- name: Test SciPy Fitpack
shell: bash -e -x -l {0}
run: |
cd scipy/
micromamba activate scipy-dev
python dev.py test -t scipy.interpolate -v
misc:
name: Misc Test ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "ubuntu-latest"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
create-args: >-
lfortran=${{ env.LFORTRAN_VERSION }}
llvmdev=11.1.0
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}
- name: Print installed packages information
shell: bash -e -x -l {0}
run: |
which lfortran
micromamba env list
micromamba activate lf
micromamba list
which lfortran
- name: Setup WASI SDK
if: ${{ startsWith(matrix.os, 'ubuntu') }}
shell: bash -e -l {0}
run: |
cd $HOME
curl -o wasi-sdk.tar.gz -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-21/wasi-sdk-21.0-linux.tar.gz
tar -xvf wasi-sdk.tar.gz
export WASI_SDK_PATH=$HOME/wasi-sdk-21.0
echo $WASI_SDK_PATH
$WASI_SDK_PATH/bin/clang --version
- name: Install wasmtime
if: ${{ startsWith(matrix.os, 'ubuntu') }}
shell: bash -e -l {0}
run: |
cd $HOME
curl -o wasmtime.tar.gz -L https://github.com/bytecodealliance/wasmtime/releases/download/v19.0.2/wasmtime-v19.0.2-x86_64-linux.tar.xz
tar -xvf wasmtime.tar.gz
export PATH=$HOME/wasmtime-v19.0.2-x86_64-linux:$PATH
wasmtime --version
- name: Setup EMSCRIPTEN SDK
if: ${{ startsWith(matrix.os, 'ubuntu') }}
shell: bash -e -l {0}
run: |
cd $HOME
curl -o emsdk.tar.gz -L https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.59.tar.gz
tar -xvf emsdk.tar.gz
export EMSDK_PATH=$HOME/emsdk-3.1.59
echo $EMSDK_PATH
cd $EMSDK_PATH
./emsdk install latest
./emsdk activate latest
- name: Clone LFortran Source Repository
shell: bash -e -x -l {0}
run: |
git clone https://github.com/lfortran/lfortran.git
cd lfortran
git fetch https://github.com/lfortran/lfortran.git --tags -f
git checkout v${{ env.LFORTRAN_VERSION }}
- name: Run LFortran Misc Tests
if: ${{ !startsWith(matrix.os, 'windows-2019') }}
shell: bash -e -x -l {0}
run: |
cd lfortran
./run_tests.py --skip-run-with-dbg --no-llvm
- name: Run LFortran WASM Tests
if: ${{ startsWith(matrix.os, 'ubuntu') }}
shell: bash -e -x -l {0}
run: |
cd lfortran
export WASI_SDK_PATH=$HOME/wasi-sdk-21.0
export EMSDK_PATH=$HOME/emsdk-3.1.59
export PATH=$HOME/wasmtime-v19.0.2-x86_64-linux:$PATH
export WASMTIME_NEW_CLI=0
cd integration_tests
# llvm_wasm requires lfortran_runtime_wasm_wasi.o which is
# currently missing
./run_tests.py -b llvm_wasm_emcc