|
| 1 | +# Copyright (c) 2018, Intel Corporation |
| 2 | +# |
| 3 | +# Redistribution and use in source and binary forms, with or without |
| 4 | +# modification, are permitted provided that the following conditions are met: |
| 5 | +# |
| 6 | +# * Redistributions of source code must retain the above copyright notice, |
| 7 | +# this list of conditions and the following disclaimer. |
| 8 | +# * Redistributions in binary form must reproduce the above copyright |
| 9 | +# notice, this list of conditions and the following disclaimer in the |
| 10 | +# documentation and/or other materials provided with the distribution. |
| 11 | +# * Neither the name of Intel Corporation nor the names of its contributors |
| 12 | +# may be used to endorse or promote products derived from this software |
| 13 | +# without specific prior written permission. |
| 14 | +# |
| 15 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 16 | +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 | +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 18 | +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
| 19 | +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 20 | +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 21 | +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 22 | +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 23 | +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 | +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | + |
| 26 | + |
| 27 | +ctypedef long long MKL_INT64 |
| 28 | +ctypedef unsigned long long MKL_UINT64 |
| 29 | +ctypedef int MKL_INT |
| 30 | + |
| 31 | + |
| 32 | +cdef extern from "mkl.h": |
| 33 | + # MKL Function Domains Constants |
| 34 | + int MKL_DOMAIN_BLAS |
| 35 | + int MKL_DOMAIN_FFT |
| 36 | + int MKL_DOMAIN_VML |
| 37 | + int MKL_DOMAIN_PARDISO |
| 38 | + int MKL_DOMAIN_ALL |
| 39 | + |
| 40 | + # MKL Peak Memory Usage Constants |
| 41 | + int MKL_PEAK_MEM_ENABLE |
| 42 | + int MKL_PEAK_MEM_DISABLE |
| 43 | + int MKL_PEAK_MEM |
| 44 | + int MKL_PEAK_MEM_RESET |
| 45 | + int MKL_MEM_MCDRAM |
| 46 | + |
| 47 | + # CNR Control Constants |
| 48 | + int MKL_CBWR_AUTO |
| 49 | + int MKL_CBWR_COMPATIBLE |
| 50 | + int MKL_CBWR_SSE2 |
| 51 | + int MKL_CBWR_SSE3 |
| 52 | + int MKL_CBWR_SSSE3 |
| 53 | + int MKL_CBWR_SSE4_1 |
| 54 | + int MKL_CBWR_SSE4_2 |
| 55 | + int MKL_CBWR_AVX |
| 56 | + int MKL_CBWR_AVX2 |
| 57 | + int MKL_CBWR_AVX512_MIC |
| 58 | + int MKL_CBWR_AVX512 |
| 59 | + int MKL_CBWR_BRANCH |
| 60 | + int MKL_CBWR_ALL |
| 61 | + int MKL_CBWR_SUCCESS |
| 62 | + int MKL_CBWR_BRANCH_OFF |
| 63 | + int MKL_CBWR_ERR_INVALID_INPUT |
| 64 | + int MKL_CBWR_ERR_UNSUPPORTED_BRANCH |
| 65 | + int MKL_CBWR_ERR_MODE_CHANGE_FAILURE |
| 66 | + |
| 67 | + # ISA Constants |
| 68 | + int MKL_ENABLE_AVX512_MIC_E1 |
| 69 | + int MKL_ENABLE_AVX512 |
| 70 | + int MKL_ENABLE_AVX512_MIC |
| 71 | + int MKL_ENABLE_AVX2 |
| 72 | + int MKL_ENABLE_AVX |
| 73 | + int MKL_ENABLE_SSE4_2 |
| 74 | + |
| 75 | + # MPI Implementation Constants |
| 76 | + int MKL_BLACS_CUSTOM |
| 77 | + int MKL_BLACS_MSMPI |
| 78 | + int MKL_BLACS_INTELMPI |
| 79 | + int MKL_BLACS_MPICH2 |
| 80 | + |
| 81 | + # VML Constants |
| 82 | + int VML_HA |
| 83 | + int VML_LA |
| 84 | + int VML_EP |
| 85 | + int VML_FTZDAZ_ON |
| 86 | + int VML_FTZDAZ_OFF |
| 87 | + int VML_ERRMODE_IGNORE |
| 88 | + int VML_ERRMODE_ERRNO |
| 89 | + int VML_ERRMODE_STDERR |
| 90 | + int VML_ERRMODE_EXCEPT |
| 91 | + int VML_ERRMODE_CALLBACK |
| 92 | + int VML_ERRMODE_DEFAULT |
| 93 | + int VML_STATUS_OK |
| 94 | + int VML_STATUS_ACCURACYWARNING |
| 95 | + int VML_STATUS_BADSIZE |
| 96 | + int VML_STATUS_BADMEM |
| 97 | + int VML_STATUS_ERRDOM |
| 98 | + int VML_STATUS_SING |
| 99 | + int VML_STATUS_OVERFLOW |
| 100 | + int VML_STATUS_UNDERFLOW |
| 101 | + int VML_ACCURACY_MASK |
| 102 | + int VML_FTZDAZ_MASK |
| 103 | + int VML_ERRMODE_MASK |
| 104 | + |
| 105 | + ctypedef struct MKLVersion: |
| 106 | + int MajorVersion |
| 107 | + int MinorVersion |
| 108 | + int UpdateVersion |
| 109 | + char* ProductStatus |
| 110 | + char* Build |
| 111 | + char* Processor |
| 112 | + char* Platform |
| 113 | + |
| 114 | + # MKL support functions |
| 115 | + void mkl_get_version(MKLVersion* pv) |
| 116 | + void mkl_get_version_string(char* buf, int len) |
| 117 | + |
| 118 | + # Threading |
| 119 | + void mkl_set_num_threads(int nth) |
| 120 | + int mkl_domain_set_num_threads(int nt, int domain) |
| 121 | + int mkl_set_num_threads_local(int nth) |
| 122 | + void mkl_set_dynamic(int flag) |
| 123 | + int mkl_get_max_threads() |
| 124 | + int mkl_domain_get_max_threads(int domain) |
| 125 | + int mkl_get_dynamic() |
| 126 | + |
| 127 | + # Timing |
| 128 | + float second() |
| 129 | + double dsecnd() |
| 130 | + void mkl_get_cpu_clocks(MKL_UINT64* clocks) |
| 131 | + double mkl_get_cpu_frequency() |
| 132 | + double mkl_get_max_cpu_frequency() |
| 133 | + double mkl_get_clocks_frequency() |
| 134 | + |
| 135 | + # Memory |
| 136 | + void mkl_free_buffers() |
| 137 | + void mkl_thread_free_buffers() |
| 138 | + int mkl_disable_fast_mm() |
| 139 | + MKL_INT64 mkl_mem_stat(int* buf) |
| 140 | + MKL_INT64 mkl_peak_mem_usage(int mode) |
| 141 | + int mkl_set_memory_limit(int mem_type, size_t limit) |
| 142 | + |
| 143 | + # Conditional Numerical Reproducibility |
| 144 | + int mkl_cbwr_set(int settings) |
| 145 | + int mkl_cbwr_get(int option) |
| 146 | + int mkl_cbwr_get_auto_branch() |
| 147 | + |
| 148 | + # Miscellaneous |
| 149 | + int mkl_enable_instructions(int isa) |
| 150 | + int mkl_set_env_mode(int mode) |
| 151 | + int mkl_verbose(int enable) |
| 152 | + int mkl_set_mpi(int vendor, const char* custom_library_name) |
| 153 | + |
| 154 | + # VM Service Functions |
| 155 | + unsigned int vmlSetMode(unsigned int mode) |
| 156 | + unsigned int vmlGetMode() |
| 157 | + int vmlSetErrStatus(const MKL_INT status) |
| 158 | + int vmlGetErrStatus() |
| 159 | + int vmlClearErrStatus() |
0 commit comments