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

deprecate RecursiveVec, improve x0 initialisation for GPU #97

Merged
merged 9 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/ci-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ jobs:
- 'nightly'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6' # LTS version
- '1.6'
- 'lts'
- '1' # automatically expands to the latest stable 1.x release of Julia
os:
- ubuntu-latest
Expand All @@ -31,11 +32,11 @@ jobs:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
- uses: julia-actions/julia-processcoverage@v1
Expand All @@ -52,20 +53,19 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6' # LTS version
- 'lts'
- '1' # automatically expands to the latest stable 1.x release of Julia
os:
- ubuntu-latest
- macOS-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
Expand Down
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8"

[weakdeps]
Expand All @@ -27,7 +28,7 @@ PackageExtensionCompat = "1"
Printf = "1"
Random = "1"
Test = "1"
TestExtras = "0.2"
TestExtras = "0.2,0.3"
VectorInterface = "0.4"
Zygote = "0.6"
julia = "1.6"
Expand All @@ -37,10 +38,9 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
ChainRulesTestUtils = "cdddcdb0-9152-4a09-a978-84456f9df70a"
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[targets]
test = ["Test", "Aqua", "Random", "TestExtras", "ChainRulesTestUtils", "ChainRulesCore", "FiniteDifferences", "Zygote"]
test = ["Test", "Aqua", "TestExtras", "ChainRulesTestUtils", "ChainRulesCore", "FiniteDifferences", "Zygote"]
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ include("utilities.jl")
include("linsolve.jl")
include("eigsolve.jl")
include("svdsolve.jl")
include("constructor.jl")

end # module
6 changes: 0 additions & 6 deletions ext/KrylovKitChainRulesCoreExt/constructor.jl

This file was deleted.

1 change: 1 addition & 0 deletions ext/KrylovKitChainRulesCoreExt/eigsolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ function make_eigsolve_pullback(config, f, fᴴ, x₀, howmany, which, alg_prima
end
end
end

# Compute actual pullback data:
#------------------------------
ws = compute_eigsolve_pullback_data(Δvals, Δvecs, view(vals, 1:n), view(vecs, 1:n),
Expand Down
3 changes: 2 additions & 1 deletion src/KrylovKit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ using VectorInterface
using VectorInterface: add!!
using LinearAlgebra
using Printf
using Random
using GPUArraysCore
using PackageExtensionCompat
const IndexRange = AbstractRange{Int}
Expand Down Expand Up @@ -238,7 +239,7 @@ include("matrixfun/exponentiate.jl")
include("matrixfun/expintegrator.jl")

# custom vector types
include("recursivevec.jl")
include("innerproductvec.jl")
Base.@deprecate(RecursiveVec(args...), tuple(args...))

end
4 changes: 3 additions & 1 deletion src/eigsolve/eigsolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,14 @@ EigSorter(f::F; rev=false) where {F} = EigSorter{F}(f, rev)

const Selector = Union{Symbol,EigSorter}

# TODO: initialize with `Random.rand!(similar(A, size(A, 1)))` for GPU arrays
Jutho marked this conversation as resolved.
Show resolved Hide resolved
function eigsolve(A::AbstractMatrix,
howmany::Int=1,
which::Selector=:LM,
T::Type=eltype(A);
kwargs...)
return eigsolve(A, rand(T, size(A, 1)), howmany, which; kwargs...)
x₀ = Random.rand!(similar(A, T, size(A, 1)))
return eigsolve(A, x₀, howmany, which; kwargs...)
end

function eigsolve(f, n::Int, howmany::Int=1, which::Selector=:LM, T::Type=Float64;
Expand Down
9 changes: 6 additions & 3 deletions src/eigsolve/geneigsolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,21 +150,24 @@ function geneigsolve(AB::Tuple{AbstractMatrix,AbstractMatrix},
if !(size(AB[1], 1) == size(AB[1], 2) == size(AB[2], 1) == size(AB[2], 2))
throw(DimensionMismatch("Matrices `A` and `B` should be square and have matching size"))
end
return geneigsolve(AB, rand(T, size(AB[1], 1)), howmany::Int, which; kwargs...)
x₀ = Random.rand!(similar(AB[1], T, size(AB[1], 1)))
return geneigsolve(AB, x₀, howmany::Int, which; kwargs...)
end
function geneigsolve(AB::Tuple{Any,AbstractMatrix},
howmany::Int=1,
which::Selector=:LM,
T=eltype(AB[2]);
kwargs...)
return geneigsolve(AB, rand(T, size(AB[2], 1)), howmany, which; kwargs...)
x₀ = Random.rand!(similar(AB[2], T, size(AB[2], 1)))
return geneigsolve(AB, x₀, howmany, which; kwargs...)
end
function geneigsolve(AB::Tuple{AbstractMatrix,Any},
howmany::Int=1,
which::Selector=:LM,
T=eltype(AB[1]);
kwargs...)
return geneigsolve(AB, rand(T, size(AB[1], 1)), howmany, which; kwargs...)
x₀ = Random.rand!(similar(AB[1], T, size(AB[1], 1)))
return geneigsolve(AB, x₀, howmany, which; kwargs...)
end

function geneigsolve(f,
Expand Down
3 changes: 2 additions & 1 deletion src/eigsolve/svdsolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ function svdsolve(A::AbstractMatrix,
which::Selector=:LR,
T::Type=eltype(A);
kwargs...)
return svdsolve(A, rand(T, size(A, 1)), howmany, which; kwargs...)
x₀ = Random.rand!(similar(A, T, size(A, 1)))
return svdsolve(A, x₀, howmany, which; kwargs...)
end
function svdsolve(f, n::Int, howmany::Int=1, which::Selector=:LR, T::Type=Float64;
kwargs...)
Expand Down
117 changes: 0 additions & 117 deletions src/recursivevec.jl

This file was deleted.

Loading