Skip to content

Commit d6cc7b2

Browse files
Added mkl_cbwr_get funcion
1 parent 7d61aa0 commit d6cc7b2

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

mkl-service/_mkl_service.pxd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ cdef extern from "mkl.h":
4343
int MKL_CBWR_ERR_UNSUPPORTED_BRANCH
4444
int MKL_CBWR_ERR_MODE_CHANGE_FAILURE
4545

46+
# int mkl_cbwr_get(int option)
47+
# In
48+
int MKL_CBWR_BRANCH
49+
int MKL_CBWR_ALL
50+
4651
# int mkl_enable_instructions(int isa)
4752
# In
4853
int MKL_ENABLE_AVX512
@@ -117,6 +122,7 @@ cdef extern from "mkl.h":
117122

118123
# Conditional Numerical Reproducibility
119124
int mkl_cbwr_set(int settings)
125+
int mkl_cbwr_get(int option)
120126
int mkl_cbwr_get_auto_branch()
121127

122128
# Miscellaneous

mkl-service/_mkl_service.pyx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ MKL_CBWR_ERR_INVALID_INPUT = mkl.MKL_CBWR_ERR_INVALID_INPUT
3131
MKL_CBWR_ERR_UNSUPPORTED_BRANCH = mkl.MKL_CBWR_ERR_UNSUPPORTED_BRANCH
3232
MKL_CBWR_ERR_MODE_CHANGE_FAILURE = mkl.MKL_CBWR_ERR_MODE_CHANGE_FAILURE
3333

34+
# int mkl_cbwr_get(int option)
35+
# In
36+
MKL_CBWR_BRANCH = mkl.MKL_CBWR_BRANCH
37+
MKL_CBWR_ALL = mkl.MKL_CBWR_ALL
38+
3439
# int mkl_enable_instructions(int isa)
3540
# In
3641
MKL_ENABLE_AVX512 = mkl.MKL_ENABLE_AVX512
@@ -197,11 +202,14 @@ def mkl_set_memory_limit(mem_type, limit):
197202
'''
198203
#Conditional Numerical Reproducibility
199204
int mkl_cbwr_set(int settings)
205+
int mkl_cbwr_get()
200206
int mkl_cbwr_get_auto_branch()
201207
'''
202208
def mkl_cbwr_set(settings):
203209
return mkl.mkl_cbwr_set(settings)
204210

211+
def mkl_cbwr_get(option):
212+
return mkl.mkl_cbwr_get(option)
205213

206214
def mkl_cbwr_get_auto_branch():
207215
return mkl.mkl_cbwr_get_auto_branch()
@@ -222,9 +230,9 @@ def mkl_set_env_mode(mode):
222230
return mkl.mkl_set_env_mode(mode)
223231

224232

225-
def mkl_verbose(isEnabled):
226-
assert(type(isEnabled) is bool)
227-
return mkl.mkl_verbose(isEnabled)
233+
def mkl_verbose(enable):
234+
assert(type(enable) is bool)
235+
return mkl.mkl_verbose(enable)
228236

229237

230238
def mkl_set_mpi(vendor, custom_library_name):

mkl-service/tests/test_mkl_service.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ class test_conditional_numerical_reproducibility_control:
9090
def test_mkl_cbwr_set(self):
9191
mkl_service.mkl_cbwr_set(mkl_service.MKL_CBWR_AUTO)
9292

93+
def test_mkl_cbwr_get(self):
94+
mkl_service.mkl_cbwr_get(mkl_service.MKL_CBWR_ALL)
95+
9396
def test_mkl_cbwr_get_auto_branch(self):
9497
mkl_service.mkl_cbwr_get_auto_branch()
9598

@@ -103,7 +106,7 @@ def test_mkl_set_env_mode(self):
103106
mkl_service.mkl_set_env_mode(0)
104107

105108
def test_mkl_verbose(self):
106-
mkl_service.mkl_verbose(0)
109+
mkl_service.mkl_verbose(False)
107110

108111
def test_mkl_set_mpi(self):
109112
mkl_service.mkl_set_mpi(1, 'test')

0 commit comments

Comments
 (0)