1 /*******************************************************************************
2 * Copyright 2017-2018 Intel Corporation
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *******************************************************************************/
21 * Common stuff respecting USE_MKL and USE_CBLAS compile flags
23 * USE_MKL USE_CBLAS effect
24 * ------- --------- ------
25 * yes yes normal compile: jit *may* be preferred over Intel(R) MKL CBLAS
26 * yes no jit calls OK; assert if cblas is ever called
27 * no yes system-dependent CBLAS
28 * no no gemm convolution (or other blas) N/A; create stubs
33 #include "mkl_version.h"
35 #define USE_MKL_PACKED_GEMM 0
36 #define USE_MKL_IGEMM \
37 (INTEL_MKL_VERSION >= 20180000 && __INTEL_MKL_BUILD_DATE >= 20170628)
39 #include "mkl_cblas.h"
40 #if !defined(USE_CBLAS)
41 #define cblas_sgemm(...) assert(!"CBLAS is unavailable")
44 #else /* defined(USE_MKL) */
46 #define USE_MKL_PACKED_GEMM 0
47 #define USE_MKL_IGEMM 0
50 /* TODO: _SX should also define USE_CBLAS in case the later is available */
52 #include "cblas.h" // CHECK: does SX also have a fortran API sgemm?
55 #elif defined(USE_CBLAS)
56 #include "cblas.h" // Maybe a system/cmake cblas works for you?
58 /* put the stubs to make a code compilable but not workable */
59 #define cblas_sgemm(...) assert(!"CBLAS is unavailable")
60 #endif /* defined(_SX) */
62 #endif /* defined(USE_MKL) */
68 #if defined(USE_MKL) && defined(USE_CBLAS)
69 typedef MKL_INT cblas_int;
71 #elif defined(USE_CBLAS)
72 typedef int cblas_int;
75 /* this cblas.h is peculiar... */
76 typedef CBLAS_ORDER CBLAS_LAYOUT;
84 #endif /* OS_BLAS_HPP */
86 // vim: et ts=4 sw=4 cindent cino^=l0,\:0,N-s