forked from blockwise-direct-search/bds
-
Notifications
You must be signed in to change notification settings - Fork 0
195 lines (166 loc) · 6.41 KB
/
profile_cbds_bfgs_big.yml
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: Profile cbds and bfgs using optiprofiler, big
on:
# Trigger the workflow on # push or pull request
push:
# Trigger the workflow manually
schedule:
- cron: '0 0 */2 * *'
workflow_dispatch:
jobs:
test:
name: Profile BDS and bfgs, big
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
matlab: [latest]
dim: [big]
with_optim_toolbox: [yes]
solver: [cbds]
competitor: [fminunc]
run_plain: [false]
summarize_log_ratio_profiles: [false]
feature: [plain, perturbed_x0_0.001, perturbed_x0_1, perturbed_x0_10, perturbed_x0_100, noisy_1e-1, noisy_1e-2, noisy_1e-3, noisy_1e-4, truncated_1, truncated_2, truncated_3, truncated_4, permuted, linearly_transformed, random_nan_5, random_nan_10, random_nan_20, quantized_1, quantized_2, quantized_3, quantized_4, rotation_noisy_1e-1, rotation_noisy_1e-2, rotation_noisy_1e-3, rotation_noisy_1e-4]
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Checkout OptiProfiler
uses: actions/checkout@v4
with:
repository: optiprofiler/optiprofiler
ref: matlab
path: optiprofiler
- name: Install Texlive
run: sudo apt-get update && sudo apt-get install texlive
- name: Check whether LaTeX is installed
run: pdflatex --version
- name: Cache MATLAB
id: cache-matlab
uses: actions/cache@v4.0.1
with:
path: ${{ runner.tool_cache }}/MATLAB
key: ${{ matrix.os }}-${{ matrix.matlab }}-${{ matrix.with_optim_toolbox }}
- name: Set up MATLAB with optimization toolbox
if: ${{ matrix.with_optim_toolbox == 'yes' }}
uses: matlab-actions/setup-matlab@v2.1.2
with:
release: ${{ matrix.matlab }}
products: Optimization_Toolbox
- name: Run test
uses: matlab-actions/run-command@v2.1.1
with:
command: |
root_dir = pwd()
ls
% Setup optiprofiler
cd(fullfile(root_dir, 'optiprofiler'));
setup
cd(root_dir);
% Setup bds
setup
cd(fullfile(root_dir, 'tests', 'competitors'));
addpath(pwd);
% profile
cd(fullfile(root_dir, 'tests'));
options = struct();
options.feature_name = '${{ matrix.feature }}';
options.solver_names = {'${{ matrix.solver }}', '${{ matrix.competitor }}'};
options.dim = '${{ matrix.dim }}';
options.run_plain = ${{ matrix.run_plain }};
options.summarize_log_ratio_profiles = ${{ matrix.summarize_log_ratio_profiles }};
profile_optiprofiler(options);
cd(root_dir);
cd(fullfile(root_dir, 'tests', 'out'));
ls -R
cd(root_dir);
- name: Change the summary file name
run: |
cd ./tests/out
ls -R
find . -type f -name 'summary.pdf' | while read -r file; do
# Obtain the parent directory and name
parent_dir=$(dirname "$file")
parent_name=$(basename "$parent_dir")
# Obtain the new name(Why the fifth underline? Because the last five parts are the time stamp)
new_name=$(echo "$parent_name" | awk -F'_' '{if(NF>=5) {for(i=1;i<=NF-5;i++) printf "%s%s", $i, (i<NF-5?"_":"")} else print $0}')
# Print the new name
echo "New name: $new_name"
# Obtain the directory name
dir_name=$(dirname "$file")
# Establish the new file name
new_file="$dir_name/summary_$new_name.pdf"
# Check if the source and destination are the same
if [ "$file" != "$new_file" ]; then
mv "$file" "$new_file"
echo "Renamed $file to $new_file"
else
echo "Source and destination are the same, skipping: $file"
fi
done
- name: Upload artifact
uses: actions/upload-artifact@v3.1.2
with:
name: profile_optiprofiler_${{ matrix.solver }}_${{ matrix.competitor }}_${{ matrix.dim }}_${{ matrix.feature }}_${{ matrix.run_plain }}
path: ./tests/out/**
merge_artifacts:
name: Merge Artifacts
runs-on: ubuntu-latest
needs: test
permissions:
actions: read
contents: read
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install PDF tools
run: sudo apt-get update && sudo apt-get install -y poppler-utils
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: tests/testdata/downloaded_artifacts
- name: List all files
run: |
cd tests/testdata/downloaded_artifacts
ls -R
- name: Merge PDF files
run: |
cp tests/tools/merge_pdf.sh tests/testdata/downloaded_artifacts
cd tests/testdata/downloaded_artifacts/
ARTIFACT_NAME=$(ls | grep "profile_optiprofiler" | head -n 1)
BASE_INFO=$(echo $ARTIFACT_NAME | sed -n 's/.*optiprofiler_\([^_]*_[^_]*_\(small\|big\)\).*/\1/p')
echo "Base info extracted: ${BASE_INFO}"
echo "BASE_INFO=${BASE_INFO}" >> $GITHUB_ENV
# Merge PDF files
mkdir summary
for f in $(find . -maxdepth 3 -type f -name 'summary*.pdf'); do
if [ ! -f "summary/$(basename $f)" ]; then
cp "$f" summary/
fi
done
cd summary
ls
bash ../merge_pdf.sh
mv merged.pdf "summary_${BASE_INFO}.pdf"
cd ..
if [ -d "summary" ]; then
mv summary "summary_${BASE_INFO}"
fi
- name: Upload merged artifact
uses: actions/upload-artifact@v3
env:
BASE_INFO: ${{ env.BASE_INFO }}
with:
name: merged_profiles_${{ env.BASE_INFO }}
path: tests/testdata/downloaded_artifacts/**
- name: Upload summary files
uses: actions/upload-artifact@v3
env:
BASE_INFO: ${{ env.BASE_INFO }}
with:
name: summary_files_${{ env.BASE_INFO }}
path: tests/testdata/downloaded_artifacts/summary_${{ env.BASE_INFO }}/**