-
Notifications
You must be signed in to change notification settings - Fork 19
156 lines (138 loc) · 5.68 KB
/
rapfi.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
name: Rapfi
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
Rapfi:
name: ${{ matrix.target.name }}-${{ matrix.arch.name }}
runs-on: ${{ matrix.target.os }}
env:
CC: ${{ matrix.target.c_compiler }}
CXX: ${{ matrix.target.cxx_compiler }}
strategy:
matrix:
target:
- {
name: linux-gcc,
os: ubuntu-22.04,
c_compiler: gcc,
cxx_compiler: g++,
cmake_command: "",
shell: "bash {0}"
}
- {
name: linux-clang,
os: ubuntu-20.04,
c_compiler: clang-18,
cxx_compiler: clang++-18,
cmake_command: "",
shell: "bash {0}"
}
- {
name: windows-gcc,
os: windows-latest,
c_compiler: gcc,
cxx_compiler: g++,
cmake_command: "",
msys_sys: 'mingw64',
msys_env: 'x86_64',
shell: "msys2 {0}"
}
- {
name: windows-clang,
os: windows-latest,
c_compiler: clang,
cxx_compiler: clang++,
cmake_command: "",
msys_sys: 'mingw64',
msys_env: 'x86_64',
shell: "msys2 {0}"
}
arch:
- { name: sse, cmake_command: "-DUSE_AVX2=OFF" }
- { name: avx2, cmake_command: "-DUSE_AVX2=ON" }
- { name: avxvnni, cmake_command: "-DUSE_AVX2=ON -DUSE_VNNI=ON" }
- { name: avx512, cmake_command: "-DUSE_AVX2=ON -DUSE_AVX512=ON" }
- { name: avx512vnni, cmake_command: "-DUSE_AVX2=ON -DUSE_AVX512=ON -DUSE_VNNI=ON" }
defaults:
run:
working-directory: Rapfi
shell: ${{ matrix.target.shell }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Download latest clang compiler on linux
if: matrix.target.name == 'linux-clang'
run: |
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
echo | sudo ./llvm.sh 18
rm llvm.sh
- name: Setup msys and install required packages
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.target.msys_sys}}
install: mingw-w64-${{matrix.target.msys_env}}-${{matrix.target.c_compiler}} mingw-w64-${{matrix.target.msys_env}}-cmake make git
- name: Extract the bench hash from the commit history
run: |
git log HEAD | grep "\b[Bb]ench\s*[a-f0-9]\{8\}" | head -n 1 | sed "s/\s*[Bb]ench\s*\([a-f0-9]\{8\}\).*/\1/g" > git_sig
[ -s git_sig ] && echo "commit_bench=$(cat git_sig)" >> $GITHUB_ENV && echo "Reference bench:" $(cat git_sig) || echo "No bench found"
- name: Build
run: |
rm -rf build && mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release ${{ matrix.target.cmake_command }} ${{ matrix.arch.cmake_command }}
cmake --build . -j2 && strip pbrain-rapfi*
mv -v pbrain-rapfi pbrain-rapfi-${{ matrix.target.name }}-${{ matrix.arch.name }}
- name: Check bench signature
if: matrix.arch.name == 'avx2'
run: |
cd build && find ../../Networks -mindepth 2 -type f -exec cp {} . \;
./pbrain-rapfi* bench > bench.txt
cat bench.txt
actual_bench=$(grep "Hash" bench.txt | sed "s/[^H]*\sHash:\?\s\([a-f0-9]\{8\}\).*/\1/g")
if [[ "$actual_bench" != "$commit_bench" ]]; then echo "Incorrect bench, got '$actual_bench' expected '$commit_bench'" && exit 1; fi
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Rapfi
path: Rapfi/build/pbrain-rapfi*
Fishtest:
name: linux-avx2
runs-on: ubuntu-20.04
env:
CC: clang
CXX: clang++
defaults:
run:
working-directory: Rapfi
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: |
rm -rf build && mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_BMI2=OFF -DUSE_AVX2=ON -DUSE_AVX=ON -DUSE_SSE=ON -DNO_COMMAND_MODULES=ON
cmake --build . -j2 && strip pbrain-rapfi*
mv -v pbrain-rapfi rapfi-linux-avx2
- name: Upload to fishtest
if: ${{ !contains(github.event.head_commit.message, 'Passed') && !contains(github.event.head_commit.message, 'skip_fishtest') }}
run: |
COMMIT_TITLE=$(echo "${{github.event.head_commit.message}}" | head -n 1)
curl http://test.pikafish.org/api/add_task -F engine=@build/rapfi-linux-avx2 -F variant=gomoku_freestyle20 -F "task_name=[f20] $COMMIT_TITLE" -F "password=${{secrets.NOTHING}}" -F "game_time=10" -F "inc_time=0.1" -F "depth=-1" -F "nodes=-1" -F "elo0=0" -F "elo1=5" -F "alpha=0.05" -F "beta=0.05"
sleep 15
curl http://test.pikafish.org/api/add_task -F engine=@build/rapfi-linux-avx2 -F variant=gomoku_standard15 -F "task_name=[s15] $COMMIT_TITLE" -F "password=${{secrets.NOTHING}}" -F "game_time=10" -F "inc_time=0.1" -F "depth=-1" -F "nodes=-1" -F "elo0=0" -F "elo1=5" -F "alpha=0.05" -F "beta=0.05"
sleep 5
curl http://test.pikafish.org/api/add_task -F engine=@build/rapfi-linux-avx2 -F variant=gomoku_renju15 -F "task_name=[r15] $COMMIT_TITLE" -F "password=${{secrets.NOTHING}}" -F "game_time=10" -F "inc_time=0.1" -F "depth=-1" -F "nodes=-1" -F "elo0=0" -F "elo1=5" -F "alpha=0.05" -F "beta=0.05"
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Fishtest
path: Rapfi/build/rapfi-linux-avx2