Skip to content
Open
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
32 changes: 32 additions & 0 deletions .github/workflows/dependencies/dependencies_flang.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
#
# Copyright 2020-2026 The AMReX Community
#
# License: BSD-3-Clause-LBNL

set -eu -o pipefail

# `man apt.conf`:
# Number of retries to perform. If this is non-zero APT will retry
# failed files the given number of times.
echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries

# Install a recent LLVM Flang (and the matching Clang) from apt.llvm.org.
# The desired LLVM major version is passed as the first argument.
if [[ ! -f /etc/apt/trusted.gpg.d/apt.llvm.org.asc ]]; then
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
fi

source /etc/os-release # set UBUNTU_CODENAME

sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME} main"
sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-$1 main"

sudo apt-get update

sudo apt-get install -y --no-install-recommends \
build-essential \
libfftw3-dev \
clang-$1 \
flang-$1 \
libomp-$1-dev
49 changes: 49 additions & 0 deletions .github/workflows/flang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: LinuxFlang

on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:

concurrency:
group: ${{ github.ref }}-${{ github.head_ref }}-linux-flang
cancel-in-progress: true

jobs:
check_changes:
uses: ./.github/workflows/check_changes.yml

# Build libamrex and its Fortran interfaces with LLVM Flang.
# This guards against LLVM-Flang-specific Fortran errors such as #5603.
library_flang:
name: Flang@20 DP NOMPI Fortran Interfaces [lib]
runs-on: ubuntu-24.04
needs: check_changes
if: needs.check_changes.outputs.has_non_docs_changes == 'true'
steps:
- uses: actions/checkout@v7
- name: Dependencies
run: .github/workflows/dependencies/dependencies_flang.sh 20
- name: Build & Install
run: |
# The apt.llvm.org packages ship the driver as either flang-<ver>
# or flang-new-<ver> depending on the LLVM release.
FLANG=$(which flang-20 || which flang-new-20)

mkdir build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_INSTALL_PREFIX=/tmp/my-amrex \
-DAMReX_EB=ON \
-DAMReX_FORTRAN=ON \
-DAMReX_FORTRAN_INTERFACES=ON \
-DAMReX_MPI=OFF \
-DCMAKE_C_COMPILER=$(which clang-20) \
-DCMAKE_CXX_COMPILER=$(which clang++-20) \
-DCMAKE_Fortran_COMPILER=${FLANG}
make -j 4
make install
make test_install