diff --git a/ports/intel-mkl/portfile.cmake b/ports/intel-mkl/portfile.cmake index a885e8dcbcda81..67e6d982daaf7c 100644 --- a/ports/intel-mkl/portfile.cmake +++ b/ports/intel-mkl/portfile.cmake @@ -4,25 +4,56 @@ set(VCPKG_POLICY_EMPTY_PACKAGE enabled) -set(MKL_REQUIRED_VERSION "20200000") - -set(ProgramFilesx86 "ProgramFiles(x86)") -set(INTEL_ROOT $ENV{${ProgramFilesx86}}/IntelSWTools/compilers_and_libraries/windows) -set(ONEMKL_ROOT $ENV{${ProgramFilesx86}}/Intel/oneAPI/mkl/latest) +if (VCPKG_TARGET_IS_WINDOWS) + set(MKL_REQUIRED_VERSION "20200000") + set(ProgramFilesx86 "ProgramFiles(x86)") + set(INTEL_ROOT $ENV{${ProgramFilesx86}}/IntelSWTools/compilers_and_libraries/windows) + set(ONEMKL_ROOT $ENV{${ProgramFilesx86}}/Intel/oneAPI/mkl/latest) + + set(FAILURE_MESSAGE "Could not find MKL. Before continuing, please download and install MKL (${MKL_REQUIRED_VERSION} or higher) from:" + "\n https://registrationcenter.intel.com/en/products/download/3178/\n" + "\nAlso ensure vcpkg has been rebuilt with the latest version (v0.0.104 or later)") +else() + set(MKL_REQUIRED_VERSION "2020.0.000") + file(GLOB MKL_PATHS + "$ENV{MKLROOT}" + "${INTEL_ROOT}/mkl" + "${INTEL_ONEAPI_MKL_ROOT}" + "${ONEAPI_ROOT}/mkl" + "/opt/intel/compilers_and_libraries_*.*.*" + "/opt/intel/oneapi/mkl" + "/opt/intel/mkl" + ) + foreach(MKL_PATH ${MKL_PATHS}) + get_filename_component(CURRENT_VERSION ${MKL_PATH} NAME) + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+$" VERSION_NUM ${CURRENT_VERSION}) + if (IS_DIRECTORY ${MKL_PATH} AND VERSION_NUM) + if (VERSION_NUM VERSION_GREATER_EQUAL ${MKL_REQUIRED_VERSION}) + set(INTEL_ROOT ${MKL_PATH}/linux) + message("Fond Suitable version ${VERSION_NUM}") + break() + endif() + endif() + endforeach() + + set(FAILURE_MESSAGE "Could not find MKL. Before continuing, please install MKL (${MKL_REQUIRED_VERSION} or higher) using the system package manager" + "See https://software.intel.com/content/www/us/en/develop/articles/installing-intel-free-libs-and-python-apt-repo.html" + "\nAlso ensure vcpkg has been rebuilt with the latest version (v0.0.104 or later)") +endif() -find_path(MKL_ROOT include/mkl.h +find_path(MKL_ROOT mkl.h PATHS - $ENV{MKLROOT} - ${INTEL_ROOT}/mkl - $ENV{ONEAPI_ROOT}/mkl/latest - ${ONEMKL_ROOT} + $ENV{MKLROOT}/include + ${INTEL_ROOT}/mkl/include + $ENV{ONEAPI_ROOT}/mkl/latest/include + ${ONEMKL_ROOT}/include + /usr/include/mkl DOC - "Folder contains MKL") + "Folder contains MKL" +) if (MKL_ROOT STREQUAL "MKL_ROOT-NOTFOUND") - message(FATAL_ERROR "Could not find MKL. Before continuing, please download and install MKL (${MKL_REQUIRED_VERSION} or higher) from:" - "\n https://registrationcenter.intel.com/en/products/download/3178/\n" - "\nAlso ensure vcpkg has been rebuilt with the latest version (v0.0.104 or later)") + message(FATAL_ERROR ${FAILURE_MESSAGE}) endif() # file(STRINGS ${MKL_ROOT}/include/mkl_version.h MKL_VERSION_DEFINITION REGEX "__INTEL_MKL((_MINOR)|(_UPDATE))?__") @@ -31,10 +62,12 @@ endif() # list(GET MKL_VERSION 1 MKL_VERSION_MINOR) # list(GET MKL_VERSION 2 MKL_VERSION_UPDATE) -file(STRINGS ${MKL_ROOT}/include/mkl_version.h MKL_VERSION_DEFINITION REGEX "INTEL_MKL_VERSION") +file(STRINGS "${MKL_ROOT}/mkl_version.h" MKL_VERSION_DEFINITION REGEX "INTEL_MKL_VERSION") string(REGEX MATCH "([0-9]+)" MKL_VERSION ${MKL_VERSION_DEFINITION}) -if (MKL_VERSION LESS MKL_REQUIRED_VERSION) +if (MKL_VERSION VERSION_LESS MKL_REQUIRED_VERSION) message(FATAL_ERROR "MKL ${MKL_VERSION} is found but ${MKL_REQUIRED_VERSION} is required. Please download and install a more recent version of MKL from:" - "\n https://registrationcenter.intel.com/en/products/download/3178/\n") + "\n https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit.html\n") endif() + +configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/mkl/vcpkg-cmake-wrapper.cmake" @ONLY) diff --git a/ports/intel-mkl/vcpkg-cmake-wrapper.cmake.in b/ports/intel-mkl/vcpkg-cmake-wrapper.cmake.in new file mode 100644 index 00000000000000..5a776e9af0e0a7 --- /dev/null +++ b/ports/intel-mkl/vcpkg-cmake-wrapper.cmake.in @@ -0,0 +1,3 @@ +set(MKL_INCLUDE_DIR "@MKL_ROOT@") + +_find_package(MKL) diff --git a/ports/intel-mkl/vcpkg.json b/ports/intel-mkl/vcpkg.json index b767ee113559e8..6c61d77a28080c 100644 --- a/ports/intel-mkl/vcpkg.json +++ b/ports/intel-mkl/vcpkg.json @@ -1,6 +1,7 @@ { "name": "intel-mkl", "version": "2020.0.0", - "port-version": 2, - "description": "Intel® Math Kernel Library (Intel® MKL) accelerates math processing routines, increases application performance, and reduces development time on Intel® processors. Due to the complexity involved, this package doesn't install MKL. It instead verifies that MKL is installed. Please download and install MKL from https://registrationcenter.intel.com/en/products/download/3178/ manually before using it in vcpkg." + "port-version": 3, + "description": "Intel® Math Kernel Library (Intel® MKL) accelerates math processing routines, increases application performance, and reduces development time on Intel® processors. Due to the complexity involved, this package doesn't install MKL. It instead verifies that MKL is installed. Please download and install MKL from https://registrationcenter.intel.com/en/products/download/3178/ manually before using it in vcpkg.", + "license": "Apache-2.0" } diff --git a/scripts/azure-pipelines/linux/provision-image.sh b/scripts/azure-pipelines/linux/provision-image.sh old mode 100755 new mode 100644 index e3c6732e93c4e7..03818d52a411a3 --- a/scripts/azure-pipelines/linux/provision-image.sh +++ b/scripts/azure-pipelines/linux/provision-image.sh @@ -86,6 +86,9 @@ APT_PACKAGES="$APT_PACKAGES haskell-stack" ## required by duktape APT_PACKAGES="$APT_PACKAGES python-yaml" +# required by intel-mkl +APT_PACKAGES="$APT_PACKAGES intel-mkl" + ## CUDA APT_PACKAGES="$APT_PACKAGES cuda-compiler-11-6 cuda-libraries-dev-11-6 cuda-driver-dev-11-6 \ cuda-cudart-dev-11-6 libcublas-11-6 libcurand-dev-11-6 cuda-nvml-dev-11-6 libcudnn8-dev libnccl2 \ diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 7ed698cdef3a13..c83c8621b77c4d 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -365,7 +365,6 @@ ijg-libjpeg:x64-windows-static = skip ijg-libjpeg:x86-windows = skip intel-mkl:arm64-windows=fail intel-mkl:arm-uwp=fail -intel-mkl:x64-linux=fail intel-mkl:x64-osx=fail intel-mkl:arm64-osx=fail intel-mkl:x64-uwp=fail diff --git a/versions/baseline.json b/versions/baseline.json index 51a2caad19845f..cac47fb324bf90 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3098,7 +3098,7 @@ }, "intel-mkl": { "baseline": "2020.0.0", - "port-version": 2 + "port-version": 3 }, "intelrdfpmathlib": { "baseline": "20U2", diff --git a/versions/i-/intel-mkl.json b/versions/i-/intel-mkl.json index 1c5ffb0efe056e..20b117dab34858 100644 --- a/versions/i-/intel-mkl.json +++ b/versions/i-/intel-mkl.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "50abc44be806f0f8f752bf26cfd76d37c10827b4", + "version": "2020.0.0", + "port-version": 3 + }, { "git-tree": "f2d5b828df130d8b1106aa0c076eb9cb79e50ea9", "version": "2020.0.0",