@@ -102,9 +102,9 @@ cpdef domain_set_num_threads(num_threads, domain='all'):
102
102
__check_positive_num_threads(c_num_threads, ' domain_set_num_threads' )
103
103
104
104
cdef int c_mkl_domain = __domain_to_mkl_domain(domain)
105
- cdef int mkl_status = __domain_set_num_threads(c_num_threads, c_mkl_domain)
105
+ cdef int c_mkl_status = __domain_set_num_threads(c_num_threads, c_mkl_domain)
106
106
107
- return __mkl_status_to_string(mkl_status )
107
+ return __mkl_status_to_string(c_mkl_status )
108
108
109
109
110
110
cpdef set_num_threads_local(num_threads):
@@ -598,7 +598,7 @@ cdef inline MemStatData __mem_stat():
598
598
return mem_stat_data
599
599
600
600
601
- cdef inline __peak_mem_usage(mem_const):
601
+ cdef object __peak_mem_usage(mem_const):
602
602
"""
603
603
Reports the peak memory allocated by the Intel(R) MKL Memory Allocator.
604
604
https://software.intel.com/en-us/mkl-developer-reference-c-mkl-peak-mem-usage
@@ -622,7 +622,7 @@ cdef inline __peak_mem_usage(mem_const):
622
622
return memory_allocator
623
623
624
624
625
- cdef inline __set_memory_limit(limit):
625
+ cdef inline object __set_memory_limit(limit):
626
626
"""
627
627
On Linux, sets the limit of memory that Intel(R) MKL can allocate for a specified type of memory.
628
628
https://software.intel.com/en-us/mkl-developer-reference-c-mkl-set-memory-limit
@@ -634,7 +634,7 @@ cdef inline __set_memory_limit(limit):
634
634
635
635
636
636
# Conditional Numerical Reproducibility
637
- cdef inline __cbwr_set(branch = None ):
637
+ cdef object __cbwr_set(branch = None ):
638
638
"""
639
639
Configures the CNR mode of Intel(R) MKL.
640
640
https://software.intel.com/en-us/mkl-developer-reference-c-mkl-cbwr-set
@@ -704,13 +704,12 @@ cdef inline __cbwr_get(cnr_const=None):
704
704
return status
705
705
706
706
707
- cdef inline __cbwr_get_auto_branch():
707
+ cdef object __cbwr_get_auto_branch():
708
708
"""
709
709
Automatically detects the CNR code branch for your platform.
710
710
https://software.intel.com/en-us/mkl-developer-reference-c-mkl-cbwr-get-auto-branch
711
711
"""
712
712
__variables = {
713
- ' input' : None ,
714
713
' output' : {
715
714
mkl.MKL_CBWR_AUTO: ' auto' ,
716
715
mkl.MKL_CBWR_COMPATIBLE: ' compatible' ,
@@ -733,7 +732,7 @@ cdef inline __cbwr_get_auto_branch():
733
732
734
733
735
734
# Miscellaneous
736
- cdef inline __enable_instructions(isa = None ):
735
+ cdef object __enable_instructions(isa = None ):
737
736
"""
738
737
Enables dispatching for new Intel architectures or restricts the set of Intel instruction sets available for dispatching.
739
738
https://software.intel.com/en-us/mkl-developer-reference-c-mkl-enable-instructions
@@ -747,20 +746,15 @@ cdef inline __enable_instructions(isa=None):
747
746
' avx' : mkl.MKL_ENABLE_AVX,
748
747
' sse4_2' : mkl.MKL_ENABLE_SSE4_2,
749
748
},
750
- ' output' : {
751
- 0 : ' error' ,
752
- 1 : ' success' ,
753
- },
754
749
}
755
- mkl_isa = __mkl_str_to_int(isa, __variables[' input' ])
750
+ cdef int c_mkl_isa = __mkl_str_to_int(isa, __variables[' input' ])
756
751
757
- mkl_status = mkl.mkl_enable_instructions(mkl_isa)
758
-
759
- status = __mkl_int_to_str(mkl_status, __variables[' output' ])
760
- return status
752
+ cdef int c_mkl_status = mkl.mkl_enable_instructions(c_mkl_isa)
753
+
754
+ return __mkl_status_to_string(c_mkl_status)
761
755
762
756
763
- cdef inline __set_env_mode():
757
+ cdef object __set_env_mode():
764
758
"""
765
759
Sets up the mode that ignores environment settings specific to Intel(R) MKL. See mkl_set_env_mode(1).
766
760
https://software.intel.com/en-us/mkl-developer-reference-c-mkl-set-env-mode
@@ -772,27 +766,26 @@ cdef inline __set_env_mode():
772
766
1 : ' ignore' ,
773
767
},
774
768
}
775
- mkl_status = mkl.mkl_set_env_mode(1 )
769
+ cdef int c_mkl_status = mkl.mkl_set_env_mode(1 )
776
770
777
- status = __mkl_int_to_str(mkl_status , __variables[' output' ])
771
+ status = __mkl_int_to_str(c_mkl_status , __variables[' output' ])
778
772
return status
779
773
780
774
781
- cdef inline __get_env_mode():
775
+ cdef object __get_env_mode():
782
776
"""
783
777
Query the current environment mode. See mkl_set_env_mode(0).
784
778
https://software.intel.com/en-us/mkl-developer-reference-c-mkl-set-env-mode
785
779
"""
786
780
__variables = {
787
- ' input' : None ,
788
781
' output' : {
789
782
0 : ' default' ,
790
783
1 : ' ignore' ,
791
784
},
792
785
}
793
- mkl_status = mkl.mkl_set_env_mode(0 )
786
+ cdef int c_mkl_status = mkl.mkl_set_env_mode(0 )
794
787
795
- status = __mkl_int_to_str(mkl_status , __variables[' output' ])
788
+ status = __mkl_int_to_str(c_mkl_status , __variables[' output' ])
796
789
return status
797
790
798
791
@@ -842,7 +835,7 @@ cdef __set_mpi(vendor, custom_library_name=None):
842
835
843
836
844
837
# VM Service Functions
845
- cdef inline __vml_set_mode(accuracy, ftzdaz, errmode):
838
+ cdef object __vml_set_mode(accuracy, ftzdaz, errmode):
846
839
"""
847
840
Sets a new mode for VM functions according to the mode parameter and stores the previous VM mode to oldmode.
848
841
https://software.intel.com/en-us/mkl-developer-reference-c-vmlsetmode
@@ -888,25 +881,31 @@ cdef inline __vml_set_mode(accuracy, ftzdaz, errmode):
888
881
},
889
882
},
890
883
}
891
- mkl_accuracy = __mkl_str_to_int(accuracy, __variables[' input' ][' accuracy' ])
892
- mkl_ftzdaz = __mkl_str_to_int(ftzdaz, __variables[' input' ][' ftzdaz' ])
893
- mkl_errmode = __mkl_str_to_int(errmode, __variables[' input' ][' errmode' ])
884
+ cdef int c_mkl_accuracy = __mkl_str_to_int(accuracy, __variables[' input' ][' accuracy' ])
885
+ cdef int c_mkl_ftzdaz = __mkl_str_to_int(ftzdaz, __variables[' input' ][' ftzdaz' ])
886
+ cdef int c_mkl_errmode = __mkl_str_to_int(errmode, __variables[' input' ][' errmode' ])
887
+
888
+ cdef int c_mkl_status = mkl.vmlSetMode(c_mkl_accuracy | c_mkl_ftzdaz | c_mkl_errmode)
894
889
895
- status = mkl.vmlSetMode(mkl_accuracy | mkl_ftzdaz | mkl_errmode)
890
+ accuracy = __mkl_int_to_str(
891
+ c_mkl_status & mkl.VML_ACCURACY_MASK,
892
+ __variables[' output' ][' accuracy' ])
893
+ ftzdaz = __mkl_int_to_str(
894
+ c_mkl_status & mkl.VML_FTZDAZ_MASK,
895
+ __variables[' output' ][' ftzdaz' ])
896
+ errmode = __mkl_int_to_str(
897
+ c_mkl_status & mkl.VML_ERRMODE_MASK,
898
+ __variables[' output' ][' errmode' ])
896
899
897
- accuracy = __mkl_int_to_str(status & mkl.VML_ACCURACY_MASK, __variables[' output' ][' accuracy' ])
898
- ftzdaz = __mkl_int_to_str(status & mkl.VML_FTZDAZ_MASK, __variables[' output' ][' ftzdaz' ])
899
- errmode = __mkl_int_to_str(status & mkl.VML_ERRMODE_MASK, __variables[' output' ][' errmode' ])
900
- return accuracy, ftzdaz, errmode
900
+ return (accuracy, ftzdaz, errmode)
901
901
902
902
903
- cdef inline __vml_get_mode():
903
+ cdef object __vml_get_mode():
904
904
"""
905
905
Gets the VM mode.
906
906
https://software.intel.com/en-us/mkl-developer-reference-c-vmlgetmode
907
907
"""
908
908
__variables = {
909
- ' input' : None ,
910
909
' output' : {
911
910
' accuracy' : {
912
911
mkl.VML_HA: ' ha' ,
@@ -929,12 +928,18 @@ cdef inline __vml_get_mode():
929
928
},
930
929
}
931
930
932
- status = mkl.vmlGetMode()
931
+ cdef int c_mkl_status = mkl.vmlGetMode()
933
932
934
- accuracy = __mkl_int_to_str(status & mkl.VML_ACCURACY_MASK, __variables[' output' ][' accuracy' ])
935
- ftzdaz = __mkl_int_to_str(status & mkl.VML_FTZDAZ_MASK, __variables[' output' ][' ftzdaz' ])
936
- errmode = __mkl_int_to_str(status & mkl.VML_ERRMODE_MASK, __variables[' output' ][' errmode' ])
937
- return accuracy, ftzdaz, errmode
933
+ accuracy = __mkl_int_to_str(
934
+ c_mkl_status & mkl.VML_ACCURACY_MASK,
935
+ __variables[' output' ][' accuracy' ])
936
+ ftzdaz = __mkl_int_to_str(
937
+ c_mkl_status & mkl.VML_FTZDAZ_MASK,
938
+ __variables[' output' ][' ftzdaz' ])
939
+ errmode = __mkl_int_to_str(
940
+ c_mkl_status & mkl.VML_ERRMODE_MASK,
941
+ __variables[' output' ][' errmode' ])
942
+ return (accuracy, ftzdaz, errmode)
938
943
939
944
940
945
__mkl_vml_status = {
@@ -949,7 +954,7 @@ __mkl_vml_status = {
949
954
}
950
955
951
956
952
- cdef inline __vml_set_err_status(status):
957
+ cdef object __vml_set_err_status(status):
953
958
"""
954
959
Sets the new VM Error Status according to err and stores the previous VM Error Status to olderr.
955
960
https://software.intel.com/en-us/mkl-developer-reference-c-vmlseterrstatus
@@ -976,15 +981,15 @@ cdef inline __vml_set_err_status(status):
976
981
mkl.VML_STATUS_UNDERFLOW: ' underflow' ,
977
982
},
978
983
}
979
- mkl_status_in = __mkl_str_to_int(status, __variables[' input' ])
984
+ cdef int mkl_status_in = __mkl_str_to_int(status, __variables[' input' ])
980
985
981
- mkl_status_out = mkl.vmlSetErrStatus(mkl_status_in)
986
+ cdef int mkl_status_out = mkl.vmlSetErrStatus(mkl_status_in)
982
987
983
988
status = __mkl_int_to_str(mkl_status_out, __variables[' output' ])
984
989
return status
985
990
986
991
987
- cdef inline __vml_get_err_status():
992
+ cdef object __vml_get_err_status():
988
993
"""
989
994
Gets the VM Error Status.
990
995
https://software.intel.com/en-us/mkl-developer-reference-c-vmlgeterrstatus
@@ -1003,13 +1008,13 @@ cdef inline __vml_get_err_status():
1003
1008
},
1004
1009
}
1005
1010
1006
- mkl_status = mkl.vmlGetErrStatus()
1011
+ cdef int mkl_status = mkl.vmlGetErrStatus()
1007
1012
1008
1013
status = __mkl_int_to_str(mkl_status, __variables[' output' ])
1009
1014
return status
1010
1015
1011
1016
1012
- cdef inline __vml_clear_err_status():
1017
+ cdef object __vml_clear_err_status():
1013
1018
"""
1014
1019
Sets the VM Error Status to VML_STATUS_OK and stores the previous VM Error Status to olderr.
1015
1020
https://software.intel.com/en-us/mkl-developer-reference-c-vmlclearerrstatus
@@ -1028,7 +1033,7 @@ cdef inline __vml_clear_err_status():
1028
1033
},
1029
1034
}
1030
1035
1031
- mkl_status = mkl.vmlClearErrStatus()
1036
+ cdef int mkl_status = mkl.vmlClearErrStatus()
1032
1037
1033
1038
status = __mkl_int_to_str(mkl_status, __variables[' output' ])
1034
1039
return status
0 commit comments