From 4c46de051f512862b3675ddd850280f2256beae1 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 20 Aug 2025 18:08:51 -0400 Subject: [PATCH 1/7] Remove SparseMatrixColorings as a dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SparseMatrixColorings was only imported in NonlinearSolve.jl but never actually used. The actual implementation is in NonlinearSolveBase where it's already a weakdep with an extension. Changes: - Removed the `using SparseMatrixColorings` import from src/NonlinearSolve.jl - Removed SparseMatrixColorings from deps and weakdeps - Kept it in test extras since it's needed for testing automatic sparse differentiation This reduces the dependency load for all users. Those who need sparse AD support will get it through NonlinearSolveBase's extension when they load SparseMatrixColorings. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- Project.toml | 31 ++++++++++--------------------- src/NonlinearSolve.jl | 3 --- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/Project.toml b/Project.toml index 6e897bae3..cf4f48553 100644 --- a/Project.toml +++ b/Project.toml @@ -26,7 +26,6 @@ Preferences = "21216c6a-2e73-6563-6e65-726566657250" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" SimpleNonlinearSolve = "727e6d20-b764-4bd8-a329-72de5adea6c7" -SparseMatrixColorings = "0a514795-09f3-496d-8182-132a7b665d35" StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5" @@ -45,6 +44,14 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" SpeedMapping = "f1835b91-879b-4a3f-a438-e4baacf14412" Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4" +[sources] +BracketingNonlinearSolve = {path = "lib/BracketingNonlinearSolve"} +NonlinearSolveBase = {path = "lib/NonlinearSolveBase"} +NonlinearSolveFirstOrder = {path = "lib/NonlinearSolveFirstOrder"} +NonlinearSolveQuasiNewton = {path = "lib/NonlinearSolveQuasiNewton"} +NonlinearSolveSpectralMethods = {path = "lib/NonlinearSolveSpectralMethods"} +SimpleNonlinearSolve = {path = "lib/SimpleNonlinearSolve"} + [extensions] NonlinearSolveFastLevenbergMarquardtExt = "FastLevenbergMarquardt" NonlinearSolveFixedPointAccelerationExt = "FixedPointAcceleration" @@ -142,6 +149,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" ReTestItems = "817f1d60-ba6b-4fd5-9520-3cf149f6a823" SIAMFANLEquations = "084e46ad-d928-497d-ad5e-07fa361a48c4" SparseConnectivityTracer = "9f842d2f-2579-4b1d-911e-f412cf18a3f5" +SparseMatrixColorings = "0a514795-09f3-496d-8182-132a7b665d35" SpeedMapping = "f1835b91-879b-4a3f-a438-e4baacf14412" StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" @@ -149,24 +157,5 @@ Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" -[sources.BracketingNonlinearSolve] -path = "lib/BracketingNonlinearSolve" - -[sources.NonlinearSolveBase] -path = "lib/NonlinearSolveBase" - -[sources.NonlinearSolveFirstOrder] -path = "lib/NonlinearSolveFirstOrder" - -[sources.NonlinearSolveQuasiNewton] -path = "lib/NonlinearSolveQuasiNewton" - -[sources.NonlinearSolveSpectralMethods] -path = "lib/NonlinearSolveSpectralMethods" - -[sources.SimpleNonlinearSolve] -path = "lib/SimpleNonlinearSolve" - [targets] -test = ["Aqua", "BandedMatrices", "BenchmarkTools", "CUDA", "ExplicitImports", "FastLevenbergMarquardt", "FixedPointAcceleration", "Hwloc", "InteractiveUtils", "LeastSquaresOptim", "LineSearches", "MINPACK", "NLSolvers", "NLsolve", "NaNMath", "NonlinearProblemLibrary", "OrdinaryDiffEqTsit5", "PETSc", "Pkg", "PolyesterForwardDiff", "Random", "ReTestItems", "SIAMFANLEquations", "SparseConnectivityTracer", "SpeedMapping", "StableRNGs", "StaticArrays", "Sundials", "Test", "Zygote"] - +test = ["Aqua", "BandedMatrices", "BenchmarkTools", "CUDA", "ExplicitImports", "FastLevenbergMarquardt", "FixedPointAcceleration", "Hwloc", "InteractiveUtils", "LeastSquaresOptim", "LineSearches", "MINPACK", "NLSolvers", "NLsolve", "NaNMath", "NonlinearProblemLibrary", "OrdinaryDiffEqTsit5", "PETSc", "Pkg", "PolyesterForwardDiff", "Random", "ReTestItems", "SIAMFANLEquations", "SparseConnectivityTracer", "SparseMatrixColorings", "SpeedMapping", "StableRNGs", "StaticArrays", "Sundials", "Test", "Zygote"] diff --git a/src/NonlinearSolve.jl b/src/NonlinearSolve.jl index e7bbf82b2..8eddf0712 100644 --- a/src/NonlinearSolve.jl +++ b/src/NonlinearSolve.jl @@ -30,9 +30,6 @@ using SimpleNonlinearSolve: SimpleBroyden, SimpleKlement using FiniteDiff: FiniteDiff # Default Finite Difference Method using ForwardDiff: ForwardDiff, Dual # Default Forward Mode AD -# Sparse AD Support: Implemented via extensions in NonlinearSolveBase -using SparseMatrixColorings: SparseMatrixColorings - # Sub-Packages that are re-exported by NonlinearSolve using BracketingNonlinearSolve: BracketingNonlinearSolve using LineSearch: LineSearch From bff0f241abb1bb61beb84ca20e896126b9370d5b Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 21 Aug 2025 14:34:48 -0400 Subject: [PATCH 2/7] Fix Hwloc CPU core detection returning 0 in CI environments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply the same fix from ModelingToolkit.jl (d7f7ed0) to handle cases where Hwloc.num_physical_cores() and Hwloc.num_virtual_cores() return 0 in certain CI environments. This prevents the "input string is empty" parse error by ensuring we always have at least 1 core. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- test/runtests.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index a9c5183ea..8cc0d994e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -23,14 +23,14 @@ const RETESTITEMS_NWORKERS = if GROUP == "wrappers" else parse( Int, get(ENV, "RETESTITEMS_NWORKERS", - string(min(ifelse(Sys.iswindows(), 0, Hwloc.num_physical_cores()), 4)) + string(min(ifelse(Sys.iswindows(), 0, max(Hwloc.num_physical_cores(), 1)), 4)) ) ) end const RETESTITEMS_NWORKER_THREADS = parse(Int, get( ENV, "RETESTITEMS_NWORKER_THREADS", - string(max(Hwloc.num_virtual_cores() ÷ max(RETESTITEMS_NWORKERS, 1), 1)) + string(max(max(Hwloc.num_virtual_cores(), 1) ÷ max(RETESTITEMS_NWORKERS, 1), 1)) ) ) From 659ed928fe9f69e32f1a4d2b40596578f3fd84b9 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas Date: Thu, 21 Aug 2025 16:26:04 -0400 Subject: [PATCH 3/7] Fix Hwloc handling for Windows CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous fix didn't properly handle the Windows case where ifelse(Sys.iswindows(), 0, ...) would return 0, causing the min() to always select 0, leading to an empty string parse error. Now we ensure at least 1 core even on Windows by wrapping the entire ifelse expression with max(..., 1). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 8cc0d994e..35e6bf4f2 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -23,7 +23,7 @@ const RETESTITEMS_NWORKERS = if GROUP == "wrappers" else parse( Int, get(ENV, "RETESTITEMS_NWORKERS", - string(min(ifelse(Sys.iswindows(), 0, max(Hwloc.num_physical_cores(), 1)), 4)) + string(min(max(ifelse(Sys.iswindows(), 0, Hwloc.num_physical_cores()), 1), 4)) ) ) end From 0ed3ac436a38b8e61d2b398a249c3daf3d519e9c Mon Sep 17 00:00:00 2001 From: ChrisRackauckas Date: Thu, 21 Aug 2025 17:06:20 -0400 Subject: [PATCH 4/7] Revert "Fix Hwloc handling for Windows CI" This reverts commit 659ed928fe9f69e32f1a4d2b40596578f3fd84b9. --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 35e6bf4f2..8cc0d994e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -23,7 +23,7 @@ const RETESTITEMS_NWORKERS = if GROUP == "wrappers" else parse( Int, get(ENV, "RETESTITEMS_NWORKERS", - string(min(max(ifelse(Sys.iswindows(), 0, Hwloc.num_physical_cores()), 1), 4)) + string(min(ifelse(Sys.iswindows(), 0, max(Hwloc.num_physical_cores(), 1)), 4)) ) ) end From f2c8c8fca54a1584c3b823f1eba461c8d5e5f620 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Thu, 21 Aug 2025 17:34:22 -0400 Subject: [PATCH 5/7] Update test/runtests.jl --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 8cc0d994e..ce108eb57 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -23,7 +23,7 @@ const RETESTITEMS_NWORKERS = if GROUP == "wrappers" else parse( Int, get(ENV, "RETESTITEMS_NWORKERS", - string(min(ifelse(Sys.iswindows(), 0, max(Hwloc.num_physical_cores(), 1)), 4)) + string(min(ifelse(Sys.iswindows(), 0, Hwloc.num_physical_cores()), 4)) ) ) end From a030ee150773ffa58b69ca04573bc9e271ca26f2 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Thu, 21 Aug 2025 17:34:57 -0400 Subject: [PATCH 6/7] Update test/runtests.jl --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index ce108eb57..a9c5183ea 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -30,7 +30,7 @@ end const RETESTITEMS_NWORKER_THREADS = parse(Int, get( ENV, "RETESTITEMS_NWORKER_THREADS", - string(max(max(Hwloc.num_virtual_cores(), 1) ÷ max(RETESTITEMS_NWORKERS, 1), 1)) + string(max(Hwloc.num_virtual_cores() ÷ max(RETESTITEMS_NWORKERS, 1), 1)) ) ) From 2def5555d7eceebd74e8f59b9039181c840a542a Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Thu, 21 Aug 2025 18:04:14 -0400 Subject: [PATCH 7/7] Update runtests.jl --- test/runtests.jl | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index a9c5183ea..dcfb869ff 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -21,18 +21,15 @@ length(EXTRA_PKGS) ≥ 1 && Pkg.add(EXTRA_PKGS) const RETESTITEMS_NWORKERS = if GROUP == "wrappers" 0 # Sequential execution for wrapper tests else - parse( - Int, get(ENV, "RETESTITEMS_NWORKERS", - string(min(ifelse(Sys.iswindows(), 0, Hwloc.num_physical_cores()), 4)) - ) - ) + tmp = get(ENV, "RETESTITEMS_NWORKERS", "") + isempty(tmp) && (tmp = string(min(ifelse(Sys.iswindows(), 0, Hwloc.num_physical_cores()), 4))) + parse(Int, tmp) +end +const RETESTITEMS_NWORKER_THREADS = begin + tmp = get(ENV, "RETESTITEMS_NWORKER_THREADS", "") + isempty(tmp) && (tmp = string(max(Hwloc.num_virtual_cores() ÷ max(RETESTITEMS_NWORKERS, 1), 1))) + parse(Int, tmp) end -const RETESTITEMS_NWORKER_THREADS = parse(Int, - get( - ENV, "RETESTITEMS_NWORKER_THREADS", - string(max(Hwloc.num_virtual_cores() ÷ max(RETESTITEMS_NWORKERS, 1), 1)) - ) -) @info "Running tests for group: $(GROUP) with $(RETESTITEMS_NWORKERS) workers"