From 0f7c4386216bb8c74b4dc1df74ef2053271f9b11 Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Thu, 11 Aug 2022 06:17:22 -0400 Subject: [PATCH] only use LU for CUDA when v1.8+ https://github.com/SciML/PreallocationTools.jl/pull/30#issuecomment-1211427322 --- src/default.jl | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/default.jl b/src/default.jl index bf66837f8..00d06fe33 100644 --- a/src/default.jl +++ b/src/default.jl @@ -47,7 +47,11 @@ function defaultalg(A, b) # This catches the case where A is a CuMatrix # Which does not have LU fully defined elseif A isa GPUArraysCore.AbstractGPUArray || b isa GPUArraysCore.AbstractGPUArray - alg = LUFactorization() + if VERSION >= v"1.8-" + alg = LUFactorization() + else + alg = QRFactorization() + end # Not factorizable operator, default to only using A*x else @@ -118,9 +122,13 @@ function SciMLBase.solve(cache::LinearCache, alg::Nothing, # This catches the case where A is a CuMatrix # Which does not have LU fully defined elseif A isa GPUArraysCore.AbstractGPUArray - alg = LUFactorization() - SciMLBase.solve(cache, alg, args...; kwargs...) - + if VERSION >= v"1.8-" + alg = LUFactorization() + SciMLBase.solve(cache, alg, args...; kwargs...) + else + alg = QRFactorization() + SciMLBase.solve(cache, alg, args...; kwargs...) + end # Not factorizable operator, default to only using A*x # IterativeSolvers is faster on CPU but not GPU-compatible else @@ -185,9 +193,13 @@ function init_cacheval(alg::Nothing, A, b, u, Pl, Pr, maxiters, abstol, reltol, # This catches the case where A is a CuMatrix # Which does not have LU fully defined elseif A isa GPUArraysCore.AbstractGPUArray - alg = LUFactorization() - init_cacheval(alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose) - + if VERSION >= v"1.8-" + alg = LUFactorization() + init_cacheval(alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose) + else + alg = QRFactorization() + init_cacheval(alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose) + end # Not factorizable operator, default to only using A*x # IterativeSolvers is faster on CPU but not GPU-compatible else