Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.

Commit 0d7c47e

Browse files
committed
improved CI device selection and py2&3
1 parent 443ccbc commit 0d7c47e

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

.gitlab-ci.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ testjob:
3131
only:
3232
- master
3333
- dev
34-
- merging-github-pr-269
3534
- tags
3635
script:
3736
# !!kill coverage in case of hanging processes
@@ -45,9 +44,6 @@ testjob:
4544
- python -c "import tensorflow as tf; from tensorflow.python.client import device_lib; print device_lib.list_local_devices()"
4645
- ls -la /dev | grep nvidia
4746

48-
- echo $(python tests/get_gpu_index.py)
49-
- export CUDA_VISIBLE_DEVICES=$(python tests/get_gpu_index.py)
50-
5147
# removing existing testing data
5248
- if [ -d models ]; then rm -r models; fi
5349
- if [ -d testing_data ]; then rm -r testing_data; fi
@@ -80,6 +76,9 @@ testjob:
8076

8177
- pip install -r requirements-gpu.txt
8278

79+
- echo $(python tests/get_gpu_index.py)
80+
- export CUDA_VISIBLE_DEVICES=$(python tests/get_gpu_index.py)
81+
8382
# check whether version command works
8483
# Git-clone:
8584
- python net_segment.py --version 2>&1 | grep -E 'NiftyNet.*version.*[0-9]+\.[0-9]+\.[0-9]+'
@@ -167,6 +166,9 @@ testjob:
167166
- pip install coverage
168167
- pip install -r requirements-gpu.txt
169168

169+
- echo $(python tests/get_gpu_index.py)
170+
- export CUDA_VISIBLE_DEVICES=$(python tests/get_gpu_index.py)
171+
170172
- python net_download.py testing -r
171173
- coverage run -a --source . net_segment.py train -c config/highres3dnet_config.ini --batch_size=1 --num_threads=2 --queue_length=40 --max_iter=10
172174
- coverage run -a --source . net_segment.py inference -c config/highres3dnet_config.ini --batch_size 8 --spatial_window_size 64,64,64 --queue_length 64
@@ -230,7 +232,6 @@ quicktest:
230232
except:
231233
- master
232234
- dev
233-
- merging-github-pr-269
234235
- tags
235236
- 147-revise-contribution-guidelines-to-include-github
236237
- 150-properly-format-the-bibtex-entry-to-the-ipmi-2017-paper-on-the-main-readme
@@ -289,6 +290,10 @@ quicktest:
289290
- coverage erase
290291
# run only fast tests
291292
- pip install -r requirements-gpu.txt
293+
294+
- echo $(python tests/get_gpu_index.py)
295+
- export CUDA_VISIBLE_DEVICES=$(python tests/get_gpu_index.py)
296+
292297
- python net_download.py testing -r
293298
- QUICKTEST=True coverage run -a --source . -m unittest discover -s "tests" -p "*_test.py"
294299
- coverage report --omit='niftynet-dev-test*' -m
@@ -307,7 +312,7 @@ pip-installer:
307312
only:
308313
- master
309314
- dev
310-
- merging-github-pr-269
315+
- release-v0.5.0
311316
- tags
312317
script:
313318
# get the shortened version of last commit's hash
@@ -343,6 +348,10 @@ pip-installer:
343348
# NiftyNet console entries should fail gracefully if TF not installed
344349
# i.e. check that the warning displays the TF website
345350
- cd $niftynet_dir
351+
352+
- echo $(python tests/get_gpu_index.py)
353+
- export CUDA_VISIBLE_DEVICES=$(python tests/get_gpu_index.py)
354+
346355
- set +e
347356
- python -c "import niftynet" 2>&1 | grep "https://www.tensorflow.org/"
348357
- set -e
@@ -443,6 +452,10 @@ pip-installer:
443452
# NiftyNet console entries should fail gracefully if TF not installed
444453
# i.e. check that the warning displays the TF website
445454
- cd $niftynet_dir
455+
456+
- echo $(python tests/get_gpu_index.py)
457+
- export CUDA_VISIBLE_DEVICES=$(python tests/get_gpu_index.py)
458+
446459
- set +e
447460
- python -c "import niftynet" 2>&1 | grep "https://www.tensorflow.org/"
448461
- set -e

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
22
from setuptools import setup, find_packages
3+
from io import open
34

45
import versioneer
56
from niftynet.utilities.versioning import get_niftynet_version

tests/get_gpu_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
p3 = Popen(['sed', 's: MiB::'], stdin=p2.stdout, stdout=PIPE)
1111
output, error = p3.communicate()
1212

13-
free_memory = [float(x) for x in output.split('\n')[:-1]]
13+
free_memory = [float(x) for x in output.decode('utf-8').split('\n')[:-1]]
1414
if free_memory[1] > free_memory[0]:
1515
print('1')
1616
else:

0 commit comments

Comments
 (0)