forked from libprima/prima
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (107 loc) · 5.12 KB
/
test_ifort.yml
File metadata and controls
125 lines (107 loc) · 5.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Test ifort
on:
# Trigger the workflow on push or pull request
#push:
pull_request: # DANGEROUS! MUST be disabled for self-hosted runners!
# Trigger the workflow by cron. The default time zone of GitHub Actions is UTC.
schedule:
- cron: '0 18 1-31/2 * *'
# 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 ifort tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Windows does not work. On Windows, the options for ifort/ifx starts with "/" instead of "-".
# The latest oneAPI on Linux does not contain ifort anymore.
os: [macos-15-intel]
solver: [newuoa, cobyla, lincoa, bobyqa, uobyqa]
testdim: [small, big]
steps:
- name: Run `sudo apt update`
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt update || true # Otherwise, free-disk-space or other actions relying on `apt` may fail
- name: Free disk space
if: startsWith(matrix.os, 'ubuntu')
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: Miscellaneous setup
shell: bash
run: bash .github/scripts/misc_setup
- name: Install Intel oneAPI on Linux
if: startsWith(matrix.os, 'ubuntu')
run: bash .github/scripts/install_oneapi_linux.sh
- name: Install Intel oneAPI on macOS
if: startsWith(matrix.os, 'macos')
run: bash .github/scripts/install_oneapi_macos.sh
- name: Revise Makefile.common to exclude r16 tests when the dimension is big
if: ${{ matrix.testdim == 'big' }}
shell: bash
run: |
cd fortran/tests/makefiles || exit 42
$SEDI "s|\$(TST)_.*r16_d[0,1]_tst||g" Makefile.common && cat Makefile.common
- name: Revise cobyla/trustregion.f90 to see what is wrong with ubuntu-latest, i8, cobyla, -O3, small
if: ${{ matrix.os == 'ubuntu-latest' && matrix.solver == 'cobyla' && matrix.testdim == 'small' }}
shell: bash
run: |
cd fortran/cobyla || exit 42
$SEDI 's|\(vmultc = cviol + b\)|\1;write(\*,\*) 253, vmultc|' trustregion.f90
$SEDI "s|\(call assert(all(vmultc >= 0), 'VMULTC >= 0', srname)\)|write(\*,\*) 304, vmultc;\1|" trustregion.f90
$SEDI 's|\(vmultc(1:nact) = max(ZERO, vmultc(1:nact) - frac \* vmultd(1:nact))\)|\1;write(\*,\*) 367, vmultc|' trustregion.f90
$SEDI 's|\(vmultc(\[icon, nact\]) = \[ZERO, frac\]\)|\1;write(\*,\*) 377, vmultc|' trustregion.f90
$SEDI 's|\(vmultc = max(ZERO, (ONE - frac) \* vmultc + frac \* vmultd)\)|\1;write(\*,\*) 557, vmultc|' trustregion.f90
cat trustregion.f90
- name: Conduct the test; treat timeout as SUCCESS (exit 0)
uses: equipez/run-bash-command@v2
with:
timelimit: 320m
command: |
FFLAGS=-O$(($(date +%-d) % 5)) && FFLAGS=${FFLAGS/O0/g} && FFLAGS=${FFLAGS/O4/fast} && export FFLAGS
echo "FFLAGS=$FFLAGS"
echo "FFLAGS=$FFLAGS" >> "$GITHUB_ENV"
IK=i$(( 2**(1 + $(date +%-d) % 3) ))
echo "IK=${IK}"
echo "IK=${IK}" >> "$GITHUB_ENV"
export TESTDIM=${{ matrix.testdim }}
cd "$ROOT_DIR"/fortran/tests && make itest_${IK}.${{ matrix.solver }}
cd "$ROOT_DIR"/fortran/examples/${{ matrix.solver }}
export EXAMPLE_NUM=1 && make clean && make itest
export EXAMPLE_NUM=2 && make clean && make itest
- name: Store artifacts
uses: actions/upload-artifact@v7
if: always() # Always run even if the workflow is canceled manually or due to overtime.
with:
name: ${{ matrix.os }}-${{ matrix.solver }}-${{ env.IK }}-${{ env.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 }}