25
25
26
26
27
27
cimport _mkl_service as mkl
28
+ import six
28
29
29
30
30
31
# Version Information
@@ -318,7 +319,7 @@ cdef inline __mkl_str_to_int(variable, possible_variables_dict):
318
319
319
320
cdef inline __mkl_int_to_str(mkl_int_variable, possible_variables_dict):
320
321
assert (mkl_int_variable is not None )
321
- assert (type (mkl_int_variable) is int )
322
+ assert (isinstance (mkl_int_variable, six.integer_types) )
322
323
assert (possible_variables_dict is not None )
323
324
assert (mkl_int_variable in possible_variables_dict.keys()), ' Variable: <' + str (mkl_int_variable) + ' > not in ' + str (possible_variables_dict)
324
325
@@ -353,11 +354,11 @@ cdef inline __set_num_threads(num_threads):
353
354
Specifies the number of OpenMP* threads to use.
354
355
https://software.intel.com/en-us/mkl-developer-reference-c-mkl-set-num-threads
355
356
"""
356
- assert (type (num_threads) is int )
357
+ assert (isinstance (num_threads, six.integer_types) )
357
358
assert (num_threads > 0 )
358
359
359
360
prev_num_threads = __get_max_threads()
360
- assert (type (prev_num_threads) is int )
361
+ assert (isinstance (prev_num_threads, six.integer_types) )
361
362
assert (prev_num_threads > 0 )
362
363
363
364
mkl.mkl_set_num_threads(num_threads)
@@ -383,7 +384,7 @@ cdef inline __domain_set_num_threads(num_threads, domain):
383
384
1 : ' success' ,
384
385
},
385
386
}
386
- assert (type (num_threads) is int )
387
+ assert (isinstance (num_threads, six.integer_types) )
387
388
assert (num_threads >= 0 )
388
389
mkl_domain = __mkl_str_to_int(domain, __variables[' input' ])
389
390
@@ -398,7 +399,7 @@ cdef inline __set_num_threads_local(num_threads):
398
399
Specifies the number of OpenMP* threads for all Intel MKL functions on the current execution thread.
399
400
https://software.intel.com/en-us/mkl-developer-reference-c-mkl-set-num-threads-local
400
401
"""
401
- assert (type (num_threads) is int )
402
+ assert (isinstance (num_threads, six.integer_types) )
402
403
assert (num_threads >= 0 )
403
404
404
405
status = mkl.mkl_set_num_threads_local(num_threads)
@@ -432,7 +433,7 @@ cdef inline __get_max_threads():
432
433
"""
433
434
num_threads = mkl.mkl_get_max_threads()
434
435
435
- assert (type (num_threads) is int )
436
+ assert (isinstance (num_threads, six.integer_types) )
436
437
assert (num_threads >= 1 )
437
438
return num_threads
438
439
@@ -456,7 +457,7 @@ cdef inline __domain_get_max_threads(domain='all'):
456
457
457
458
num_threads = mkl.mkl_domain_get_max_threads(mkl_domain)
458
459
459
- assert (type (num_threads) is int )
460
+ assert (isinstance (num_threads, six.integer_types) )
460
461
assert (num_threads >= 1 )
461
462
return num_threads
462
463
@@ -581,7 +582,7 @@ cdef inline __peak_mem_usage(mem_const):
581
582
582
583
memory_allocator = mkl.mkl_peak_mem_usage(mkl_mem_const)
583
584
584
- assert (type (memory_allocator) is int )
585
+ assert (isinstance (memory_allocator, six.integer_types) )
585
586
assert (memory_allocator >= - 1 )
586
587
if memory_allocator == - 1 :
587
588
memory_allocator = ' error'
0 commit comments