Skip to content

Test Flang in AMD AOMP and AOCC #25

Test Flang in AMD AOMP and AOCC

Test Flang in AMD AOMP and AOCC #25

Workflow file for this run

name: Test Flang in AMD AOMP and AOCC
on:
# Trigger the workflow on push or pull request
#push:
pull_request:
# Trigger the workflow by cron. The default time zone of GitHub Actions is UTC.
schedule:
- cron: '0 4 1-31/4 * *'
# Trigger the workflow manually
workflow_dispatch:
inputs:
git-ref:
description: Git Ref (Optional)
required: false
# Show the git ref in the workflow name if it is invoked manually.
run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0}', inputs.git-ref) || '' }}
jobs:
test:
name: Run AOMP and AOCC Flang tests
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa]
fflags: [-O1, -O2, -O3, -g, -fast]
testdim: [small, big]
steps:
- name: Run `sudo apt update`
run: sudo apt update || true # Otherwise, free-disk-space or other actions relying on `apt` may fail
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
# all of these default to true, but feel free to set to "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: false # Important, or the runner may be shut down due to memory starvation.
- name: Clone Repository (Latest)
uses: actions/checkout@v6.0.2
if: github.event.inputs.git-ref == ''
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS
submodules: recursive
- name: Clone Repository (Custom Ref)
uses: actions/checkout@v6.0.2
if: github.event.inputs.git-ref != ''
with:
ref: ${{ github.event.inputs.git-ref }}
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS
submodules: recursive
- name: Lint the actions
if: runner.os == 'Linux'
uses: devops-actions/actionlint@v0.1.10
with:
shellcheck_opts: '-e SC1090 -e SC2015 -e SC2016 -e SC2028 -e SC2035 -e SC2046 -e SC2086 -e SC2155 -e SC2193'
- name: Miscellaneous setup
run: bash .github/scripts/misc_setup
- name: Install AOMP
run: |
# Retry in case of failure due to transient network issues. If it fails and the date is
# not divisible by 3, then we keep going and skip the AOMP test. This is to decrease the
# chance of workflow failure due to transient network issues, while still testing AOMP regularly.
bash .github/scripts/install_aomp 8 1800 || [[ $(( $(date +%-d) % 3 )) -ne 0 ]]
type amdflang || echo "WARNING!!! amdflang does not work after AOMP installation, which probably failed!!!" 2>&1
- name: Install AOCC
run: bash .github/scripts/install_aocc
- name: Revise bign
run: |
cd fortran/tests
$SEDI 's|::\s*bign\s*=.*$|:: bign = 200_IK|' test_newuoa.f90
$SEDI 's|::\s*bign\s*=.*$|:: bign = 180_IK|' test_bobyqa.f90
$SEDI 's|::\s*bign\s*=.*$|:: bign = 200_IK|' test_lincoa.f90
- name: Revise getact.f90 to see why assertions fail
run: |
cd fortran/lincoa
$SEDI "s|call assert(inprod(psd, psd) <=|write(*,*) '====> psd = ', psd, 'g = ', g, 'psd*g = ', inprod(psd, g), 'psd^2 = ', inprod(psd, psd), 'gg = ', gg\ncall assert(inprod(psd, psd) <=|" getact.f90
cat getact.f90
- name: Conduct the test
run: |
export FFLAGS=${{ matrix.fflags }}
export TESTDIM=${{ matrix.testdim }}
IK=i$(( 2**(1 + $(date +%-d) % 3) ))
echo "IK=${IK}"
echo "IK=${IK}" >> "$GITHUB_ENV"
if type amdflang ; then
cd "$ROOT_DIR"/fortran/tests && make mtest_${IK}.${{ matrix.solver }}
cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }}
export EXAMPLE_NUM=1 && make clean && make mtest
export EXAMPLE_NUM=2 && make clean && make mtest
else
echo "WARNING!!! amdflang does not work after AOMP installation, which probably failed!!!" 2>&1
echo "WARNING!!! mtest is skipped because amdflang is not available!!!" 2>& 1
fi
cd "$ROOT_DIR"/fortran/tests && make dtest_${IK}.${{ matrix.solver }}
cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }}
export EXAMPLE_NUM=1 && make clean && make dtest
export EXAMPLE_NUM=2 && make clean && make dtest
- name: Store artifacts
uses: actions/upload-artifact@v6
if: always() # Always run even if the workflow is canceled manually or due to overtime.
with:
name: ${{ matrix.solver }}-${{ env.IK }}-${{ matrix.fflags }}-${{ matrix.testdim }}
path: ${{ env.TEST_DIR }}/prima/fortran/tests/test.${{ matrix.solver }}/log/*.log
- name: Remove the test data
if: always() # Always run even if the workflow is canceled manually or due to overtime.
run: rm -rf ${{ env.TEST_DIR }}
# The following job check whether the tests were successful or cancelled due to timeout.
# N.B.: Remember to specify `continue-on-error: true` for the job of the tests.
check_success_timeout:
runs-on: ubuntu-latest
if: ${{ !cancelled() }}
needs: test
steps:
- name: Clone the GitHub actions scripts
uses: actions/checkout@v6.0.2
with:
repository: equipez/github_actions_scripts
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS
path: scripts
- name: Check whether the tests were successful or cancelled due to timeout
run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }}