From e63fade1e2c56889f6a29bd07d44c633b644a633 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Tue, 30 Jul 2024 01:38:40 -0400 Subject: [PATCH] Don't default to MKL on EPYC (#518) * Don't default to MKL on EPYC * import correctly * Update Project.toml * Update Project.toml Co-authored-by: Chris Elrod * Update qa.jl * Update static_arrays.jl * Update test/static_arrays.jl * Update test/static_arrays.jl * Update adjoint.jl * Update test/adjoint.jl * Update static_arrays.jl * Update static_arrays.jl * Update test/static_arrays.jl * Update static_arrays.jl * Update test/static_arrays.jl * Update test/static_arrays.jl Co-authored-by: Chris Elrod --------- Co-authored-by: Chris Elrod --- Project.toml | 2 ++ src/LinearSolve.jl | 3 ++- test/adjoint.jl | 2 +- test/qa.jl | 2 +- test/static_arrays.jl | 8 +++----- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Project.toml b/Project.toml index 6fcabb6a5..2b23a13ab 100644 --- a/Project.toml +++ b/Project.toml @@ -7,6 +7,7 @@ version = "2.30.2" ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471" +CpuId = "adafc99b-e345-5852-983c-f28acb93d879" DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56" FastLapackInterface = "29a986be-02c6-4525-aec4-84b980013641" @@ -72,6 +73,7 @@ CUDA = "5" CUDSS = "0.1, 0.2, 0.3" ChainRulesCore = "1.22" ConcreteStructs = "0.2.3" +CpuId = "0.3.1" DocStringExtensions = "0.9.3" EnumX = "1.0.4" Enzyme = "0.11.15, 0.12" diff --git a/src/LinearSolve.jl b/src/LinearSolve.jl index 894c6e0d8..f166f6b45 100644 --- a/src/LinearSolve.jl +++ b/src/LinearSolve.jl @@ -41,10 +41,11 @@ import PrecompileTools import Krylov using SciMLBase import Preferences + import CpuId const CRC = ChainRulesCore -if Preferences.@load_preference("LoadMKL_JLL", true) +if Preferences.@load_preference("LoadMKL_JLL", !occursin("EPYC", CpuId.cpubrand())) using MKL_jll const usemkl = MKL_jll.is_available() else diff --git a/test/adjoint.jl b/test/adjoint.jl index 7c8b8f4b9..809feba8a 100644 --- a/test/adjoint.jl +++ b/test/adjoint.jl @@ -62,7 +62,7 @@ db12 = FiniteDiff.finite_difference_gradient( db22 = FiniteDiff.finite_difference_gradient( x -> f3(eltype(x).(A), eltype(x).(b1), x), copy(b1)) -@test dA≈dA2 atol=1e-4 +@test dA≈dA2 rtol=1e-3 @test db1 ≈ db12 @test db2 ≈ db22 diff --git a/test/qa.jl b/test/qa.jl index 5c4f3e061..9b4045063 100644 --- a/test/qa.jl +++ b/test/qa.jl @@ -6,7 +6,7 @@ using LinearSolve, Aqua Aqua.test_piracies(LinearSolve, treat_as_own = [LinearProblem]) Aqua.test_project_extras(LinearSolve) - Aqua.test_stale_deps(LinearSolve) + Aqua.test_stale_deps(LinearSolve, ignore = [:MKL_jll]) Aqua.test_unbound_args(LinearSolve) Aqua.test_undefined_exports(LinearSolve) end diff --git a/test/static_arrays.jl b/test/static_arrays.jl index 300c86c25..0e78d8b69 100644 --- a/test/static_arrays.jl +++ b/test/static_arrays.jl @@ -17,13 +17,11 @@ for alg in (nothing, LUFactorization(), SVDFactorization(), CholeskyFactorizatio sol = solve(LinearProblem(A, b), alg) @inferred solve(LinearProblem(A, b), alg) @test norm(A * sol .- b) < 1e-10 - - if __non_native_static_array_alg(alg) - @test_broken __solve_no_alloc(A, b, alg) + if alg isa KrylovJL{typeof(LinearSolve.Krylov.gmres!)} + @test_broken __solve_no_alloc(A, b, alg) isa SciMLBase.LinearSolution else - @test_nowarn __solve_no_alloc(A, b, alg) + @test_nowarn __solve_no_alloc(A, b, alg) isa SciMLBase.LinearSolution end - cache = init(LinearProblem(A, b), alg) sol = solve!(cache) @test norm(A * sol .- b) < 1e-10