From f37510e3c0714c91e3acaec993842ea86b00b6e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Mon, 6 Nov 2023 18:19:14 +0100 Subject: [PATCH] ParU: Use sequential factorization unconditionally on Windows with GCC See: https://github.com/DrTimothyAldenDavis/SuiteSparse/pull/500#issuecomment-1794892554 --- ParU/CMakeLists.txt | 13 +++++++++++++ ParU/Source/paru_factorize.cpp | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/ParU/CMakeLists.txt b/ParU/CMakeLists.txt index 440e7e1b74..ff04bd97de 100644 --- a/ParU/CMakeLists.txt +++ b/ParU/CMakeLists.txt @@ -161,6 +161,19 @@ if ( NOT NSTATIC ) $ ) endif ( ) +#------------------------------------------------------------------------------- +# additional definitions +#------------------------------------------------------------------------------- + +if ( WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "GNU" ) + # Some parallelization levels don't work correctly with GCC on Windows + # (because of emuTLS?). Omit them. + target_compile_definitions (ParU PRIVATE PARU_GCC_WINDOWS ) + if ( NOT NSTATIC ) + target_compile_definitions (ParU_static PRIVATE PARU_GCC_WINDOWS ) + endif ( ) +endif ( ) + #------------------------------------------------------------------------------- # add the library dependencies #------------------------------------------------------------------------------- diff --git a/ParU/Source/paru_factorize.cpp b/ParU/Source/paru_factorize.cpp index 51422f2275..e1caa345fa 100644 --- a/ParU/Source/paru_factorize.cpp +++ b/ParU/Source/paru_factorize.cpp @@ -341,6 +341,9 @@ ParU_Ret ParU_Factorize(cholmod_sparse *A, ParU_Symbolic *Sym, // execute the task tree //-------------------------------------------------------------------------- +#if ! defined ( PARU_GCC_WINDOWS ) + // The parallel factorization gets stuck intermittently on Windows with GCC. + // Use the sequential factorization unconditionally in that case. if ((int64_t)task_Q.size() * 2 > Control->paru_max_threads) { printf ("Parallel:\n") ; // FIXME @@ -433,6 +436,7 @@ ParU_Ret ParU_Factorize(cholmod_sparse *A, ParU_Symbolic *Sym, } } else +#endif { PRLEVEL(1, ("Sequential\n")); Work->naft = 1;