From e069b95835971707be09221e06f4079c8fa7a030 Mon Sep 17 00:00:00 2001 From: Dmitry Zagorny Date: Mon, 26 Aug 2019 21:11:18 -0500 Subject: [PATCH 01/16] Added new CBWR constants --- mkl/_mkl_service.pxd | 17 +++++++++++------ mkl/_mkl_service.pyx | 36 +++++++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/mkl/_mkl_service.pxd b/mkl/_mkl_service.pxd index 0c40d21..819e5c6 100644 --- a/mkl/_mkl_service.pxd +++ b/mkl/_mkl_service.pxd @@ -45,10 +45,16 @@ cdef extern from "mkl.h": int MKL_MEM_MCDRAM # CNR Control Constants + int MKL_CBWR_BRANCH + int MKL_CBWR_ALL + + int MKL_CBWR_STRICT + + int MKL_CBWR_OFF + int MKL_CBWR_BRANCH_OFF int MKL_CBWR_AUTO int MKL_CBWR_COMPATIBLE int MKL_CBWR_SSE2 - int MKL_CBWR_SSE3 int MKL_CBWR_SSSE3 int MKL_CBWR_SSE4_1 int MKL_CBWR_SSE4_2 @@ -56,15 +62,14 @@ cdef extern from "mkl.h": int MKL_CBWR_AVX2 int MKL_CBWR_AVX512_MIC int MKL_CBWR_AVX512 - int MKL_CBWR_STRICT - int MKL_CBWR_AVX512_E1 int MKL_CBWR_AVX512_MIC_E1 - int MKL_CBWR_BRANCH - int MKL_CBWR_ALL + int MKL_CBWR_AVX512_E1 + int MKL_CBWR_SUCCESS - int MKL_CBWR_BRANCH_OFF + int MKL_CBWR_ERR_INVALID_SETTINGS int MKL_CBWR_ERR_INVALID_INPUT int MKL_CBWR_ERR_UNSUPPORTED_BRANCH + int MKL_CBWR_ERR_UNKNOWN_BRANCH int MKL_CBWR_ERR_MODE_CHANGE_FAILURE # ISA Constants diff --git a/mkl/_mkl_service.pyx b/mkl/_mkl_service.pyx index eed1c3b..b3f4569 100644 --- a/mkl/_mkl_service.pyx +++ b/mkl/_mkl_service.pyx @@ -645,24 +645,24 @@ cdef object __cbwr_set(branch=None): """ __variables = { 'input': { - 'off': mkl.MKL_CBWR_BRANCH_OFF, + 'off': mkl.MKL_CBWR_OFF, + 'branch_off': mkl.MKL_CBWR_BRANCH_OFF, 'auto': mkl.MKL_CBWR_AUTO, 'compatible': mkl.MKL_CBWR_COMPATIBLE, 'sse2': mkl.MKL_CBWR_SSE2, - 'sse3': mkl.MKL_CBWR_SSE3, 'ssse3': mkl.MKL_CBWR_SSSE3, 'sse4_1': mkl.MKL_CBWR_SSE4_1, 'sse4_2': mkl.MKL_CBWR_SSE4_2, 'avx': mkl.MKL_CBWR_AVX, 'avx2': mkl.MKL_CBWR_AVX2, + 'avx2_strict': mkl.MKL_CBWR_AVX2 | mkl.MKL_CBWR_STRICT, 'avx512_mic': mkl.MKL_CBWR_AVX512_MIC, + 'avx512_mic_strict': mkl.MKL_CBWR_AVX512_MIC | mkl.MKL_CBWR_STRICT, 'avx512': mkl.MKL_CBWR_AVX512, - 'avx512_e1': mkl.MKL_CBWR_AVX512_E1, + 'avx512_strict': mkl.MKL_CBWR_AVX512 | mkl.MKL_CBWR_STRICT, 'avx512_mic_e1': mkl.MKL_CBWR_AVX512_MIC_E1, - 'avx2,strict': mkl.MKL_CBWR_AVX2 | mkl.MKL_CBWR_STRICT, - 'avx512_mic,strict': mkl.MKL_CBWR_AVX512_MIC | mkl.MKL_CBWR_STRICT, - 'avx512,strict': mkl.MKL_CBWR_AVX512 | mkl.MKL_CBWR_STRICT, - 'avx512_e1,strict': mkl.MKL_CBWR_AVX512_E1 | mkl.MKL_CBWR_STRICT, + 'avx512_e1': mkl.MKL_CBWR_AVX512_E1, + 'avx512_e1_strict': mkl.MKL_CBWR_AVX512_E1 | mkl.MKL_CBWR_STRICT, }, 'output': { mkl.MKL_CBWR_SUCCESS: 'success', @@ -690,19 +690,24 @@ cdef inline __cbwr_get(cnr_const=None): 'all': mkl.MKL_CBWR_ALL, }, 'output': { - mkl.MKL_CBWR_BRANCH_OFF: 'off', + mkl.MKL_CBWR_OFF: 'off', + mkl.MKL_CBWR_BRANCH_OFF: 'branch_off', mkl.MKL_CBWR_AUTO: 'auto', mkl.MKL_CBWR_COMPATIBLE: 'compatible', mkl.MKL_CBWR_SSE2: 'sse2', - mkl.MKL_CBWR_SSE3: 'sse3', mkl.MKL_CBWR_SSSE3: 'ssse3', mkl.MKL_CBWR_SSE4_1: 'sse4_1', mkl.MKL_CBWR_SSE4_2: 'sse4_2', mkl.MKL_CBWR_AVX: 'avx', mkl.MKL_CBWR_AVX2: 'avx2', + mkl.MKL_CBWR_AVX2 | mkl.MKL_CBWR_STRICT: 'avx2_strict', mkl.MKL_CBWR_AVX512_MIC: 'avx512_mic', + mkl.MKL_CBWR_AVX512_MIC | mkl.MKL_CBWR_STRICT: 'avx512_mic_strict', mkl.MKL_CBWR_AVX512: 'avx512', - mkl.MKL_CBWR_SUCCESS: 'success', + mkl.MKL_CBWR_AVX512 | mkl.MKL_CBWR_STRICT: 'avx512_strict', + mkl.MKL_CBWR_AVX512_MIC_E1: 'avx512_mic_e1', + mkl.MKL_CBWR_AVX512_E1: 'avx512_e1', + mkl.MKL_CBWR_AVX512_E1 | mkl.MKL_CBWR_STRICT: 'avx512_e1_strict', mkl.MKL_CBWR_ERR_INVALID_INPUT: 'err_invalid_input', }, } @@ -721,17 +726,26 @@ cdef object __cbwr_get_auto_branch(): """ __variables = { 'output': { + mkl.MKL_CBWR_OFF: 'off', + mkl.MKL_CBWR_BRANCH_OFF: 'branch_off', mkl.MKL_CBWR_AUTO: 'auto', mkl.MKL_CBWR_COMPATIBLE: 'compatible', mkl.MKL_CBWR_SSE2: 'sse2', - mkl.MKL_CBWR_SSE3: 'sse3', mkl.MKL_CBWR_SSSE3: 'ssse3', mkl.MKL_CBWR_SSE4_1: 'sse4_1', mkl.MKL_CBWR_SSE4_2: 'sse4_2', mkl.MKL_CBWR_AVX: 'avx', mkl.MKL_CBWR_AVX2: 'avx2', + mkl.MKL_CBWR_AVX2 | mkl.MKL_CBWR_STRICT: 'avx2_strict', mkl.MKL_CBWR_AVX512_MIC: 'avx512_mic', + mkl.MKL_CBWR_AVX512_MIC | mkl.MKL_CBWR_STRICT: 'avx512_mic_strict', mkl.MKL_CBWR_AVX512: 'avx512', + mkl.MKL_CBWR_AVX512 | mkl.MKL_CBWR_STRICT: 'avx512_strict', + mkl.MKL_CBWR_AVX512_MIC_E1: 'avx512_mic_e1', + mkl.MKL_CBWR_AVX512_E1: 'avx512_e1', + mkl.MKL_CBWR_AVX512_E1 | mkl.MKL_CBWR_STRICT: 'avx512_e1_strict', + mkl.MKL_CBWR_SUCCESS: 'success', + mkl.MKL_CBWR_ERR_INVALID_INPUT: 'err_invalid_input', }, } From 958da3744bc4be5077422ca2735b7c27b358cbd8 Mon Sep 17 00:00:00 2001 From: Dmitry Zagorny Date: Mon, 26 Aug 2019 21:11:42 -0500 Subject: [PATCH 02/16] Updated CBWR tests --- tests/test_mkl_service.py | 74 +++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/tests/test_mkl_service.py b/tests/test_mkl_service.py index c83c159..6fac56f 100644 --- a/tests/test_mkl_service.py +++ b/tests/test_mkl_service.py @@ -24,7 +24,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from nose.tools import nottest +from nose.tools import assert_equals, nottest import six import mkl @@ -193,48 +193,40 @@ def test_set_memory_limit(self): class test_conditional_numerical_reproducibility_control: # https://software.intel.com/en-us/mkl-developer-reference-c-conditional-numerical-reproducibility-control - def test_cbwr_set_off(self): - mkl.cbwr_set(branch='off') - - def test_cbwr_set_auto(self): - mkl.cbwr_set(branch='auto') - - def test_cbwr_set_compatible(self): - mkl.cbwr_set(branch='compatible') - - def test_cbwr_set_sse2(self): - mkl.cbwr_set(branch='sse2') - - def test_cbwr_set_sse3(self): - mkl.cbwr_set(branch='sse3') - - def test_cbwr_set_ssse3(self): - mkl.cbwr_set(branch='ssse3') - - def test_cbwr_set_sse4_1(self): - mkl.cbwr_set(branch='sse4_1') - - def test_cbwr_set_sse4_2(self): - mkl.cbwr_set(branch='sse4_2') - - def test_cbwr_set_avx(self): - mkl.cbwr_set(branch='avx') - - def test_cbwr_set_avx2(self): - mkl.cbwr_set(branch='avx2') - - def test_cbwr_set_avx512_mic(self): - mkl.cbwr_set(branch='avx512_mic') - - def test_cbwr_set_avx512(self): - mkl.cbwr_set(branch='avx512') - - def test_cbwr_get(self): + def test_cbwr(self): + branches = [ + 'off', + 'branch_off', + 'auto', + 'compatible', + 'sse2', + 'ssse3', + 'sse4_1', + 'sse4_2', + 'avx', + 'avx2', + 'avx2_strict', + 'avx512_mic', + 'avx512_mic_strict', + 'avx512', + 'avx512_strict', + 'avx512_mic_e1', + 'avx512_e1', + 'avx512_e1_strict', + ] + for branch in branches: + yield check_cbwr, branch + + def check_cbwr(self, branch): + status = mkl.cbwr_set(branch=branch) + if status == 'success': + assert_equals(mkl.cbwr_get(cnr_const='branch'), branch) + elif status != 'err_unsupported_branch': + raise AssertionError(status) + + def test_cbwr_get_all(self): mkl.cbwr_get(cnr_const='all') - def test_cbwr_get(self): - mkl.cbwr_get(cnr_const='branch') - def test_cbwr_get_auto_branch(self): mkl.cbwr_get_auto_branch() From c913b6ee55998feb47945810b5ea1480f148784e Mon Sep 17 00:00:00 2001 From: Dmitry Zagorny Date: Tue, 27 Aug 2019 08:26:14 -0500 Subject: [PATCH 03/16] Updated version --- conda-recipe/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 8c2996f..c3c1b11 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "2.1.0" %} +{% set version = "2.3.0" %} {% set buildnumber = 0 %} package: From 18088d2b733854759c4187ef850c767ab1daf6bc Mon Sep 17 00:00:00 2001 From: Dmitry Zagorny Date: Tue, 27 Aug 2019 08:27:03 -0500 Subject: [PATCH 04/16] Fixed check_cbwr call in tests --- tests/test_mkl_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_mkl_service.py b/tests/test_mkl_service.py index 6fac56f..fe3cf0c 100644 --- a/tests/test_mkl_service.py +++ b/tests/test_mkl_service.py @@ -215,7 +215,7 @@ def test_cbwr(self): 'avx512_e1_strict', ] for branch in branches: - yield check_cbwr, branch + yield self.check_cbwr, branch def check_cbwr(self, branch): status = mkl.cbwr_set(branch=branch) From 435813eb55358ffb0e1ae8af963ef88c7be470f2 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 27 Aug 2019 09:12:17 -0500 Subject: [PATCH 05/16] renamed CBWR keywords like avx2_strict to avx2,strict, etc. --- mkl/_mkl_service.pyx | 24 ++++++++++++------------ tests/test_mkl_service.py | 8 ++++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/mkl/_mkl_service.pyx b/mkl/_mkl_service.pyx index b3f4569..042803c 100644 --- a/mkl/_mkl_service.pyx +++ b/mkl/_mkl_service.pyx @@ -655,14 +655,14 @@ cdef object __cbwr_set(branch=None): 'sse4_2': mkl.MKL_CBWR_SSE4_2, 'avx': mkl.MKL_CBWR_AVX, 'avx2': mkl.MKL_CBWR_AVX2, - 'avx2_strict': mkl.MKL_CBWR_AVX2 | mkl.MKL_CBWR_STRICT, + 'avx2,strict': mkl.MKL_CBWR_AVX2 | mkl.MKL_CBWR_STRICT, 'avx512_mic': mkl.MKL_CBWR_AVX512_MIC, - 'avx512_mic_strict': mkl.MKL_CBWR_AVX512_MIC | mkl.MKL_CBWR_STRICT, + 'avx512_mic,strict': mkl.MKL_CBWR_AVX512_MIC | mkl.MKL_CBWR_STRICT, 'avx512': mkl.MKL_CBWR_AVX512, - 'avx512_strict': mkl.MKL_CBWR_AVX512 | mkl.MKL_CBWR_STRICT, + 'avx512,strict': mkl.MKL_CBWR_AVX512 | mkl.MKL_CBWR_STRICT, 'avx512_mic_e1': mkl.MKL_CBWR_AVX512_MIC_E1, 'avx512_e1': mkl.MKL_CBWR_AVX512_E1, - 'avx512_e1_strict': mkl.MKL_CBWR_AVX512_E1 | mkl.MKL_CBWR_STRICT, + 'avx512_e1,strict': mkl.MKL_CBWR_AVX512_E1 | mkl.MKL_CBWR_STRICT, }, 'output': { mkl.MKL_CBWR_SUCCESS: 'success', @@ -700,14 +700,14 @@ cdef inline __cbwr_get(cnr_const=None): mkl.MKL_CBWR_SSE4_2: 'sse4_2', mkl.MKL_CBWR_AVX: 'avx', mkl.MKL_CBWR_AVX2: 'avx2', - mkl.MKL_CBWR_AVX2 | mkl.MKL_CBWR_STRICT: 'avx2_strict', + mkl.MKL_CBWR_AVX2 | mkl.MKL_CBWR_STRICT: 'avx2,strict', mkl.MKL_CBWR_AVX512_MIC: 'avx512_mic', - mkl.MKL_CBWR_AVX512_MIC | mkl.MKL_CBWR_STRICT: 'avx512_mic_strict', + mkl.MKL_CBWR_AVX512_MIC | mkl.MKL_CBWR_STRICT: 'avx512_mic,strict', mkl.MKL_CBWR_AVX512: 'avx512', - mkl.MKL_CBWR_AVX512 | mkl.MKL_CBWR_STRICT: 'avx512_strict', + mkl.MKL_CBWR_AVX512 | mkl.MKL_CBWR_STRICT: 'avx512,strict', mkl.MKL_CBWR_AVX512_MIC_E1: 'avx512_mic_e1', mkl.MKL_CBWR_AVX512_E1: 'avx512_e1', - mkl.MKL_CBWR_AVX512_E1 | mkl.MKL_CBWR_STRICT: 'avx512_e1_strict', + mkl.MKL_CBWR_AVX512_E1 | mkl.MKL_CBWR_STRICT: 'avx512_e1,strict', mkl.MKL_CBWR_ERR_INVALID_INPUT: 'err_invalid_input', }, } @@ -736,14 +736,14 @@ cdef object __cbwr_get_auto_branch(): mkl.MKL_CBWR_SSE4_2: 'sse4_2', mkl.MKL_CBWR_AVX: 'avx', mkl.MKL_CBWR_AVX2: 'avx2', - mkl.MKL_CBWR_AVX2 | mkl.MKL_CBWR_STRICT: 'avx2_strict', + mkl.MKL_CBWR_AVX2 | mkl.MKL_CBWR_STRICT: 'avx2,strict', mkl.MKL_CBWR_AVX512_MIC: 'avx512_mic', - mkl.MKL_CBWR_AVX512_MIC | mkl.MKL_CBWR_STRICT: 'avx512_mic_strict', + mkl.MKL_CBWR_AVX512_MIC | mkl.MKL_CBWR_STRICT: 'avx512_mic,strict', mkl.MKL_CBWR_AVX512: 'avx512', - mkl.MKL_CBWR_AVX512 | mkl.MKL_CBWR_STRICT: 'avx512_strict', + mkl.MKL_CBWR_AVX512 | mkl.MKL_CBWR_STRICT: 'avx512,strict', mkl.MKL_CBWR_AVX512_MIC_E1: 'avx512_mic_e1', mkl.MKL_CBWR_AVX512_E1: 'avx512_e1', - mkl.MKL_CBWR_AVX512_E1 | mkl.MKL_CBWR_STRICT: 'avx512_e1_strict', + mkl.MKL_CBWR_AVX512_E1 | mkl.MKL_CBWR_STRICT: 'avx512_e1,strict', mkl.MKL_CBWR_SUCCESS: 'success', mkl.MKL_CBWR_ERR_INVALID_INPUT: 'err_invalid_input', }, diff --git a/tests/test_mkl_service.py b/tests/test_mkl_service.py index fe3cf0c..56ac538 100644 --- a/tests/test_mkl_service.py +++ b/tests/test_mkl_service.py @@ -205,14 +205,14 @@ def test_cbwr(self): 'sse4_2', 'avx', 'avx2', - 'avx2_strict', + 'avx2,strict', 'avx512_mic', - 'avx512_mic_strict', + 'avx512_mic,strict', 'avx512', - 'avx512_strict', + 'avx512,strict', 'avx512_mic_e1', 'avx512_e1', - 'avx512_e1_strict', + 'avx512_e1,strict', ] for branch in branches: yield self.check_cbwr, branch From 3acad322c15a979f1db52fa09195ee82c4f4a28b Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 27 Aug 2019 09:12:44 -0500 Subject: [PATCH 06/16] nose takes a path to tests, so added source_files and changed the call to nose --- conda-recipe/meta.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index c3c1b11..1e27225 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -28,12 +28,14 @@ requirements: - six test: - commands: - - nosetests -v mkl requires: - nose imports: - mkl + commands: + - nosetests -v tests + source_files: + - tests about: home: http://github.com/IntelPython/mkl-service From 45f6ed5f19dbc07b27adb6af5292a999c2c8bce7 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 27 Aug 2019 10:24:21 -0500 Subject: [PATCH 07/16] all classes are defined as class test_class_name(): --- tests/test_mkl_service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_mkl_service.py b/tests/test_mkl_service.py index 56ac538..154f2b8 100644 --- a/tests/test_mkl_service.py +++ b/tests/test_mkl_service.py @@ -131,7 +131,7 @@ def test_get_dynamic(self): mkl.get_dynamic() -class test_timing: +class test_timing(): # https://software.intel.com/en-us/mkl-developer-reference-c-timing def test_second(self): s1 = mkl.second() @@ -191,7 +191,7 @@ def test_set_memory_limit(self): mkl.set_memory_limit(128) -class test_conditional_numerical_reproducibility_control: +class test_conditional_numerical_reproducibility_control(): # https://software.intel.com/en-us/mkl-developer-reference-c-conditional-numerical-reproducibility-control def test_cbwr(self): branches = [ From f1d27d9fcf0e263d2903f67ce86d1584758843d5 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 27 Aug 2019 13:41:23 -0500 Subject: [PATCH 08/16] branch='off' is command to turn CNR mode off, while branch_off is status reflecting that it is off See https://software.intel.com/en-us/mkl-developer-reference-c-named-constants-for-cnr-control Hence, `mkl.cbwr_set('branch_off')` now raises an exception, and the test is modified to query cnr_const='all' to allow cbwr_get to also see strict flag. --- mkl/_mkl_service.pyx | 2 -- 1 file changed, 2 deletions(-) diff --git a/mkl/_mkl_service.pyx b/mkl/_mkl_service.pyx index 042803c..e0fed16 100644 --- a/mkl/_mkl_service.pyx +++ b/mkl/_mkl_service.pyx @@ -646,7 +646,6 @@ cdef object __cbwr_set(branch=None): __variables = { 'input': { 'off': mkl.MKL_CBWR_OFF, - 'branch_off': mkl.MKL_CBWR_BRANCH_OFF, 'auto': mkl.MKL_CBWR_AUTO, 'compatible': mkl.MKL_CBWR_COMPATIBLE, 'sse2': mkl.MKL_CBWR_SSE2, @@ -690,7 +689,6 @@ cdef inline __cbwr_get(cnr_const=None): 'all': mkl.MKL_CBWR_ALL, }, 'output': { - mkl.MKL_CBWR_OFF: 'off', mkl.MKL_CBWR_BRANCH_OFF: 'branch_off', mkl.MKL_CBWR_AUTO: 'auto', mkl.MKL_CBWR_COMPATIBLE: 'compatible', From 933617ff15569ff997729d48ce62b63af226a9b3 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 27 Aug 2019 13:44:31 -0500 Subject: [PATCH 09/16] Changed test for round-trip of CBWR get/set Using cbwr_get('off'), we should expect the status 'branch_off' be returned per https://software.intel.com/en-us/mkl-developer-reference-c-named-constants-for-cnr-control --- tests/test_mkl_service.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_mkl_service.py b/tests/test_mkl_service.py index 154f2b8..fe6a0e7 100644 --- a/tests/test_mkl_service.py +++ b/tests/test_mkl_service.py @@ -196,7 +196,6 @@ class test_conditional_numerical_reproducibility_control(): def test_cbwr(self): branches = [ 'off', - 'branch_off', 'auto', 'compatible', 'sse2', @@ -220,7 +219,9 @@ def test_cbwr(self): def check_cbwr(self, branch): status = mkl.cbwr_set(branch=branch) if status == 'success': - assert_equals(mkl.cbwr_get(cnr_const='branch'), branch) + expected_value = 'branch_off' if branch == 'off' else branch + actual_value = mkl.cbwr_get(cnr_const='all') + assert_equals(actual_value, expected_value, msg="Round-trip failure for CNR branch '{}'".format(branch)) elif status != 'err_unsupported_branch': raise AssertionError(status) From 1eba8cfa5ff3657b0e697b245ab0e1020fffcf08 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 27 Aug 2019 14:49:51 -0500 Subject: [PATCH 10/16] restored support for 'branch_off' in cbwr_set --- mkl/_mkl_service.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/mkl/_mkl_service.pyx b/mkl/_mkl_service.pyx index e0fed16..dad9823 100644 --- a/mkl/_mkl_service.pyx +++ b/mkl/_mkl_service.pyx @@ -646,6 +646,7 @@ cdef object __cbwr_set(branch=None): __variables = { 'input': { 'off': mkl.MKL_CBWR_OFF, + 'branch_off': mkl.MKL_CBWR_BRANCH_OFF, 'auto': mkl.MKL_CBWR_AUTO, 'compatible': mkl.MKL_CBWR_COMPATIBLE, 'sse2': mkl.MKL_CBWR_SSE2, From 213036a91432b02024ff2578917d37b2f8dc5d2b Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 27 Aug 2019 14:50:53 -0500 Subject: [PATCH 11/16] MKL 2019.3 or later is required for strict CNR mode --- conda-recipe/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 1e27225..b3ab53f 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -20,11 +20,11 @@ requirements: host: - python - setuptools - - mkl-devel + - mkl-devel >=2019.3 - cython run: - python - - mkl + - mkl >=2019.3 - six test: From abd5222727fad3307f792e06ed9df2221d341fd9 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Tue, 27 Aug 2019 14:51:41 -0500 Subject: [PATCH 12/16] added 2.3.0-specific notes to CHANGES.rst --- CHANGES.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index d242b47..4a6cf84 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -49,3 +49,9 @@ Closed issues #8, #7 and #5. Extended `mkl.cbwr_set` to recognize `'avx512_e1'`, `'avx512_mic_e1'`, as as strict conditional numerical reproducibility, supported via `'avx2,strict'`, `'avx512,strict'` (see [issue/8](http://github.com/IntelPython/mkl-service/issues/8)). Extended `mkl.cbwrt_get()` to mean `mkl.cbwr('all')`. + +2.3.0 +===== + +Fixed CI to actually execute tests. Populated CBWR constants to match MKL headers. +Added tests checking that `cbwr_set` and `cbwr_get` round-trip. From 8e31197cd381aeafd8486f11789f983e36d2848c Mon Sep 17 00:00:00 2001 From: Dmitrii <47787550+dmitrii-zagornyi@users.noreply.github.com> Date: Tue, 27 Aug 2019 23:21:57 +0300 Subject: [PATCH 13/16] Removed MKL_CBWR_OFF from cbwr_get_auto_branch --- mkl/_mkl_service.pyx | 1 - 1 file changed, 1 deletion(-) diff --git a/mkl/_mkl_service.pyx b/mkl/_mkl_service.pyx index dad9823..b375fd6 100644 --- a/mkl/_mkl_service.pyx +++ b/mkl/_mkl_service.pyx @@ -725,7 +725,6 @@ cdef object __cbwr_get_auto_branch(): """ __variables = { 'output': { - mkl.MKL_CBWR_OFF: 'off', mkl.MKL_CBWR_BRANCH_OFF: 'branch_off', mkl.MKL_CBWR_AUTO: 'auto', mkl.MKL_CBWR_COMPATIBLE: 'compatible', From 139d9d24c050ba569aa0eddf5ee6cf5bde0dc60c Mon Sep 17 00:00:00 2001 From: Dmitrii <47787550+dmitrii-zagornyi@users.noreply.github.com> Date: Wed, 28 Aug 2019 00:32:14 +0300 Subject: [PATCH 14/16] Restored support for 'branch_off' in test_cbwr --- tests/test_mkl_service.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_mkl_service.py b/tests/test_mkl_service.py index fe6a0e7..6f9d21d 100644 --- a/tests/test_mkl_service.py +++ b/tests/test_mkl_service.py @@ -196,6 +196,7 @@ class test_conditional_numerical_reproducibility_control(): def test_cbwr(self): branches = [ 'off', + 'branch_off', 'auto', 'compatible', 'sse2', From ab7baf8c63015b4276f3fe6b9aa47212656d0b5e Mon Sep 17 00:00:00 2001 From: Dmitrii <47787550+dmitrii-zagornyi@users.noreply.github.com> Date: Wed, 28 Aug 2019 11:47:00 +0300 Subject: [PATCH 15/16] Extended test coverage for `cbwr_get` --- tests/test_mkl_service.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/test_mkl_service.py b/tests/test_mkl_service.py index 6f9d21d..bd6a785 100644 --- a/tests/test_mkl_service.py +++ b/tests/test_mkl_service.py @@ -205,30 +205,33 @@ def test_cbwr(self): 'sse4_2', 'avx', 'avx2', - 'avx2,strict', 'avx512_mic', - 'avx512_mic,strict', 'avx512', - 'avx512,strict', 'avx512_mic_e1', 'avx512_e1', + ] + strict = [ + 'avx2,strict', + 'avx512_mic,strict', + 'avx512,strict', 'avx512_e1,strict', ] for branch in branches: - yield self.check_cbwr, branch + yield self.check_cbwr, branch, 'branch' + for branch in branches + strict: + yield self.check_cbwr, branch, 'all' - def check_cbwr(self, branch): + def check_cbwr(self, branch, cnr_const): status = mkl.cbwr_set(branch=branch) if status == 'success': expected_value = 'branch_off' if branch == 'off' else branch - actual_value = mkl.cbwr_get(cnr_const='all') - assert_equals(actual_value, expected_value, msg="Round-trip failure for CNR branch '{}'".format(branch)) + actual_value = mkl.cbwr_get(cnr_const=cnr_const) + assert_equals(actual_value, + expected_value, + msg="Round-trip failure for CNR branch '{}', CNR const '{}'".format(branch, cnr_const)) elif status != 'err_unsupported_branch': raise AssertionError(status) - def test_cbwr_get_all(self): - mkl.cbwr_get(cnr_const='all') - def test_cbwr_get_auto_branch(self): mkl.cbwr_get_auto_branch() From 00ec43de092cdadf59cbd330d79b9c3e19fe4da7 Mon Sep 17 00:00:00 2001 From: Dmitrii <47787550+dmitrii-zagornyi@users.noreply.github.com> Date: Wed, 28 Aug 2019 12:13:48 +0300 Subject: [PATCH 16/16] Changed CNR test class name to abbreviation --- tests/test_mkl_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_mkl_service.py b/tests/test_mkl_service.py index bd6a785..8c9d2b4 100644 --- a/tests/test_mkl_service.py +++ b/tests/test_mkl_service.py @@ -191,7 +191,7 @@ def test_set_memory_limit(self): mkl.set_memory_limit(128) -class test_conditional_numerical_reproducibility_control(): +class test_cnr_control(): # https://software.intel.com/en-us/mkl-developer-reference-c-conditional-numerical-reproducibility-control def test_cbwr(self): branches = [