Skip to content

Update LFortran to 0.59.0 #202

Update LFortran to 0.59.0

Update LFortran to 0.59.0 #202

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
env:
LFORTRAN_VERSION: 0.59.0
MACOSX_DEPLOYMENT_TARGET: 15.0
jobs:
Build:
name: Conda-Forge LFortran Test ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["windows-2025", "macos-latest", "ubuntu-latest"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: mamba-org/setup-micromamba@v2.0.2
with:
micromamba-version: '2.0.4-0'
environment-file: environment.yml
create-args: >-
lfortran=${{ env.LFORTRAN_VERSION }}
nodejs=18.12.1
- 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-') }}
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-') }}
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-') }}
shell: bash -e -x -l {0}
run: |
cd lfortran
./run_tests.py --skip-run-with-dbg --no-llvm
- name: Run LFortran LSP Tests
if: ${{ !startsWith(matrix.os, 'windows-') }}
shell: bash -e -x -l {0}
run: |
cd lfortran
pip install src/server/tests tests/server/
pytest tests/server
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@v2.0.2
with:
micromamba-version: '2.0.4-0'
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
openmpi=5.0.6
- 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 9b678177f67e350b8a32e08cb61f51e6e708e87a
make -f Makefile.manual F90=lfortran F90FLAGS="-I../../src"
make -f Makefile.manual quicktest
git clean -dfx
make -f Makefile.manual F90="lfortran --skip-pass=inline_function_calls,fma --fast" F90FLAGS="-I../../src"
make -f Makefile.manual quicktest
- 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 --realloc-lhs-arrays" 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 ..
mkdir lf-fast
cd lf-fast
FC="lfortran --fast --realloc-lhs-arrays" 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-arrays"
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 ../..
- name: Test POT3D
if: ${{ startsWith(matrix.os, 'ubuntu') }}
shell: bash -e -l {0}
run: |
git clone https://github.com/parth121101/pot3d.git
cd pot3d
git checkout -t origin/lf_hdf5_fortranMPI_namelist_global_workarounds
git checkout 380669edd3a5947985674a51e0d65482d6fe68b3
git clone https://github.com/lfortran/fortran_mpi
cd fortran_mpi
git checkout 31033d3c8af32c4c99fac803c161e6731bc39a78
cp src/mpi.f90 ../src/
cp src/mpi_c_bindings.f90 ../src/
cp src/mpi_constants.c ../src/
cd ..
FC="lfortran --cpp -DOPEN_MPI=yes" ./build_and_run_lfortran.sh
FC="lfortran --cpp --fast --skip-pass=dead_code_removal -DOPEN_MPI=yes" ./build_and_run_lfortran.sh
FC="lfortran --cpp --separate-compilation -DOPEN_MPI=yes" ./build_and_run_lfortran.sh
cd ..
- name: Test PRIMA
shell: bash -e -l {0}
run: |
git clone https://github.com/Pranavchiku/prima.git
cd prima
git checkout -t origin/lf-prima-12
git checkout e681eea9b3f27930c50cffd14dd566b39f01c642
git clean -dfx
if [[ "${{matrix.os}}" == "macos-latest" ]]; then
export LFORTRAN_RUNNER_OS='macos';
fi
if [[ "${{matrix.os}}" == "ubuntu-latest" ]]; then
export LFORTRAN_RUNNER_OS='linux';
fi
FC="lfortran --cpp" cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$(pwd)/install -DCMAKE_Fortran_FLAGS="" -DCMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS="" -DCMAKE_MACOSX_RPATH=OFF -DCMAKE_SKIP_INSTALL_RPATH=ON -DCMAKE_SKIP_RPATH=ON && cmake --build build --target install
./build/fortran/example_bobyqa_fortran_1_exe
./build/fortran/example_bobyqa_fortran_2_exe
./build/fortran/example_cobyla_fortran_1_exe
./build/fortran/example_cobyla_fortran_2_exe
./build/fortran/example_lincoa_fortran_1_exe
./build/fortran/example_lincoa_fortran_2_exe
./build/fortran/example_newuoa_fortran_1_exe
./build/fortran/example_newuoa_fortran_2_exe
./build/fortran/example_uobyqa_fortran_1_exe
./build/fortran/example_uobyqa_fortran_2_exe
if [[ "${{matrix.os}}" == "macos-latest" ]]; then
cd fortran/
test_name=test_bobyqa.f90 FC="lfortran" ./script.sh
test_name=test_newuoa.f90 FC="lfortran" ./script.sh
test_name=test_uobyqa.f90 FC="lfortran" ./script.sh
test_name=test_cobyla.f90 FC="lfortran" ./script.sh
test_name=test_lincoa.f90 FC="lfortran" ./script.sh
cd ../
fi
if [[ "${{matrix.os}}" == "ubuntu-latest" ]]; then
cd fortran/
test_name=test_uobyqa.f90 FC="lfortran" ./script.sh
cd ../
fi
git clean -dfx
FC="lfortran --cpp --fast" cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$(pwd)/install -DCMAKE_Fortran_FLAGS="" -DCMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS="" -DCMAKE_MACOSX_RPATH=OFF -DCMAKE_SKIP_INSTALL_RPATH=ON -DCMAKE_SKIP_RPATH=ON && cmake --build build --target install
./build/fortran/example_bobyqa_fortran_1_exe
./build/fortran/example_newuoa_fortran_1_exe
./build/fortran/example_newuoa_fortran_2_exe
./build/fortran/example_bobyqa_fortran_2_exe
./build/fortran/example_uobyqa_fortran_1_exe
./build/fortran/example_uobyqa_fortran_2_exe
./build/fortran/example_cobyla_fortran_1_exe
./build/fortran/example_lincoa_fortran_1_exe
./build/fortran/example_lincoa_fortran_2_exe
./build/fortran/example_cobyla_fortran_2_exe
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@v2.0.2
with:
micromamba-version: '2.0.4-0'
- 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 de851b31c795d41ce9e1fdead3dac7afff173156
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@v2.0.2
with:
micromamba-version: '2.0.4-0'
environment-file: environment.yml
create-args: >-
lfortran=${{ env.LFORTRAN_VERSION }}
llvmdev=11.1.0
nodejs=18.12.1
- 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-') }}
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