Skip to content

Commit 1065f4c

Browse files
committed
Improve warning
1 parent f935eb7 commit 1065f4c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
### Version 0.9.2
22

33
* Explicit check for interface env MKL_INTERFACE_LAYER and interface selection in python.
4+
Will raise a RuntimeWarning if ILP64 is requested but the 64-bit interface layer is unavailable.
5+
Note that the MKL_INTERFACE_LAYER env must be set before this package is imported.
46

57
### Version 0.9.1
68

sparse_dot_mkl/_mkl_interface/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,24 @@ def _empirical_set_dtype():
108108

109109
# Check to make sure that the MKL_Set_Interface_Layer call was correct
110110
# And fail back to 32bit if it wasn't
111-
if MKL.MKL_INT is None and _mkl_interface_env == 'ILP64':
111+
if _mkl_interface_env == 'ILP64':
112112
try:
113113
_validate_dtype()
114114
except (ValueError, RuntimeError):
115115
_warnings.warn(
116116
"MKL_INTERFACE_LAYER=ILP64 failed to set MKL interface; "
117-
"64-bit integer support unavailable"
117+
"64-bit integer support unavailable",
118+
RuntimeWarning
118119
)
119120
MKL._set_int_type(_ctypes.c_int, _np.int32)
120121
_validate_dtype()
121-
elif MKL.MKL_INT is None and _mkl_interface_env == 'LP64':
122+
elif _mkl_interface_env == 'LP64':
122123
_validate_dtype()
123124
elif MKL.MKL_INT is None and _mkl_interface_env is not None:
124125
_warnings.warn(
125126
f"MKL_INTERFACE_LAYER value {_mkl_interface_env} invalid; "
126-
"set 'ILP64' or 'LP64'"
127+
"set 'ILP64' or 'LP64'",
128+
RuntimeWarning
127129
)
128130
_empirical_set_dtype()
129131
elif MKL.MKL_INT is None:

0 commit comments

Comments
 (0)