forked from netket/netket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
181 lines (169 loc) · 6.59 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
179
180
181
language: python
sudo: required
matrix:
include:
- os: osx
osx_image: xcode9.4
language: generic
env: PYTHON=2.7 CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=-O1"
- os: osx
osx_image: xcode10.2
language: generic
env: PYTHON=3.6.0 CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=clang++ -DNETKET_USE_OPENMP=ON -DCMAKE_CXX_FLAGS=-O2"
# The oldest supported configurations
- os: linux
dist: xenial
python: 2.7
env: CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-4.0 -DCMAKE_CXX_COMPILER=clang++-4.0 -DCMAKE_CXX_FLAGS='-stdlib=libc++ -I/usr/include/libcxxabi -O1'"
addons:
apt:
sources:
- 'llvm-toolchain-4.0'
packages:
- 'ninja-build'
- 'clang-4.0'
- 'libc++-dev'
- 'libc++abi-dev'
- 'libomp-dev'
- 'libmpich-dev'
- 'libopenblas-dev'
- os: linux
dist: xenial
python: 2.7
env: CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc-5 -DCMAKE_CXX_COMPILER=g++-5 -DCMAKE_CXX_FLAGS=-O1"
addons:
apt:
sources:
- 'ubuntu-toolchain-r-test'
packages:
- 'ninja-build'
- 'g++-5'
- 'libmpich-dev'
- 'libatlas-base-dev'
# Not too old toolsets
- os: linux
dist: xenial
python: 3.5
env: CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-6.0 -DCMAKE_CXX_COMPILER=clang++-6.0 -DCMAKE_CXX_FLAGS=-O2"
addons:
apt:
sources:
- 'ubuntu-toolchain-r-test'
- 'llvm-toolchain-6.0'
packages:
- 'ninja-build'
- 'g++-7'
- 'clang-6.0'
- 'libomp-dev'
- 'libmpich-dev'
- 'libopenblas-dev'
- os: linux
dist: xenial
python: 3.6
env: CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7 -DNETKET_USE_BLAS=OFF -DNETKET_USE_LAPACK=OFF -DCMAKE_CXX_FLAGS=-O1"
addons:
apt:
sources:
- 'ubuntu-toolchain-r-test'
packages:
- 'ninja-build'
- 'g++-7'
- 'libopenmpi-dev'
# Modern toolsets
- os: linux
dist: xenial
python: 3.7
env: CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8 -DCMAKE_CXX_FLAGS=-std=c++17 -DCMAKE_CXX_FLAGS=-O2"
addons:
apt:
sources:
- 'ubuntu-toolchain-r-test'
- 'llvm-toolchain-xenial-8'
packages:
- 'ninja-build'
- 'clang-8'
- 'g++-9'
- 'libomp-dev'
- 'libmpich-dev'
- 'libopenblas-dev'
- os: linux
dist: xenial
python: 3.7
env: CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc-9 -DCMAKE_CXX_COMPILER=g++-9 -DCMAKE_CXX_FLAGS=-O1"
addons:
apt:
sources:
- 'ubuntu-toolchain-r-test'
packages:
- 'ninja-build'
- 'g++-9'
- 'libopenmpi-dev'
- 'libopenblas-dev'
before_install:
- |
# When Travis starts supporting `addons: brew: packages: [...]` correctly,
# this can be move this into the build matrix.
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update
brew ls --versions cmake && brew upgrade cmake || brew install cmake
brew ls --versions openmpi && brew upgrade openmpi || brew install openmpi
brew ls --versions pyenv && brew upgrade pyenv || brew install pyenv
brew ls --versions openmpi && brew upgrade libomp || brew install libomp
brew ls --versions openmpi && brew upgrade ninja-build || brew install ninja
fi
- |
# Force OS X to use the correct python version. This is only because
# Travis' support for `language: python` on OS X is too buggy.
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install $PYTHON
# This part is (apparently) quite important! As per the docs it makes
# pyenv aware that some executables have been installed/removed. Without it
# `pyenv global` won't be able to find the version of Python we're asking for.
pyenv rehash
# Printing the info about pyenv's python version before and after the change.
# We should see something like `system` before and `3.6.0` after.
pyenv global
pyenv global $PYTHON
pyenv global
# Manually update the PATH as advised in the pyenv docs.
PATH="$(pyenv root)/shims:$PATH"
# OS X build have `language: generic` so `TRAVIS_PYTHON_VERSION` is undefined
# at first.
TRAVIS_PYTHON_VERSION=$PYTHON
fi
- |
if ! which pip; then
python -m easy_install pip
fi
- |
# Check that `python` is actually the version we want
# Parses `TRAVIS_PYTHON_VERSION` and throws away the patch level as Travis only
# saves the major and minor versions.
_WE_WANTED=$(echo "$TRAVIS_PYTHON_VERSION" | sed -E 's/([0-9]+\.[0-9]+)($|\.[0-9]+)/\1/')
# Ask python itself what its major and minor versions are
_WE_GOT=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
if [[ $_WE_WANTED != $_WE_GOT ]]; then
# The `&& false` here is needed to produce the error code indicating failure, because
# we don't want to proceed if Python is not installed properly.
echo "Something went wrong during python installation: $_WE_WANTED != $_WE_GOT" && false
fi
# Check that 'Python.h' can be found, i.e. that we didn't forget to install development files.
# Otherwise we'll run into trouble when trying to use pybind11.
- find $(python -c 'from distutils import sysconfig; print(sysconfig.get_python_inc())') -name 'Python.h'
install:
- cmake --version
- python --version
- python -m pip install -U pip
- python -m pip --version
- python -m easy_install -U setuptools
- python -m pip install numpy scipy networkx pytest python-igraph mpi4py
- python -m pip install -U pytest
- python -m pip install pytest-xdist
- python -m pytest --version
- NETKET_CMAKE_FLAGS="$CMAKE_FLAGS" python -m pip install -v .
- mkdir workdir && cd workdir
script:
- python -c 'from mpi4py import MPI; print(MPI.get_vendor())'
- python -c 'import netket; g = netket.graph.Hypercube(4, 1); h = netket.hilbert.Spin(g, 0.5); m = netket.machine.RbmSpin(h, 10)'
- python -m pytest -n 2 --verbose ../Test/
- python -m pytest --verbose --doctest-glob='*.md' ../Docs/