24
24
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
25
26
26
27
- cimport _mkl_service as mkl
28
27
import six
28
+ cimport _mkl_service as mkl
29
29
30
30
31
31
# Version Information
@@ -260,7 +260,7 @@ cpdef verbose(enable):
260
260
return __verbose(enable)
261
261
262
262
263
- cpdef set_mpi(vendor, custom_library_name):
263
+ cpdef set_mpi(vendor, custom_library_name = None ):
264
264
"""
265
265
Sets the implementation of the message-passing interface to be used by Intel MKL.
266
266
https://software.intel.com/en-us/mkl-developer-reference-c-mkl-set-mpi
@@ -617,6 +617,7 @@ cdef inline __cbwr_set(branch=None):
617
617
"""
618
618
__variables = {
619
619
' input' : {
620
+ ' off' : mkl.MKL_CBWR_BRANCH_OFF,
620
621
' auto' : mkl.MKL_CBWR_AUTO,
621
622
' compatible' : mkl.MKL_CBWR_COMPATIBLE,
622
623
' sse2' : mkl.MKL_CBWR_SSE2,
@@ -655,6 +656,7 @@ cdef inline __cbwr_get(cnr_const=None):
655
656
' all' : mkl.MKL_CBWR_ALL,
656
657
},
657
658
' output' : {
659
+ mkl.MKL_CBWR_BRANCH_OFF: ' off' ,
658
660
mkl.MKL_CBWR_AUTO: ' auto' ,
659
661
mkl.MKL_CBWR_COMPATIBLE: ' compatible' ,
660
662
mkl.MKL_CBWR_SSE2: ' sse2' ,
@@ -667,7 +669,6 @@ cdef inline __cbwr_get(cnr_const=None):
667
669
mkl.MKL_CBWR_AVX512_MIC: ' avx512_mic' ,
668
670
mkl.MKL_CBWR_AVX512: ' avx512' ,
669
671
mkl.MKL_CBWR_SUCCESS: ' success' ,
670
- mkl.MKL_CBWR_BRANCH_OFF: ' branch_off' ,
671
672
mkl.MKL_CBWR_ERR_INVALID_INPUT: ' err_invalid_input' ,
672
673
},
673
674
}
@@ -780,7 +781,7 @@ cdef inline __verbose(enable):
780
781
return bool (mkl.mkl_verbose(enable))
781
782
782
783
783
- cdef inline __set_mpi(vendor, custom_library_name):
784
+ cdef inline __set_mpi(vendor, custom_library_name = None ):
784
785
"""
785
786
Sets the implementation of the message-passing interface to be used by Intel MKL.
786
787
https://software.intel.com/en-us/mkl-developer-reference-c-mkl-set-mpi
@@ -799,10 +800,15 @@ cdef inline __set_mpi(vendor, custom_library_name):
799
800
- 3 : ' MPI library cannot be set at this point' ,
800
801
},
801
802
}
803
+ assert ((vendor is not ' custom' and custom_library_name is None ) or
804
+ (vendor is ' custom' and custom_library_name is not None ))
802
805
mkl_vendor = __mkl_str_to_int(vendor, __variables[' input' ])
803
806
804
- cdef bytes c_bytes = custom_library_name.encode()
805
- cdef char * c_string = c_bytes
807
+ cdef bytes c_bytes
808
+ cdef char * c_string = ' '
809
+ if custom_library_name is not None :
810
+ c_bytes = custom_library_name.encode()
811
+ c_string = c_bytes
806
812
mkl_status = mkl.mkl_set_mpi(mkl_vendor, c_string)
807
813
808
814
status = __mkl_int_to_str(mkl_status, __variables[' output' ])
0 commit comments