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

Compiling on Windows doesn't seem to use OpenMP #890

Open
jplauzie opened this issue Nov 28, 2024 · 0 comments
Open

Compiling on Windows doesn't seem to use OpenMP #890

jplauzie opened this issue Nov 28, 2024 · 0 comments
Assignees

Comments

@jplauzie
Copy link

jplauzie commented Nov 28, 2024

Hi,

Describe the bug
I've recently compiled Suitesparse for Windows. It does successfully compile, I am able to call CHOLMOD in my own source .cpp file, and it does solve the problem. However, it does not seem to be using OpenMP (and I'm not sure if it's using the BLAS). The performance does not change if I set nthreads_max from 1,6 or 12. The CPU also seems to be under-utilized at ~13% and takes ~57seconds for my test input. For comparison, the naive built-in Matlab backslash function (following the output from spparms to try to keep it comparable) typically has ~50-86% CPU utilization and solves in ~5.8-6seconds for the same matrix.

To Reproduce
I was compiling using Intel's oneAPI, as it seemed to have an easier time automatically finding libraries (and similar to previous posts like this one). I also tried MSYS2's Mingw64, and it seemed to have the same problem. The compile instructions I used were:

set CC=icx
set CXX=icx

cmake -DCMAKE_CXX_COMPILER=icx-cl -DCMAKE_C_COMPILER=icx-cl -DSUITESPARSE_USE_FORTRAN=OFF -DSUITESPARSE_USE_CUDA=OFF -DSUITESPARSE_ENABLE_PROJECTS="amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack" --fresh ..

cmake --build . --config Release
cmake --install .

I did try some variants such as the below (for instance, explicitly specifying BLAS/LAPACK libraries, not setting CXX so that it defaults to MSVC's cl.exe compilers, and with SUITESPARSE_USE_STRICT to force 64bit BLAS), but it did not seem to have an effect.

cmake -G Ninja -D CMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER="C:\Program Files (x86)\Intel\oneAPI\compiler\2025.0\bin\icx-cl.exe" -DCMAKE_C_COMPILER="C:\Program Files (x86)\Intel\oneAPI\compiler\2025.0\bin\icx-cl.exe" -DSUITESPARSE_USE_FORTRAN=OFF -DSUITESPARSE_USE_CUDA=OFF -DBLAS_LIBRARIES="C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/mkl_intel_lp64_dll.lib;C:/Program Files (x86)/Intel/oneAPI/compiler/latest/lib/libiomp5md.lib;C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/mkl_intel_thread_dll.lib;C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/mkl_core_dll.lib" -DSUITESPARSE_USE_LAPACK="C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/mkl_intel_lp64_dll.lib;C:/Program Files (x86)/Intel/oneAPI/compiler/latest/lib/libiomp5md.lib;C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/mkl_intel_thread_dll.lib;C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/mkl_core_dll.lib" -DSUITESPARSE_USE_STRICT=ON -DSUITESPARSE_ENABLE_PROJECTS="amd;btf;camd;ccolamd;colamd;cholmod;cxsparse;ldl;klu;umfpack" --fresh ..

After Suitesparse is compiled, I am compiling my project in MSVC (using O2 flag, and also /Openmp or /Qopenmp). I also tried using icx to compile my program, to see if there was some compability issue, with

icx-cl source.cpp -O2 -Qiopenmp -I"C:\Users\Josh\source\repos\Project3" -I"C:\Program Files (x86)\SuiteSparse\include\suitesparse" -I"C:\cuda\include" /LIBPATH:"C:\Users\Josh\source\repos\Project3" libcholmod.lib /OUT:output.exe

inside the oneAPI commandline.

Expected behavior
The time to solve should be similar to Matlab, and it should noticeably scale when setting nthreads_max.

Screenshots
Here is a screenshot of some of the compiler output (full output is attached in a .txt file):
cholmodoutput1
cholmodoutput2

Desktop (please complete the following information):

  • OS: Windows
  • compiler: intel's icx-cl Version 2025.0.1 Build 20241113
  • BLAS and LAPACK library: Intel's MKL libraries
  • Version 2025.0

Additional context
My source program is able to call multiple threads using OpenMP.

cholmodcompileoutput.txt
matlabcholmodoutput.txt
headerh.txt
sourcecpp.txt

edit: fixed source file upload, it was missing some headers (doesn't change result).

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

2 participants