diff --git a/CMakeLists.txt b/CMakeLists.txt index abe52ca4d6a3..88f01b98e9aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,7 +225,7 @@ endif() if(USE_MKLDNN) SET(MKLDNN_LIBRARY_TYPE STATIC) - include(cmake/MklDnn.cmake) + include(cmake/DownloadMKLML.cmake) # CPU architecture (e.g., C5) can't run on another architecture (e.g., g3). if(NOT MSVC) set(ARCH_OPT_FLAGS "-mtune=generic") diff --git a/ci/docker/install/ubuntu_mklml.sh b/ci/docker/install/ubuntu_mklml.sh index 7e17295f4208..862e2846403a 100755 --- a/ci/docker/install/ubuntu_mklml.sh +++ b/ci/docker/install/ubuntu_mklml.sh @@ -21,5 +21,5 @@ # the whole docker cache for the image set -ex -wget -q --no-check-certificate -O /tmp/mklml.tgz https://github.com/intel/mkl-dnn/releases/download/v0.14/mklml_lnx_2018.0.3.20180406.tgz +wget -q --no-check-certificate -O /tmp/mklml.tgz https://github.com/intel/mkl-dnn/releases/download/v0.17-rc/mklml_lnx_2019.0.1.20180928.tgz tar -zxf /tmp/mklml.tgz && cp -rf mklml_*/* /usr/local/ && rm -rf mklml_* diff --git a/cmake/DownloadMKLML.cmake b/cmake/DownloadMKLML.cmake new file mode 100644 index 000000000000..c2c1cd6916f6 --- /dev/null +++ b/cmake/DownloadMKLML.cmake @@ -0,0 +1,73 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +# This script will download MKLML + +message(STATUS "Downloading MKLML...") + +set(MKLDNN_RELEASE v0.17-rc) +set(MKLML_RELEASE_FILE_SUFFIX 2019.0.1.20180928) + +if(MSVC) + set(MKL_NAME "mklml_win_${MKLML_RELEASE_FILE_SUFFIX}") + + file(DOWNLOAD "https://github.com/intel/mkl-dnn/releases/download/${MKLDNN_RELEASE}/${MKL_NAME}.zip" + "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.zip" + EXPECTED_MD5 "443e661bdfd32dbbc99b460b43afceee" SHOW_PROGRESS) + file(DOWNLOAD "https://github.com/apache/incubator-mxnet/releases/download/utils/7z.exe" + "${CMAKE_CURRENT_BINARY_DIR}/mklml/7z2.exe" + EXPECTED_MD5 "E1CF766CF358F368EC97662D06EA5A4C" SHOW_PROGRESS) + + execute_process(COMMAND "${CMAKE_CURRENT_BINARY_DIR}/mklml/7z2.exe" "-o${CMAKE_CURRENT_BINARY_DIR}/mklml/" "-y") + execute_process(COMMAND "${CMAKE_CURRENT_BINARY_DIR}/mklml/7z.exe" + "x" "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.zip" "-o${CMAKE_CURRENT_BINARY_DIR}/mklml/" "-y") + + set(MKLROOT "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}") + + message(STATUS "Setting MKLROOT path to ${MKLROOT}") + + include_directories(${MKLROOT}/include) + +elseif(APPLE) + set(MKL_NAME "mklml_mac_${MKLML_RELEASE_FILE_SUFFIX}") + + file(DOWNLOAD "https://github.com/intel/mkl-dnn/releases/download/${MKLDNN_RELEASE}/${MKL_NAME}.tgz" + "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.tgz" + EXPECTED_MD5 "95f887af332205b1d15b392260003952" SHOW_PROGRESS) + execute_process(COMMAND "tar" "-xzf" "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.tgz" + "-C" "${CMAKE_CURRENT_BINARY_DIR}/mklml/") + + set(MKLROOT "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}") + + message(STATUS "Setting MKLROOT path to ${MKLROOT}") + +elseif(UNIX) + set(MKL_NAME "mklml_lnx_${MKLML_RELEASE_FILE_SUFFIX}") + + file(DOWNLOAD "https://github.com/intel/mkl-dnn/releases/download/${MKLDNN_RELEASE}/${MKL_NAME}.tgz" + "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.tgz" + EXPECTED_MD5 "a63abf155361322b9c03f8fc50f4f317" SHOW_PROGRESS) + execute_process(COMMAND "tar" "-xzf" "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.tgz" + "-C" "${CMAKE_CURRENT_BINARY_DIR}/mklml/") + + set(MKLROOT "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}") + + message(STATUS "Setting MKLROOT path to ${MKLROOT}") + +else() + message(FATAL_ERROR "Wrong platform") +endif() diff --git a/cmake/MklDnn.cmake b/cmake/MklDnn.cmake deleted file mode 100644 index acaf878b2f45..000000000000 --- a/cmake/MklDnn.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -#this file download mklml - -message(STATUS "download mklml") -if(MSVC) - set(MKL_NAME "mklml_win_2018.0.3.20180406") - file(DOWNLOAD "https://github.com/intel/mkl-dnn/releases/download/v0.14/${MKL_NAME}.zip" "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.zip" EXPECTED_MD5 "8DD73E7D3F19F004551809824C4E8970" SHOW_PROGRESS) - file(DOWNLOAD "https://github.com/apache/incubator-mxnet/releases/download/utils/7z.exe" "${CMAKE_CURRENT_BINARY_DIR}/mklml/7z2.exe" EXPECTED_MD5 "E1CF766CF358F368EC97662D06EA5A4C" SHOW_PROGRESS) - - execute_process(COMMAND "${CMAKE_CURRENT_BINARY_DIR}/mklml/7z2.exe" "-o${CMAKE_CURRENT_BINARY_DIR}/mklml/" "-y") - execute_process(COMMAND "${CMAKE_CURRENT_BINARY_DIR}/mklml/7z.exe" "x" "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.zip" "-o${CMAKE_CURRENT_BINARY_DIR}/mklml/" "-y") - set(MKLROOT "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}") - include_directories(${MKLROOT}/include) - file(COPY ${MKLROOT}/lib/libiomp5md.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY ${MKLROOT}/lib/mklml.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY ${CMAKE_SOURCE_DIR}/3rdparty/mkldnn/config_template.vcxproj.user DESTINATION ${CMAKE_SOURCE_DIR}) -elseif(UNIX) - set(MKL_NAME "mklml_lnx_2018.0.3.20180406") - file(DOWNLOAD "https://github.com/intel/mkl-dnn/releases/download/v0.14/${MKL_NAME}.tgz" "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.tgz" EXPECTED_MD5 "DAF7EFC3C1C0036B447213004467A8AE" SHOW_PROGRESS) - execute_process(COMMAND "tar" "-xzf" "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}.tgz" "-C" "${CMAKE_CURRENT_BINARY_DIR}/mklml/") - set(MKLROOT "${CMAKE_CURRENT_BINARY_DIR}/mklml/${MKL_NAME}") - include_directories(${MKLROOT}/include) - file(COPY ${MKLROOT}/lib/libiomp5.so DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY ${MKLROOT}/lib/libmklml_gnu.so DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY ${MKLROOT}/lib/libmklml_intel.so DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -else() - message(FATAL_ERROR "not support now") -endif()