Intel oneMKL ScaLAPACK examples

Intel oneAPI / oneMKL includes Scalapack. MKL Scalapack library & include files are found under the MKLROOT environment variable. Scalapack MKL is used in CMake via MKLConfig.cmake (found under $ENV{MKLROOT}/lib/cmake/MKLConfig.cmake) like:

set(ENABLE_BLACS true)
set(ENABLE_SCALAPACK true)

set(MKL_INTERFACE "lp64")
# "lp64" is the 32-bit interface, "ilp64" is the 64-bit interface

set(MKL_SYCL_MPI false)
set(MKL_SYCL_LINK false)
# for Intel oneAPI 2025.2, we don't need SYCL

find_package(MKL CONFIG REQUIRED)

add_executable(mytest main.f90)
target_link_libraries(mytest PRIVATE MKL::MKL_SCALAPACK)

The MKL_SYCL* variables control whether SYCL is enabled for Intel oneAPI 2025.2 and later, which usually we don’t want.

The exact link flags and compile flags (that are automatically handled by MKLConfig.cmake) for a particular system are obtained from Intel Link Line Advisor.

Intel MKL Scalapack example project

Netlib Scalapack examples can also be used with non-MKL Scalapack.