|
24 | 24 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
25 | 25 |
|
26 | 26 |
|
27 |
| -from nose.tools import nottest |
| 27 | +from nose.tools import assert_equals, nottest |
28 | 28 | import six
|
29 | 29 | import mkl
|
30 | 30 |
|
@@ -193,48 +193,40 @@ def test_set_memory_limit(self):
|
193 | 193 |
|
194 | 194 | class test_conditional_numerical_reproducibility_control:
|
195 | 195 | # 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): |
233 | 228 | mkl.cbwr_get(cnr_const='all')
|
234 | 229 |
|
235 |
| - def test_cbwr_get(self): |
236 |
| - mkl.cbwr_get(cnr_const='branch') |
237 |
| - |
238 | 230 | def test_cbwr_get_auto_branch(self):
|
239 | 231 | mkl.cbwr_get_auto_branch()
|
240 | 232 |
|
|
0 commit comments