rename mkllite to mklml

cblas_new
tensor-tang 8 years ago
parent 1601c34aa5
commit 577bb4e346

@ -38,7 +38,7 @@ include(simd)
option(WITH_GPU "Compile PaddlePaddle with NVIDIA GPU" ${CUDA_FOUND})
option(WITH_AVX "Compile PaddlePaddle with AVX intrinsics" ${AVX_FOUND})
option(WITH_MKLDNN "Compile PaddlePaddle with mkl-dnn support." ${AVX_FOUND})
option(WITH_MKL_LITE "Compile PaddlePaddle with mkl lite package." ${AVX_FOUND})
option(WITH_MKLML "Compile PaddlePaddle with mklml package." ${AVX_FOUND})
option(WITH_DSO "Compile PaddlePaddle with dynamic linked CUDA" ON)
option(WITH_TESTING "Compile PaddlePaddle with unit testing" ON)
option(WITH_SWIG_PY "Compile PaddlePaddle with inference api" ON)
@ -79,8 +79,8 @@ if(ANDROID)
"Disable RDMA when cross-compiling for Android" FORCE)
set(WITH_MKLDNN OFF CACHE STRING
"Disable MKLDNN when cross-compiling for Android" FORCE)
set(WITH_MKL_LITE OFF CACHE STRING
"Disable MKL lite package when cross-compiling for Android" FORCE)
set(WITH_MKLML OFF CACHE STRING
"Disable MKLML package when cross-compiling for Android" FORCE)
endif(ANDROID)
set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING
@ -94,7 +94,7 @@ endif()
########################################################################################
include(external/mkllite) # download mkl minimal lite package
include(external/mklml) # download mklml package
include(external/zlib) # download, build, install zlib
include(external/gflags) # download, build, install gflags
include(external/glog) # download, build, install glog
@ -145,7 +145,7 @@ if(WITH_GPU)
endif(WITH_GPU)
if(WITH_MKLDNN)
list(APPEND EXTERNAL_LIBS ${MKLDNN_LIBRARY} ${MKL_LITE_LIB_IOMP})
list(APPEND EXTERNAL_LIBS ${MKLDNN_LIBRARY} ${MKLML_LIB_IOMP})
endif()
if(USE_NNPACK)

