Skip to content

Commit 934c2bd

Browse files
Initial commit
1 parent 06ea45d commit 934c2bd

File tree

7 files changed

+683
-0
lines changed

7 files changed

+683
-0
lines changed

LICENSE.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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.

mkl-service/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from ._py_mkl_service import *
2+
#__all__ = ['tests']

mkl-service/_mkl_service.pxd

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
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

Comments
 (0)