Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: test dftatom with LFortran #48

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,68 @@ jobs:
./tests/atom_U/F_atom_U
ctest -E "conv_lda|conv_rlda|fd|rmin_conv|N_conv"


build_lfortran:
name: LFortran build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Uninstall gfortran
run: |
set -ex
sudo apt-get purge gfortran

- uses: mamba-org/setup-micromamba@v1
with:
environment-name: lf
create-args: >-
lfortran=0.27.0

- name: Print installed packages information
shell: bash -l {0}
run: |
set -ex
! which lfortran
micromamba env list
micromamba activate lf
micromamba list
which lfortran

- name: Build dftatom manual
shell: bash -l {0}
run: |
set -ex
make -f Makefile.manual F90=lfortran F90FLAGS="-I../../src"
./tests/atom_U/F_atom_U
#make -f Makefile.manual test
git clean -dfx
make -f Makefile.manual F90="lfortran --skip-pass=inline_function_calls,fma --fast" F90FLAGS="-I../../src"
./tests/atom_U/F_atom_U
#make -f Makefile.manual test
git clean -dfx

- name: Build dftatom cmake
shell: bash -l {0}
run: |
set -ex
cmake -DCMAKE_BUILD_TYPE=Debug .
make
ctest -E "conv_lda|conv_rlda"
git clean -dfx
cmake -DCMAKE_BUILD_TYPE=Release .
make
ctest -E "conv_lda|conv_rlda"


build_python:
name: Python build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install packages
run: |
set -ex
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ enable_language(Fortran)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/mod_files)

# Until CMake supports LFortran natively, we recognize it by hand and set the
# native CMAKE_Fortran_COMPILER_ID variable.
string(REGEX MATCH "lfortran" fortran_compiler_suffix ${CMAKE_Fortran_COMPILER})
if(fortran_compiler_suffix STREQUAL lfortran)
set(CMAKE_Fortran_COMPILER_ID "LFortran")
set(CMAKE_Fortran_FLAGS_RELEASE "--fast --skip-pass=inline_function_calls,fma")
endif()

# Make sure that CMAKE_BUILD_TYPE is either Debug or Release:
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release
Expand Down
5 changes: 5 additions & 0 deletions tests/well/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ project(well)
set(SRC
special.f90 optimize.f90
)

if (CMAKE_Fortran_COMPILER_ID STREQUAL "LFortran")
add_definitions("--implicit-typing")
endif()

add_library(well ${SRC})
add_dependencies(well dftatom)

Expand Down
Loading