Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

oneMKL PARDISO Minimal CMake Example

A small, self-checking C++17 example that solves a real nonsymmetric sparse linear system with Intel oneMKL PARDISO.

The example demonstrates:

  • zero-based CSR storage;
  • MKL_INT for LP64/ILP64 portability;
  • pardisoinit parameter initialization;
  • the combined analysis/factorization/solve phase (phase = 13);
  • the required release phase (phase = -1);
  • verification against a manufactured exact solution.

Requirements

  • CMake 3.18 or newer;
  • a C++17 compiler;
  • Intel oneAPI MKL with its CMake package available.

Source the oneAPI environment first when using a standard installation:

source /opt/intel/oneapi/setvars.sh

Build and test

git clone https://github.com/2002WYT/mkl-pardiso-minimal-example.git
cd mkl-pardiso-minimal-example
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
ctest --test-dir build --output-on-failure

Run directly:

./build/mkl_pardiso_example

Expected output is a solution close to five ones and a relative solution error near machine precision.

LP64 and ILP64

LP64 is the default:

cmake -S . -B build -DMKL_INTERFACE=lp64

For 64-bit sparse indices, configure a separate build with the ILP64 interface:

cmake -S . -B build-ilp64 -DMKL_INTERFACE=ilp64
cmake --build build-ilp64 -j
ctest --test-dir build-ilp64 --output-on-failure

The source uses MKL_INT throughout, so its index type follows the selected oneMKL interface.

Threading layer

The example defaults to sequential oneMKL for a deterministic minimal dependency set. Select a threaded layer at configure time when needed:

cmake -S . -B build-threaded \
  -DMKL_THREADING=intel_thread \
  -DCMAKE_BUILD_TYPE=Release

Matrix used by the example

[1 0 2 2 0]
[0 1 0 0 3]
[0 0 1 2 0]
[0 0 0 1 0]
[0 0 0 0 2]

The right-hand side is constructed as b = A * 1, making the expected solution known before PARDISO runs.

Scope

This repository intentionally stays minimal. It currently demonstrates real nonsymmetric matrices (mtype = 11) stored in memory. Matrix Market parsing, symmetric matrix types, and complex arithmetic are good extensions but are not part of this small smoke test.

The repository does not yet declare a software license; public visibility alone does not grant reuse rights.

About

Minimal self-checking C++17 and CMake example for Intel oneMKL PARDISO with LP64 and ILP64 support.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages