Skip to content

Commit 958da37

Browse files
Updated CBWR tests
1 parent e069b95 commit 958da37

File tree

1 file changed

+33
-41
lines changed

1 file changed

+33
-41
lines changed

tests/test_mkl_service.py

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525

2626

27-
from nose.tools import nottest
27+
from nose.tools import assert_equals, nottest
2828
import six
2929
import mkl
3030

@@ -193,48 +193,40 @@ def test_set_memory_limit(self):
193193

194194
class test_conditional_numerical_reproducibility_control:
195195
# https://software.intel.com/en-us/mkl-developer-reference-c-conditional-numerical-reproducibility-control
196-
def test_cbwr_set_off(self):
197-
mkl.cbwr_set(branch='off')
198-
199-
def test_cbwr_set_auto(self):
200-
mkl.cbwr_set(branch='auto')
201-
202-
def test_cbwr_set_compatible(self):
203-
mkl.cbwr_set(branch='compatible')
204-
205-
def test_cbwr_set_sse2(self):
206-
mkl.cbwr_set(branch='sse2')
207-
208-
def test_cbwr_set_sse3(self):
209-
mkl.cbwr_set(branch='sse3')
210-
211-
def test_cbwr_set_ssse3(self):
212-
mkl.cbwr_set(branch='ssse3')
213-
214-
def test_cbwr_set_sse4_1(self):
215-
mkl.cbwr_set(branch='sse4_1')
216-
217-
def test_cbwr_set_sse4_2(self):
218-
mkl.cbwr_set(branch='sse4_2')
219-
220-
def test_cbwr_set_avx(self):
221-
mkl.cbwr_set(branch='avx')
222-
223-
def test_cbwr_set_avx2(self):
224-
mkl.cbwr_set(branch='avx2')
225-
226-
def test_cbwr_set_avx512_mic(self):
227-
mkl.cbwr_set(branch='avx512_mic')
228-
229-
def test_cbwr_set_avx512(self):
230-
mkl.cbwr_set(branch='avx512')
231-
232-
def test_cbwr_get(self):
196+
def test_cbwr(self):
197+
branches = [
198+
'off',
199+
'branch_off',
200+
'auto',
201+
'compatible',
202+
'sse2',
203+
'ssse3',
204+
'sse4_1',
205+
'sse4_2',
206+
'avx',
207+
'avx2',
208+
'avx2_strict',
209+
'avx512_mic',
210+
'avx512_mic_strict',
211+
'avx512',
212+
'avx512_strict',
213+
'avx512_mic_e1',
214+
'avx512_e1',
215+
'avx512_e1_strict',
216+
]
217+
for branch in branches:
218+
yield check_cbwr, branch
219+
220+
def check_cbwr(self, branch):
221+
status = mkl.cbwr_set(branch=branch)
222+
if status == 'success':
223+
assert_equals(mkl.cbwr_get(cnr_const='branch'), branch)
224+
elif status != 'err_unsupported_branch':
225+
raise AssertionError(status)
226+
227+
def test_cbwr_get_all(self):
233228
mkl.cbwr_get(cnr_const='all')
234229

235-
def test_cbwr_get(self):
236-
mkl.cbwr_get(cnr_const='branch')
237-
238230
def test_cbwr_get_auto_branch(self):
239231
mkl.cbwr_get_auto_branch()
240232

0 commit comments

Comments
 (0)