Skip to content

Commit 09b39cc

Browse files
added build scripts, fixed tests to not assume larger number of cores
1 parent 6f7c0be commit 09b39cc

File tree

5 files changed

+28
-10
lines changed

5 files changed

+28
-10
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ matrix:
22
include:
33
- name: "Linux-Py2"
44
os: linux
5+
dist: xenial
56
env:
67
- MINICONDA=Miniconda2-latest-Linux-x86_64.sh
78
- PYVER="--python=27"
89
- name: "Linux-Py3"
910
os: linux
11+
dist: xenial
1012
env:
1113
- MINICONDA=Miniconda3-latest-Linux-x86_64.sh
1214
- PYVER=""
@@ -41,4 +43,4 @@ install:
4143
- g++ -v
4244

4345
script:
44-
- conda build -c intel -c conda-forge $PYVER conda-recipe
46+
- conda build -c intel -c conda-forge -c defaults $PYVER conda-recipe

conda-recipe/bld.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@rem Remember to activate Intel Compiler, or remoe these two lines to ise Microsoft Visual Studio compiler
2+
3+
%PYTHON% setup.py build --force install --old-and-unmanageable
4+
if errorlevel 1 exit 1

conda-recipe/build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash -x
2+
3+
# make sure that compiler has been sourced, if necessary
4+
5+
CFLAGS="-I${PREFIX}/include ${CFLAGS}" $PYTHON setup.py build --force install --old-and-unmanageable

conda-recipe/meta.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ requirements:
2020
- mkl-devel
2121
- cython
2222
- numpy 1.11.*
23+
- six
2324
run:
2425
- python
2526
- mkl
27+
- six
2628
- {{ pin_compatible('numpy') }}
2729

2830
test:
@@ -39,7 +41,7 @@ about:
3941
license_file: LICENSE.txt
4042
description:
4143
Intel(R) Math Kernel Library (Intel(R) MKL) support functions are
42-
subdivided into the following groups according to their purpose:
44+
subdivided into the following groups according to their purpose, such as
4345
Version Information
4446
Threading Control
4547
Timing
@@ -51,3 +53,4 @@ about:
5153
extra:
5254
recipe-maintainers:
5355
- oleksandr-pavlyk
56+
- dmitrii-zagornyi

tests/test_mkl_service.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,29 @@ class test_threading_control():
4848
# https://software.intel.com/en-us/mkl-developer-reference-c-threading-control
4949
def test_set_num_threads(self):
5050
saved = mkl.get_max_threads()
51-
mkl.set_num_threads(8)
52-
assert(mkl.get_max_threads() == 8)
51+
half_nt = int( 0.5 + saved / 2 )
52+
mkl.set_num_threads(half_nt)
53+
assert(mkl.get_max_threads() == half_nt)
5354
mkl.set_num_threads(saved)
5455

5556
def test_domain_set_num_threads_blas(self):
5657
saved_blas_nt = mkl.domain_get_max_threads(domain='blas')
5758
saved_fft_nt = mkl.domain_get_max_threads(domain='fft')
5859
saved_vml_nt = mkl.domain_get_max_threads(domain='vml')
5960
# set
60-
status = mkl.domain_set_num_threads(4, domain='blas')
61+
blas_nt = int( (3 + saved_blas_nt)/4 )
62+
fft_nt = int( (3 + 2*saved_fft_nt)/4 )
63+
vml_nt = int( (3 + 3*saved_vml_nt)/4 )
64+
status = mkl.domain_set_num_threads(blas_nt, domain='blas')
6165
assert(status == 'success')
62-
status = mkl.domain_set_num_threads(5, domain='fft')
66+
status = mkl.domain_set_num_threads(fft_nt, domain='fft')
6367
assert(status == 'success')
64-
status = mkl.domain_set_num_threads(6, domain='vml')
68+
status = mkl.domain_set_num_threads(vml_nt, domain='vml')
6569
assert(status == 'success')
6670
# check
67-
assert(mkl.domain_get_max_threads(domain='blas') == 4)
68-
assert(mkl.domain_get_max_threads(domain='fft') == 5)
69-
assert(mkl.domain_get_max_threads(domain='vml') == 6)
71+
assert(mkl.domain_get_max_threads(domain='blas') == blas_nt)
72+
assert(mkl.domain_get_max_threads(domain='fft') == fft_nt)
73+
assert(mkl.domain_get_max_threads(domain='vml') == vml_nt)
7074
# restore
7175
status = mkl.domain_set_num_threads(saved_blas_nt, domain='blas')
7276
assert(status == 'success')

0 commit comments

Comments
 (0)