At some point, finding BLAS and Lapack for Intel compilers on Windows seems to have broken. This issue occurs at least for CMake 3.16.8 and CMake 3.18-rc3. This happens for Intel Parallel Studio XE as well as the new Intel oneAPI compilers.
It looks at first glance like there may be an issues with properly escaping the compiler path that contains spaces–i.e. this may not be exactly a “FindBLAS” issue, but maybe an issue in general for this compiler.
CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(lapack_test LANGUAGES C Fortran)
set(BLA_VENDOR "Intel10_64lp")
find_package(BLAS)
Results for:
cmake -B build -G Ninja # or -G "MinGW Makefiles" same result
C:\lapack_demo>..\..\..\.local\cmake-3.16.8-win64-x64\bin\cmake.exe -B buildn
-- Building for: Ninja
-- The C compiler identification is Intel 19.1.0.20200306
-- The Fortran compiler identification is Intel 19.1.0.20200306
-- Check for working C compiler: C:/Program Files (x86)/inteloneapi/compiler/latest/windows/bin/intel64/icl.exe
-- Check for working C compiler: C:/Program Files (x86)/inteloneapi/compiler/latest/windows/bin/intel64/icl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working Fortran compiler: C:/Program Files (x86)/inteloneapi/compiler/latest/windows/bin/intel64/ifort.exe
-- Check for working Fortran compiler: C:/Program Files (x86)/inteloneapi/compiler/latest/windows/bin/intel64/ifort.exe -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether C:/Program Files (x86)/inteloneapi/compiler/latest/windows/bin/intel64/ifort.exe supports Fortran 90
-- Checking whether C:/Program Files (x86)/inteloneapi/compiler/latest/windows/bin/intel64/ifort.exe supports Fortran 90 -- yes
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
CMake Error at C:/Users/foo/.local/cmake-3.16.8-win64-x64/share/cmake-3.16/Modules/FindBLAS.cmake:136 (set):
Syntax error in cmake code at
C:/Users/foo/.local/cmake-3.16.8-win64-x64/share/cmake-3.16/Modules/FindBLAS.cmake:136
when parsing string
C:\Program Files (x86)\inteloneapi\mkl\latest/lib/intel64_win
Invalid character escape '\P'.
Call Stack (most recent call first):
C:/Users/foo/.local/cmake-3.16.8-win64-x64/share/cmake-3.16/Modules/FindBLAS.cmake:427 (check_fortran_libraries)
CMakeLists.txt:30 (find_package)
-- Configuring incomplete, errors occurred!
I am happy to provide additional info etc.
same result with Intel Parallel Studio XE 2020 and environment variable MKLROOT=C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2020.1.216\windows\mkl
As for oneAPI, doesn’t matter if CMake is 3.16.8 or 3.18.0-rc3, or if Generator is Ninja or MinGW Makefiles
-- Building for: Ninja
-- The C compiler identification is Intel 19.1.0.20200306
-- The Fortran compiler identification is Intel 19.1.0.20200306
-- Check for working C compiler: C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020.1.216/windows/bin/intel64/icl.exe
-- Check for working C compiler: C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020.1.216/windows/bin/intel64/icl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working Fortran compiler: C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020.1.216/windows/bin/intel64/ifort.exe
-- Check for working Fortran compiler: C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020.1.216/windows/bin/intel64/ifort.exe -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020.1.216/windows/bin/intel64/ifort.exe supports Fortran 90
-- Checking whether C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020.1.216/windows/bin/intel64/ifort.exe supports Fortran 90 -- yes
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
CMake Error at C:/Users/foo/.local/cmake-3.16.8-win64-x64/share/cmake-3.16/Modules/FindBLAS.cmake:136 (set):
Syntax error in cmake code at
C:/Users/foo/.local/cmake-3.16.8-win64-x64/share/cmake-3.16/Modules/FindBLAS.cmake:136
when parsing string
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2020.1.216\windows\mkl/lib/intel64_win
Invalid character escape '\P'.
Call Stack (most recent call first):
C:/Users/foo/.local/cmake-3.16.8-win64-x64/share/cmake-3.16/Modules/FindBLAS.cmake:427 (check_fortran_libraries)
CMakeLists.txt:30 (find_package)
-- Configuring incomplete, errors occurred!
In CMake
, paths must be specified with slashes, not backslashes.
So, if MKLROOT
is specific to CMake
, define it as C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2020.1.216/windows/mkl
. If not, it is required to translate it in CMake
format, using file(TO_CMAKE_PATH ...)
somewhere in the FindBLAS.cmake
module code.
Yes the fix is like
if(WIN32)
file(TO_CMAKE_PATH "$ENV{MKLROOT}" BLAS_mkl_MKLROOT)
else()
set(BLAS_mkl_MKLROOT "$ENV{MKLROOT}")
endif()
1 Like