Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intel Fortran and MKL build on Windows with CMake #223

Open
shoubhikraj opened this issue Aug 9, 2021 · 0 comments
Open

Intel Fortran and MKL build on Windows with CMake #223

shoubhikraj opened this issue Aug 9, 2021 · 0 comments

Comments

@shoubhikraj
Copy link

I am trying to build Global Arrays on Windows for a program that needs this library. The default build with Microsoft Visual C++ turns off Fortran build presumably because there is no default fortran compiler on Windows. However, Intel's oneAPI provides a compact build environment where both Intel C/C++ and Fortran compilers are available along with Intel MKL. So, I am trying to get a CMake build working with the Intel oneAPI command line build environment.

I had to modify CMakeLists.txt and cmake/linalg-modules/FindIntelMKL.cmake to allow CMake to use Fortran and find the MKL libraries (which are present with .lib extension instead of .a extension).

CMake detects the libraries that are required for linking to MKL correctly, but the BLAS tests fail.

> set CC=icl
> set CXX=icl
> set FC=ifort
> CMake -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE -DBUILD_SHARED_LIBS=OFF -DENABLE_FORTRAN=ON -DENABLE_CXX=OFF -DENABLE_TESTS=OFF -DENABLE_BLAS=ON -DLINALG_VENDOR=IntelMKL -DLINALG_PREFIX="C:/Program Files (x86)/Intel/oneAPI/mkl/latest/" -DLINALG_THREAD_LAYER=sequential -DLINALG_REQUIRED_COMPONENTS=ilp64 -DENABLE_I8=ON -S. -B./build -G"NMake Makefiles"

-- The C compiler identification is Intel 20.2.1.20201112
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/intel64/icl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- CMAKE_MODULE_PATH: G:/Installer/OpenMolcas-master/ga-master/ga-master/cmake/linalg-modules;G:/Installer/OpenMolcas-master/ga-master/ga-master/cmake
-- Value of ENABLE_CXX was set by user to : OFF
-- Value of ENABLE_FORTRAN was set by user to : ON
-- Setting value of CMAKE_CXX_EXTENSIONS to default : OFF
-- The Fortran compiler identification is Intel 20.2.1.20201112
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/intel64/ifort.exe - skipped
-- Checking whether C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/intel64/ifort.exe supports Fortran 90
-- Checking whether C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/intel64/ifort.exe supports Fortran 90 - yes
-- Value of CMAKE_BUILD_TYPE was set by user to : Debug
-- Value of LINALG_VENDOR was set by user to : IntelMKL
-- Value of ENABLE_TESTS was set by user to : OFF
-- Setting value of ENABLE_PROFILING to default : OFF
-- Value of ENABLE_BLAS was set by user to : ON
-- Setting value of ENABLE_SCALAPACK to default : OFF
-- Setting value of ENABLE_EISPACK to default : OFF
-- Setting value of ENABLE_DPCPP to default : OFF
-- Setting value of GA_RUNTIME to default : MPI_2SIDED
-- Checking MPI ...
-- Found MPI_C: C:/Program Files (x86)/Intel/oneAPI/mpi/latest/lib/release/impi.lib (found version "3.1")
-- Found MPI_Fortran: C:/Program Files (x86)/Intel/oneAPI/mpi/latest/lib/release/impi.lib (found version "3.1")
-- Found MPI: TRUE (found version "3.1")
-- Performing Test HAVE_RESTRICT
-- Performing Test HAVE_RESTRICT - Success
-- Performing Test HAVE_INLINE_NATIVE
-- Performing Test HAVE_INLINE_NATIVE - Success
-- Performing Test HAVE_PAUSE
-- Performing Test HAVE_PAUSE - Failed
-- Performing Test HAVE_LONG_DOUBLE
-- Performing Test HAVE_LONG_DOUBLE - Success
-- Performing Test HAVE_SYS_WEAK_ALIAS_PRAGMA
-- Performing Test HAVE_SYS_WEAK_ALIAS_PRAGMA - Failed
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of int
-- Check size of int - done
-- Check size of double
-- Check size of double - done
-- Check size of float
-- Check size of float - done
-- Check size of long
-- Check size of long - done
-- Check size of long double
-- Check size of long double - done
-- Check size of long long
-- Check size of long long - done
-- Check size of short
-- Check size of short - done
-- Looking for include file assert.h
-- Looking for include file assert.h - found
-- Looking for include file limits.h
-- Looking for include file limits.h - found
-- Looking for include file linux/limits.h
-- Looking for include file linux/limits.h - not found
-- Looking for include file malloc.h
-- Looking for include file malloc.h - found
-- Looking for include file math.h
-- Looking for include file math.h - found
-- Looking for include file stdio.h
-- Looking for include file stdio.h - found
-- Looking for include file stdlib.h
-- Looking for include file stdlib.h - found
-- Looking for include file strings.h
-- Looking for include file strings.h - not found
-- Looking for include file string.h
-- Looking for include file string.h - found
-- Looking for include file unistd.h
-- Looking for include file unistd.h - not found
-- Looking for include file windows.h
-- Looking for include file windows.h - found
-- Looking for bzero
-- Looking for bzero - not found
-- Detecting Fortran/C Interface
-- Detecting Fortran/C Interface - Found GLOBAL and MODULE mangling
-- void size: 8, USE_I8: ON, ENABLE_I8: ON
-- BLAS_LIBRARIES Not Given: Will Perform Search
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found IntelMKL: -Wl,--start-group;C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_intel_ilp64.lib;C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_sequential.lib;C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_core.lib;-Wl,--end-group;m;dl;Threads::Threads (found version "2021.0.1") found components: ilp64 ilp64
-- Performing Test BLAS_LOWER_UNDERSCORE
-- Performing Test BLAS_LOWER_UNDERSCORE -- not found
-- Performing Test BLAS_LOWER_NO_UNDERSCORE
-- Performing Test BLAS_LOWER_NO_UNDERSCORE -- not found
-- Performing Test BLAS_UPPER_UNDERSCORE
-- Performing Test BLAS_UPPER_UNDERSCORE -- not found
-- Performing Test BLAS_UPPER_NO_UNDERSCORE
-- Performing Test BLAS_UPPER_NO_UNDERSCORE -- not found
-- Could NOT find BLAS (missing: BLAS_LINK_OK ilp64)
CMake Error at cmake/ga-linalg.cmake:159 (message):
  ENABLE_BLAS=ON, but a LAPACK library was not found
Call Stack (most recent call first):
  CMakeLists.txt:159 (include)


-- Configuring incomplete, errors occurred!
See also "G:/Installer/OpenMolcas-master/ga-master/ga-master/build/CMakeFiles/CMakeOutput.log".
See also "G:/Installer/OpenMolcas-master/ga-master/ga-master/build/CMakeFiles/CMakeError.log".

On Windows, Fortran expects symbols in uppercase without underscore, so I believe that the BLAS_UPPER_NO_UNDERSCORE test should work. I am not sure where the problem is, so any help in solving this would be greatly appreciated. I believe this is a problem with the cmake code in global arrays, as it cannot correctly detect MKL on Windows (command line compilation with Intel Fortran works).

@shoubhikraj shoubhikraj changed the title Fortran and Intel MKL build on Windows Intel Fortran and MKL build on Windows with CMake Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant