This repository has been archived by the owner on Mar 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathconfig.yml
188 lines (171 loc) · 6.45 KB
/
config.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
182
183
184
185
186
187
188
# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2
jobs:
build:
branches:
ignore:
- dennis-tests
docker:
# specify the version you desire here
# use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
#- image: circleci/python:3.6.1
#- image: singularityware/singularity:3.1-slim # would be faster but interacts badly with cuda docker image loading
- image : nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04
# machine: true
working_directory: ~/repo
# resource_class: xlarge # not activated for the project
steps:
- checkout
#- run:
#- name: Install singularity
#- command: |
#- #chmod u+x ~/repo/.circleci/*.sh
#- #/bin/bash ~/repo/.circleci/install_singularity.sh
#- sudo wget -O- http://neuro.debian.net/lists/xenial.us-ca.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list && \
#- sudo apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9 && \
#- sudo apt-get update
#- sudo apt-get install -y singularity-container
- restore_cache:
keys:
- tag3-conda-{{ checksum "singularity/environment.yml" }}-pytorch
- tag3-conda-{{ checksum "singularity/environment.yml" }}
- tag1-conda
- run:
name: Install miniconda and clone pytorch
command: |
apt-get update
apt-get install -y \
build-essential \
libzmq3-dev \
cmake \
wget \
vim \
git \
ca-certificates \
libjpeg-dev \
openjdk-8-jdk \
libgtest-dev \
libpng-dev
rm -rf /var/lib/apt/lists/
# build gtest (for polygames-tests)
cd /usr/src/googletest/googletest
mkdir build
cd build
cmake ..
make
cp libgtest* /usr/lib/
cd ..
rm -rf build
# conda
CHECKPATH=/opt/conda
if [ -d "$CHECKPATH" ]; then
echo "$CHECKPATH already exists"
else
wget -O ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ~/miniconda.sh -b -p /opt/conda
rm ~/miniconda.sh
git clone --recursive https://github.com/pytorch/pytorch --branch=v1.1.0 ~/pytorch
fi
- save_cache:
paths:
- /opt/conda
- ~/pytorch
key: tag1-conda
- run:
name: Install conda environment
command: |
CHECKPATH=/opt/conda/envs/pypg
. /opt/conda/etc/profile.d/conda.sh
if [ -d "$CHECKPATH" ]; then
echo "$CHECKPATH already exists"
# conda env update -f singularity/environment.yml --name pypg
else
conda env create -f singularity/environment.yml --name pypg
conda activate pypg
pip install mypy>=0.630 pytest>=4.3.0 pytest-cov>=2.6.1 # only required for testing
fi
- save_cache:
paths:
- /opt/conda
- ~/pytorch
key: tag3-conda-{{ checksum "singularity/environment.yml" }}
- run:
name: Install pytorch
command: |
CHECKPATH=~/pytorch/done
if [ -f "$CHECKPATH" ]; then
echo "pytorch already exists"
else
. /opt/conda/etc/profile.d/conda.sh
conda activate pypg
which pip
pip install -U pip
cd ~/pytorch
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
# export MAX_JOBS=$(cat /proc/cpuinfo | grep -c processor)
# if (( $MAX_JOBS < 4 ));
# then MAX_JOBS=4;
# fi;
export MAX_JOBS=4 # calibrate for circleci resources...
echo "Using $MAX_JOBS jobs for pytorch compilation"
# # set cuda arch list so that the built binary can be run on both pascal and volta
MAX_JOBS=$MAX_JOBS TORCH_CUDA_ARCH_LIST='6.0;7.0' pip install . -v
touch $CHECKPATH
fi
- save_cache:
paths:
- /opt/conda
- ~/pytorch
key: tag3-conda-{{ checksum "singularity/environment.yml" }}-pytorch
- run:
name: Build polygames
command: |
. /opt/conda/etc/profile.d/conda.sh
conda activate pypg
mkdir build
cd build
cmake ..
make -j 2
- run:
name: Build polygames-tests
command: |
. /opt/conda/etc/profile.d/conda.sh
conda activate pypg
mkdir ludii
wget -P ludii https://ludii.games/downloads/Ludii.jar
mkdir tests/build
cd tests/build
cmake ..
make -j 2
- run:
name: Test games
command: |
./build/test_state
- run:
name: Test polygames-tests (unit tests)
command: |
./tests/build/polygames-tests
- run:
name: Test Mcts
command: |
./build/torchRL/mcts/test_mcts 1 100
./build/torchRL/mcts/test_mcts 4 50
- run:
name: Test python
command: |
. /opt/conda/etc/profile.d/conda.sh
conda activate pypg
pytest pypolygames --durations=10 --verbose
- run:
name: Run training
command: |
. /opt/conda/etc/profile.d/conda.sh
conda activate pypg
python -m pypolygames traineval --act_batchsize=2 \
--batchsize=2 --replay_capacity=16 --replay_warmup=2 \
--num_epoch=1 --num_game=12 --model_name=NanoFCLogitModel \
--epoch_len=1 --device=cpu --game_name=TicTacToe --sync_period=1 --device_eval=cpu \
--num_actor_eval=2 --num_rollouts_opponent=50 --num_game_eval=4