-
Notifications
You must be signed in to change notification settings - Fork 127
168 lines (156 loc) · 5.99 KB
/
ubuntu.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
name: Ubuntu
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-ubuntu:
strategy:
matrix:
include:
# Ubuntu CPU-only build
- name: "Ubuntu CPU-only"
os: ubuntu-20.04
cuda: ""
gcc: 9
clang: ""
cpu: true
gpu: false
unit_tests: true
examples: false
pymarian: true
# Using Clang compiler
- name: "Ubuntu CPU-only clang-14"
os: ubuntu-22.04
cuda: ""
gcc: ""
clang: 14
cpu: true
gpu: false
unit_tests: true
examples: false
pymarian: true
# Ubuntu GPU-only build
- name: "Ubuntu GPU-only"
os: ubuntu-20.04
cuda: "11.1"
gcc: 9
clang: ""
cpu: false
gpu: true
unit_tests: false
examples: true
pymarian: true
# Ubuntu 22.04 supports CUDA 11.7
# Unit tests and examples are not compiled to save disk space
- name: "Ubuntu 22.04 CUDA 11.7 gcc-11"
os: ubuntu-22.04
cuda: "11.7"
gcc: 11
clang: ""
cpu: false
gpu: true
unit_tests: false
examples: false
pymarian: true
# Ubuntu 20.04 supports CUDA 11+
# Unit tests and examples are not compiled to save disk space
- name: "Ubuntu 20.04 CUDA 11.1 gcc-9"
os: ubuntu-20.04
cuda: "11.1"
gcc: 9
clang: ""
cpu: true
gpu: true
unit_tests: false
examples: false
pymarian: true
# Ubuntu 18.04 supports CUDA 10.1+
# But it will soon be removed from GitHub workflows
# Ubuntu 16.04 supports CUDA 8+
# But it is no longer available in GitHub workflows
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
# The following packages are already installed on GitHub-hosted runners: build-essential openssl libssl-dev
# No need to install libprotobuf{17,10,9v5} on Ubuntu {20,18,16}.04 because it is installed together with libprotobuf-dev
# Boost is no longer pre-installed on GitHub-hosted runners
# Clang 12, 13 and 14 are pre-installed on the ubuntu-22.04 image
# Note that installation of libunwind-dev is a bug fix for ubuntu-22.04 images on Azure/GitHub-hosted machines
# and is normally not required
- name: Install dependencies
run: |
sudo apt-get install -y libunwind-dev libgoogle-perftools-dev libprotobuf-dev protobuf-compiler libboost-system-dev
[ -z "${{ matrix.gcc }}" ] || sudo apt-get install -y gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
# https://software.intel.com/content/www/us/en/develop/articles/installing-intel-free-libs-and-python-apt-repo.html
- name: Install MKL
run: |
wget -qO- "https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB" | sudo apt-key add -
sudo sh -c "echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list"
sudo apt-get update -o Dir::Etc::sourcelist="/etc/apt/sources.list.d/intel-mkl.list"
sudo apt-get install -y --no-install-recommends intel-mkl-64bit-2020.0-088
if: matrix.cpu == true
# The script simplifies installation of different versions of CUDA
- name: Install CUDA
run: ./scripts/ci/install_cuda_ubuntu.sh ${{ matrix.cuda }}
if: matrix.gpu == true
# https://github.com/actions/virtual-environments/issues/687#issuecomment-610471671
- name: Configure CMake
run: |
[ -z "${{ matrix.gcc }}" ] || export CC=/usr/bin/gcc-${{ matrix.gcc }} CXX=/usr/bin/g++-${{ matrix.gcc }} CUDAHOSTCXX=/usr/bin/g++-${{ matrix.gcc }}
[ -z "${{ matrix.clang }}" ] || export CC=/usr/bin/clang-${{ matrix.clang }} CXX=/usr/bin/clang++-${{ matrix.clang }}
mkdir -p build
cd build
cmake .. \
-DBoost_ARCHITECTURE=-x64 \
-DCMAKE_BUILD_TYPE=Release \
-DCOMPILE_CPU=${{ matrix.cpu }} \
-DCOMPILE_CUDA=${{ matrix.gpu }} \
-DCOMPILE_EXAMPLES=${{ matrix.examples }} \
-DUSE_TCMALLOC=OFF \
-DCOMPILE_SERVER=on \
-DCOMPILE_TESTS=${{ matrix.unit_tests }} \
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-${{ matrix.cuda }} \
-DDETERMINISTIC=on \
-DUSE_FBGEMM=${{ matrix.cpu }} \
-DUSE_SENTENCEPIECE=on \
-DUSE_STATIC_LIBS=on \
-DPYMARIAN=${{ matrix.pymarian }} \
- name: Compile
working-directory: build
run: make -j2
# TODO: add a flag to CMake to compile unit tests only on CPU
- name: Run unit tests
working-directory: build
run: make test
# GitHub-hosted VMs do not have GPUs, so can not be run in CUDA builds
if: matrix.unit_tests == true && matrix.gpu == false
- name: Print versions
working-directory: build
run: |
./marian --version
./marian-decoder --version
./marian-scorer --version
./marian-server --version
./spm_encode --version
ls -hlv $(find . -maxdepth 1 -type f -executable \( -name "marian*" -o -name "spm*" \))
- name: Install PyMarian
if: matrix.pymarian == true
working-directory: build
env:
CUDA_VERSION: ${{ matrix.cuda }}
run: |
echo "Built wheels:" && ls -lh pymarian*.whl
pytag=$(python3 -c 'import sys; x,y=sys.version_info[:2]; print(f"cp{x}{y}-{sys.platform}")')
whl=$(echo pymarian*${pytag}*.whl)
echo "Chosen wheel: $pytag :: $whl" && ls -lh $whl
python3 -m pip install --upgrade pip pytest
python3 -m pip install -v $whl
python3 -m pymarian -v
pymarian-eval --version
pymarian --version