forked from IBM/aihwkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
178 lines (164 loc) · 6.07 KB
/
.travis.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
# (C) Copyright 2020, 2021 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
notifications:
email: false
# Disable double triggering when issuing a PR from a branch in the main repo.
branches:
only:
- "master"
- /^release\/.*$/
stages:
- Test and lint
- Test multiple python versions
- Build wheels
# Parent stage definition, to avoid copy-pasting.
job_compile_common: &job_compile_common
os: linux
dist: bionic
language: python
before_install:
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update
- sudo apt-get install -y libopenblas-dev gcc-8 g++-8
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-8
install:
# Set the python executable, to force cmake picking the right one.
- PYTHON_EXECUTABLE=~/virtualenv/python$TRAVIS_PYTHON_VERSION/bin/python$TRAVIS_PYTHON_VERSION
- pip install -r requirements.txt pytest
# Install the package in editable mode.
- VERBOSE=1 pip install -v -e ".[visualization]"
script:
- pip install "parameterized==0.7.4"
- make pytest
build_deploy_common: &build_deploy_common
deploy:
provider: s3
access_key_id: $COS_ACCESS_KEY_ID
secret_access_key: $COS_SECRET_ACCESS_KEY
bucket: $COS_BUCKET
skip_cleanup: true
local_dir: wheelhouse
endpoint: https://$COS_ENDPOINT
on:
all_branches: true
jobs:
include:
- name: "Compile and test. Python 3.6"
<<: *job_compile_common
stage: Test and lint
python: "3.6"
env:
- TEST_DATASET=true
- name: "Compile and lint. Python 3.6"
<<: *job_compile_common
stage: Test and lint
python: "3.6"
script:
- pip install -r requirements-dev.txt
- make pycodestyle
- make pylint
- make mypy
- name: "Compile and test. Python 3.7"
<<: *job_compile_common
stage: Test multiple python versions
python: "3.7"
- name: "Compile and test. Python 3.8"
<<: *job_compile_common
stage: Test multiple python versions
python: "3.8"
- name: "Compile and test. Python 3.9"
<<: *job_compile_common
stage: Test multiple python versions
python: "3.9"
- name: "Compile and test. Python 3.6, Torch 1.7.1"
<<: *job_compile_common
stage: Test multiple python versions
python: "3.6"
install:
# Set the python executable, to force cmake picking the right one.
- PYTHON_EXECUTABLE=~/virtualenv/python$TRAVIS_PYTHON_VERSION/bin/python$TRAVIS_PYTHON_VERSION
- pip install -r requirements.txt pytest
- pip install "torch==1.7.1"
# Install the package in editable mode.
- VERBOSE=1 pip install -v -e ".[visualization]"
env:
- TORCH_VERSION_SPECIFIER="==1.7.1"
- name: "Build wheel for Python 3.6, 3.7, 3.8, 3.9 on Linux x86_64"
os: linux
dist: bionic
language: python
services: docker
stage: Build wheels
if: branch =~ /^release\/.*$/
env:
# Use a specific torch version.
- CIBW_ENVIRONMENT="TORCH_VERSION_SPECIFIER='==1.8.1'"
- CIBW_BEFORE_BUILD="pip install torch==1.8.1 torchvision==0.9.1 && pip install -r requirements.txt"
- CIBW_MANYLINUX_X86_64_IMAGE="aihwkit/manylinux2014_x86_64_aihwkit"
- CIBW_BUILD="cp36-manylinux_x86_64 cp37-manylinux_x86_64 cp38-manylinux_x86_64 cp39-manylinux_x86_64"
before_install:
- docker pull aihwkit/manylinux2014_x86_64_aihwkit
install:
- python3 -m pip install cibuildwheel==1.10.0
script:
# Build the wheels into './wheelhouse'.
- python3 -m cibuildwheel --output-dir wheelhouse
<<: *build_deploy_common
- name: "Build wheel for Python 3.6, 3.7, 3.8, 3.9 on OS X"
os: osx
osx_image: xcode12.2
stage: Build wheels
if: branch =~ /^release\/.*$/
addons:
homebrew:
packages:
- openblas
update: true
env:
# Use a specific torch version.
- CIBW_ENVIRONMENT="TORCH_VERSION_SPECIFIER='==1.8.1'"
- CIBW_BEFORE_BUILD="pip install torch==1.8.1 torchvision==0.9.1 && pip install ./delocate && pip install -r requirements.txt"
- CIBW_BUILD="cp36-macosx_x86_64 cp37-macosx_x86_64 cp38-macosx_x86_64 cp39-macosx_x86_64"
before_install:
- git clone -b aihwkit https://github.com/aihwkit-bot/delocate.git
install:
- python3 -m pip install cibuildwheel==1.10.0
script:
# Build the wheels into './wheelhouse'.
- python3 -m cibuildwheel --output-dir wheelhouse --platform macos
<<: *build_deploy_common
- name: "Build wheel for Python 3.6, 3.7, 3.8, 3.9 on win64"
os: windows
language: shell
stage: Build wheels
if: branch =~ /^release\/win.*$/
env:
# Use a specific torch version.
- CIBW_ENVIRONMENT="TORCH_VERSION_SPECIFIER='==1.8.1'"
- CIBW_BEFORE_BUILD="pip install torch==1.8.1+cpu -f https://download.pytorch.org/whl/torch_stable.html && pip install -r requirements.txt"
- CIBW_BUILD="cp36-win_amd64 cp37-win_amd64 cp38-win_amd64 cp39-win_amd64"
# Use unzipped OpenBLAS.
- OPENBLAS_ROOT=C:\\BLAS
- OPENBLAS_ROOT_DIR=C:\\BLAS
before_install:
# Install base python, and ensure it's on the PATH.
- choco install python --version 3.8.6
- export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
- ln -s /c/Python38/python.exe /c/Python38/python3.exe
# Download and unzip OpenBLAS.
- wget https://github.com/xianyi/OpenBLAS/releases/download/v0.3.12/OpenBLAS-0.3.12-x64.zip -q -O openblas.zip
- mkdir C:\\BLAS
- 7z x openblas.zip -oc:\\BLAS
install:
- python3 -m pip install cibuildwheel==1.6.4
script:
# Build the wheels into './wheelhouse'.
- python3 -m cibuildwheel --output-dir wheelhouse
<<: *build_deploy_common