@ -15,17 +15,17 @@
set(CBLAS_FOUND OFF)
## Find MKL Lite First.
if(WITH_MKL_LITE AND MKL_LITE_INC_DIR AND MKL_LITE_LIB)
## Find MKLML First.
if(WITH_MKLML AND MKLML_INC_DIR AND MKLML_LIB)
set(CBLAS_FOUND ON)
set(CBLAS_PROVIDER MKL_LITE)
set(CBLAS_INC_DIR ${MKL_LITE_INC_DIR})
set(CBLAS_LIBRARIES ${MKL_LITE_LIB})
set(CBLAS_PROVIDER MKLML)
set(CBLAS_INC_DIR ${MKLML_INC_DIR})
set(CBLAS_LIBRARIES ${MKLML_LIB})
add_definitions(-DPADDLE_USE_MKL_LITE)
add_definitions(-DPADDLE_USE_MKLML)
add_definitions(-DLAPACK_FOUND)
message(STATUS "Found cblas and lapack in MKL Lite "
message(STATUS "Found cblas and lapack in MKLML "
"(include: ${CBLAS_INC_DIR}, library: ${CBLAS_LIBRARIES})")
return()
endif()
@ -43,20 +43,6 @@ set(MKL_LIB_SEARCH_PATHS
${INTEL_MKL_ROOT}/lib
${INTEL_MKL_ROOT}/lib/intel64)
if(MKL_LITE_INC_DIR AND MKL_LITE_LIB)
set(CBLAS_FOUND ON)
set(CBLAS_PROVIDER MKL_LITE)
set(CBLAS_INC_DIR ${MKL_LITE_INC_DIR})
set(CBLAS_LIBRARIES ${MKL_LITE_LIB})
add_definitions(-DPADDLE_USE_MKL_LITE)
add_definitions(-DLAPACK_FOUND)
message(STATUS "Found cblas and lapack in MKL Lite "
"(include: ${MKL_LITE_INC_DIR}, library: ${CBLAS_LIBRARIES})")
return()
endif()
find_path(MKL_INC_DIR mkl.h PATHS
${MKL_INCLUDE_SEARCH_PATHS})
find_path(MKL_LAPACK_INC_DIR mkl_lapacke.h PATHS

@ -69,7 +69,7 @@ endif(NOT WITH_GPU)
if(WITH_MKLDNN)
add_definitions(-DPADDLE_USE_MKLDNN)
if (WITH_MKL_LITE AND MKLDNN_IOMP_DIR)
if (WITH_MKLML AND MKLDNN_IOMP_DIR)
message(STATUS "Enable Intel OpenMP at ${MKLDNN_IOMP_DIR}")
set(OPENMP_FLAGS "-fopenmp")
set(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS ${OPENMP_FLAGS})

@ -34,9 +34,9 @@ IF(WITH_TESTING)
"${GTEST_INSTALL_DIR}/lib/libgtest_main.a" CACHE FILEPATH "gtest main libraries." FORCE)
ENDIF(WIN32)
IF(WITH_MKL_LITE)
# wait for mkl downloading completed
SET(GTEST_DEPENDS ${MKL_LITE_PROJECT})
IF(WITH_MKLML)
# wait for mklml downloading completed
SET(GTEST_DEPENDS ${MKLML_PROJECT})
ENDIF()
ExternalProject_Add(

@ -38,10 +38,10 @@ ENDIF(WIN32)
INCLUDE_DIRECTORIES(${MKLDNN_INCLUDE_DIR})
IF(${CBLAS_PROVIDER} STREQUAL "MKL_LITE")
SET(MKLDNN_DEPENDS ${MKL_LITE_PROJECT})
SET(MKLDNN_MKLROOT ${MKL_LITE_ROOT})
SET(MKLDNN_IOMP_DIR ${MKL_LITE_LIB_DIR})
IF(${CBLAS_PROVIDER} STREQUAL "MKLML")
SET(MKLDNN_DEPENDS ${MKLML_PROJECT})
SET(MKLDNN_MKLROOT ${MKLML_ROOT})
SET(MKLDNN_IOMP_DIR ${MKLML_LIB_DIR})
ENDIF()
ExternalProject_Add(

@ -1,61 +0,0 @@
# Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
IF(NOT ${WITH_MKL_LITE})
return()
ENDIF(NOT ${WITH_MKL_LITE})
INCLUDE(ExternalProject)
SET(MKL_LITE_PROJECT "extern_mkllite")
SET(MKL_LITE_VER "mklml_lnx_2018.0.20170425")
SET(MKL_LITE_URL "https://github.com/01org/mkl-dnn/releases/download/v0.9/${MKL_LITE_VER}.tgz")
SET(MKL_LITE_DOWNLOAD_DIR ${THIRD_PARTY_PATH}/mkllite)
SET(MKL_LITE_ROOT ${MKL_LITE_DOWNLOAD_DIR}/${MKL_LITE_VER})
SET(MKL_LITE_INC_DIR ${MKL_LITE_ROOT}/include)
SET(MKL_LITE_LIB_DIR ${MKL_LITE_ROOT}/lib)
SET(MKL_LITE_LIB ${MKL_LITE_LIB_DIR}/libmklml_intel.so)
SET(MKL_LITE_IOMP_LIB ${MKL_LITE_LIB_DIR}/libiomp5.so)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}" "${MKL_LITE_ROOT}/lib")
INCLUDE_DIRECTORIES(${MKL_LITE_INC_DIR})
ExternalProject_Add(
${MKL_LITE_PROJECT}
${EXTERNAL_PROJECT_LOG_ARGS}
PREFIX ${MKL_LITE_DOWNLOAD_DIR}
DOWNLOAD_DIR ${MKL_LITE_DOWNLOAD_DIR}
DOWNLOAD_COMMAND wget --no-check-certificate ${MKL_LITE_URL}
&& tar -xzf ${MKL_LITE_DOWNLOAD_DIR}/${MKL_LITE_VER}.tgz
DOWNLOAD_NO_PROGRESS 1
UPDATE_COMMAND ""
PATCH_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
IF (${CMAKE_VERSION} VERSION_LESS "3.3.0")
SET(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/mkllite_dummy.c)
FILE(WRITE ${dummyfile} "const char * dummy_mkllite = \"${dummyfile}\";")
ADD_LIBRARY(mkllite STATIC ${dummyfile})
ELSE()
ADD_LIBRARY(mkllite INTERFACE)
ENDIF()
ADD_DEPENDENCIES(mkllite ${MKL_LITE_PROJECT})
LIST(APPEND external_project_dependencies mkllite)

@ -0,0 +1,61 @@
# Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
IF(NOT ${WITH_MKLML})
return()
ENDIF(NOT ${WITH_MKLML})
INCLUDE(ExternalProject)
SET(MKLML_PROJECT "extern_mklml")
SET(MKLML_VER "mklml_lnx_2018.0.20170425")
SET(MKLML_URL "https://github.com/01org/mkl-dnn/releases/download/v0.9/${MKLML_VER}.tgz")
SET(MKLML_DOWNLOAD_DIR ${THIRD_PARTY_PATH}/mklml)
SET(MKLML_ROOT ${MKLML_DOWNLOAD_DIR}/${MKLML_VER})
SET(MKLML_INC_DIR ${MKLML_ROOT}/include)
SET(MKLML_LIB_DIR ${MKLML_ROOT}/lib)
SET(MKLML_LIB ${MKLML_LIB_DIR}/libmklml_intel.so)
SET(MKLML_IOMP_LIB ${MKLML_LIB_DIR}/libiomp5.so)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}" "${MKLML_ROOT}/lib")
INCLUDE_DIRECTORIES(${MKLML_INC_DIR})
ExternalProject_Add(
${MKLML_PROJECT}
${EXTERNAL_PROJECT_LOG_ARGS}
PREFIX ${MKLML_DOWNLOAD_DIR}
DOWNLOAD_DIR ${MKLML_DOWNLOAD_DIR}
DOWNLOAD_COMMAND wget --no-check-certificate -O ${MKLML_DOWNLOAD_DIR}/${MKLML_VER}.tgz ${MKLML_URL}
&& tar -xzf ${MKLML_DOWNLOAD_DIR}/${MKLML_VER}.tgz
DOWNLOAD_NO_PROGRESS 1
UPDATE_COMMAND ""
PATCH_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
IF (${CMAKE_VERSION} VERSION_LESS "3.3.0")
SET(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/mklml_dummy.c)
FILE(WRITE ${dummyfile} "const char * dummy_mklml = \"${dummyfile}\";")
ADD_LIBRARY(mklml STATIC ${dummyfile})
ELSE()
ADD_LIBRARY(mklml INTERFACE)
ENDIF()
ADD_DEPENDENCIES(mklml ${MKLML_PROJECT})
LIST(APPEND external_project_dependencies mklml)

@ -202,7 +202,7 @@ double dotProduct<double>(const int n, const double* x, const double* y) {
return cblas_ddot(n, x, 1, y, 1);
}
#if defined(PADDLE_USE_MKL) || defined(PADDLE_USE_MKL_LITE)
#if defined(PADDLE_USE_MKL) || defined(PADDLE_USE_MKLML)
template <>
void vExp<float>(const int n, const float* a, float* r) {

@ -15,7 +15,7 @@ limitations under the License. */
#ifndef MATHFUNCTIONS_H_
#define MATHFUNCTIONS_H_
#ifdef PADDLE_USE_MKL_LITE
#ifdef PADDLE_USE_MKLML
#include <mkl_cblas.h>
#include <mkl_lapacke.h>
#include <mkl_vml_functions.h>

Loading…
Cancel
Save