|
| 1 | +ctypedef long long MKL_INT64 |
| 2 | +ctypedef unsigned long long MKL_UINT64 |
| 3 | +ctypedef int MKL_INT |
| 4 | + |
| 5 | + |
| 6 | +cdef extern from "mkl.h": |
| 7 | + # MKL_INT64 mkl_peak_mem_usage(int mode) |
| 8 | + # In |
| 9 | + int MKL_PEAK_MEM_ENABLE |
| 10 | + int MKL_PEAK_MEM_DISABLE |
| 11 | + int MKL_PEAK_MEM |
| 12 | + int MKL_PEAK_MEM_RESET |
| 13 | + |
| 14 | + # int mkl_set_memory_limit(int mem_type, size_t limit) |
| 15 | + # In |
| 16 | + int MKL_MEM_MCDRAM |
| 17 | + |
| 18 | + # int mkl_cbwr_set(int settings) |
| 19 | + # In |
| 20 | + int MKL_CBWR_AUTO |
| 21 | + int MKL_CBWR_COMPATIBLE |
| 22 | + int MKL_CBWR_SSE2 |
| 23 | + int MKL_CBWR_SSE3 |
| 24 | + int MKL_CBWR_SSSE3 |
| 25 | + int MKL_CBWR_SSE4_1 |
| 26 | + int MKL_CBWR_SSE4_2 |
| 27 | + int MKL_CBWR_AVX |
| 28 | + int MKL_CBWR_AVX2 |
| 29 | + int MKL_CBWR_AVX512_MIC |
| 30 | + int MKL_CBWR_AVX512 |
| 31 | + # Out |
| 32 | + int MKL_CBWR_SUCCESS |
| 33 | + int MKL_CBWR_ERR_INVALID_INPUT |
| 34 | + int MKL_CBWR_ERR_UNSUPPORTED_BRANCH |
| 35 | + int MKL_CBWR_ERR_MODE_CHANGE_FAILURE |
| 36 | + |
| 37 | + # int mkl_enable_instructions(int isa) |
| 38 | + # In |
| 39 | + int MKL_ENABLE_AVX512 |
| 40 | + int MKL_ENABLE_AVX512_MIC |
| 41 | + int MKL_ENABLE_AVX2 |
| 42 | + int MKL_ENABLE_AVX |
| 43 | + int MKL_ENABLE_SSE4_2 |
| 44 | + |
| 45 | + # unsigned int vmlSetMode(unsigned int mode) |
| 46 | + # In |
| 47 | + int VML_HA |
| 48 | + int VML_LA |
| 49 | + int VML_EP |
| 50 | + int VML_FTZDAZ_ON |
| 51 | + int VML_FTZDAZ_OFF |
| 52 | + int VML_ERRMODE_IGNORE |
| 53 | + int VML_ERRMODE_ERRNO |
| 54 | + int VML_ERRMODE_STDERR |
| 55 | + int VML_ERRMODE_EXCEPT |
| 56 | + int VML_ERRMODE_CALLBACK |
| 57 | + int VML_ERRMODE_DEFAULT |
| 58 | + |
| 59 | + # int vmlSetErrStatus(const MKL_INT status) |
| 60 | + # In |
| 61 | + int VML_STATUS_OK |
| 62 | + int VML_STATUS_ACCURACYWARNING |
| 63 | + int VML_STATUS_BADSIZE |
| 64 | + int VML_STATUS_BADMEM |
| 65 | + int VML_STATUS_ERRDOM |
| 66 | + int VML_STATUS_SING |
| 67 | + int VML_STATUS_OVERFLOW |
| 68 | + int VML_STATUS_UNDERFLOW |
| 69 | + |
| 70 | + |
| 71 | + ctypedef struct MKLVersion: |
| 72 | + int MajorVersion |
| 73 | + int MinorVersion |
| 74 | + int UpdateVersion |
| 75 | + char* ProductStatus |
| 76 | + char* Build |
| 77 | + char* Processor |
| 78 | + char* Platform |
| 79 | + |
| 80 | + # MKL support functions |
| 81 | + void mkl_get_version(MKLVersion *pv) |
| 82 | + void mkl_get_version_string(char *buf, int len) |
| 83 | + |
| 84 | + # Threading |
| 85 | + void mkl_set_num_threads(int nth) |
| 86 | + int mkl_domain_set_num_threads(int nt, int domain) |
| 87 | + int mkl_set_num_threads_local(int nth) |
| 88 | + void mkl_set_dynamic(int flag) |
| 89 | + int mkl_get_max_threads() |
| 90 | + int mkl_domain_get_max_threads(int domain) |
| 91 | + int mkl_get_dynamic() |
| 92 | + |
| 93 | + # Timing |
| 94 | + float second() |
| 95 | + double dsecnd() |
| 96 | + void mkl_get_cpu_clocks(MKL_UINT64 *clocks) |
| 97 | + double mkl_get_cpu_frequency() |
| 98 | + double mkl_get_max_cpu_frequency() |
| 99 | + double mkl_get_clocks_frequency() |
| 100 | + |
| 101 | + # Memory |
| 102 | + void mkl_free_buffers() |
| 103 | + void mkl_thread_free_buffers() |
| 104 | + int mkl_disable_fast_mm() |
| 105 | + MKL_INT64 mkl_mem_stat(int *buf) |
| 106 | + MKL_INT64 mkl_peak_mem_usage(int mode) |
| 107 | + int mkl_set_memory_limit(int mem_type, size_t limit) |
| 108 | + |
| 109 | + # Conditional Numerical Reproducibility |
| 110 | + int mkl_cbwr_set(int settings) |
| 111 | + int mkl_cbwr_get_auto_branch() |
| 112 | + |
| 113 | + # Miscellaneous |
| 114 | + int mkl_enable_instructions(int isa) |
| 115 | + int mkl_set_env_mode(int mode) |
| 116 | + int mkl_verbose(int enable) |
| 117 | + int mkl_set_mpi (int vendor, const char *custom_library_name) |
| 118 | + |
| 119 | + # VM Service Functions |
| 120 | + unsigned int vmlSetMode(unsigned int mode) |
| 121 | + unsigned int vmlGetMode() |
| 122 | + int vmlSetErrStatus(const MKL_INT status) |
| 123 | + int vmlGetErrStatus() |
| 124 | + int vmlClearErrStatus() |
| 125 | + |
0 commit comments