forked from netket/netket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
130 lines (118 loc) · 4.67 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
language: python
sudo: required
matrix:
include:
- 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"
- os: osx
osx_image: xcode11.3
language: generic
env: CONDA=3.6 CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS=-O1"
- 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:
- |
if [ -n "$CONDA" ]; then
if [ "$TRAVIS_OS_NAME" = "linux" ]; then OS=Linux-x86_64; else OS=MacOSX-x86_64; fi
wget -O miniconda.sh https://repo.continuum.io/miniconda/Miniconda${CONDA:0:1}-latest-$OS.sh
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
conda config --set always_yes yes --set changeps1 no
conda update -q conda
conda install -q conda-build
conda env create --file environment.yml
source activate netket_env
# When Travis starts supporting `addons: brew: packages: [...]` correctly,
# this can be move this into the build matrix.
elif [[ "$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
# Force OS X to use the correct python version. This is only because
# Travis' support for `language: python` on OS X is too buggy.
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
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 jax jaxlib
- |
if [ -n "$CONDA" || $TRAVIS_OS_NAME != "osx" ]; then
python -m pip install torch
fi
- 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 'import netket'
- 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 --durations=0 -n 2 --verbose ../Test/
# - python -m pytest --durations=0 --verbose --doctest-glob='*.md' ../Docs/