Skip to content

Commit

Permalink
Merge #182
Browse files Browse the repository at this point in the history
182: Undo patch in #180 r=charleskawczynski a=charleskawczynski

This didn't work because Krylov uses `Krylov.ktypeof` internally. We need to overload it for FieldVectors. This PR applies the fix and overloads for FieldVectors in the test suite.

Co-authored-by: Charles Kawczynski <kawczynski.charles@gmail.com>
  • Loading branch information
bors[bot] and charleskawczynski authored May 22, 2023
2 parents 4bd4759 + c674e8a commit e064dd1
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ClimaTimeSteppers"
uuid = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
authors = ["Climate Modeling Alliance"]
version = "0.7.5"
version = "0.7.6"

[deps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Expand Down
4 changes: 2 additions & 2 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.8.5"
manifest_format = "2.0"
project_hash = "0445f0b63f403d783217e170583dfd95f7a70fe5"
project_hash = "8397e9864ab4184b6af749a437287a4a333e2a96"

[[deps.ADTypes]]
git-tree-sha1 = "dcfdf328328f2645531c4ddebf841228aef74130"
Expand Down Expand Up @@ -204,7 +204,7 @@ version = "0.2.4"
deps = ["CUDA", "ClimaComms", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "SciMLBase", "StaticArrays"]
path = ".."
uuid = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
version = "0.7.4"
version = "0.7.5"

[[deps.CloseOpenIntervals]]
deps = ["Static", "StaticArrayInterface"]
Expand Down
2 changes: 2 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
ClimaComms = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d"
ClimaCore = "d414da3d-4745-48bb-8d80-42e94e092884"
ClimaCorePlots = "cf7c7e5a-b407-4c48-9047-11a94a308626"
ClimaTimeSteppers = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
Krylov = "ba0b0d4f-ebba-5204-a429-3ac8c609bfb7"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Expand Down
4 changes: 2 additions & 2 deletions perf/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.8.5"
manifest_format = "2.0"
project_hash = "3a6b07d03bd1660efe1ad41af414e397bfedbd6f"
project_hash = "007561ccc3a937bb99d6d0831f5143e3c6352aac"

[[deps.ADTypes]]
git-tree-sha1 = "dcfdf328328f2645531c4ddebf841228aef74130"
Expand Down Expand Up @@ -176,7 +176,7 @@ version = "0.10.34"
deps = ["CUDA", "ClimaComms", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "SciMLBase", "StaticArrays"]
path = ".."
uuid = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
version = "0.7.4"
version = "0.7.5"

[[deps.CloseOpenIntervals]]
deps = ["Static", "StaticArrayInterface"]
Expand Down
1 change: 1 addition & 0 deletions perf/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
ClimaComms = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d"
ClimaCore = "d414da3d-4745-48bb-8d80-42e94e092884"
ClimaTimeSteppers = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Expand Down
8 changes: 1 addition & 7 deletions src/nl_solvers/newtons_method.jl
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,6 @@ end

solver_type(::KrylovMethod{Val{T}}) where {T} = T

# TODO: should we make ClimaCore depend on Krylov.jl and overload
# Krylov.ktypeof for `FieldVector`s?
ct_ktypeof(x) = #= x::ClimaCore.Fields.FieldVector =#
ClimaComms.array_type(x){eltype(parent(x))}
ct_ktypeof(x::Vector) = Krylov.ktypeof(x)

function allocate_cache(alg::KrylovMethod, x_prototype)
(; jacobian_free_jvp, forcing_term, args, kwargs, debugger) = alg
type = solver_type(alg)
Expand All @@ -429,7 +423,7 @@ function allocate_cache(alg::KrylovMethod, x_prototype)
jacobian_free_jvp_cache = isnothing(jacobian_free_jvp) ? nothing :
allocate_cache(jacobian_free_jvp, x_prototype),
forcing_term_cache = allocate_cache(forcing_term, x_prototype),
solver = type(l, l, args..., ct_ktypeof(x_prototype); kwargs...),
solver = type(l, l, args..., Krylov.ktypeof(x_prototype); kwargs...),
debugger_cache = isnothing(debugger) ? nothing : allocate_cache(debugger, x_prototype),
)
end
Expand Down
4 changes: 4 additions & 0 deletions test/problems.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using DiffEqBase, ClimaTimeSteppers, LinearAlgebra, StaticArrays
using ClimaCore
using ClimaComms
import ClimaCore.Domains as Domains
import ClimaCore.Geometry as Geometry
import ClimaCore.Meshes as Meshes
Expand All @@ -8,6 +9,9 @@ import ClimaCore.Spaces as Spaces
import ClimaCore.Fields as Fields
import ClimaCore.Operators as Operators

import Krylov
Krylov.ktypeof(x::Fields.FieldVector) = ClimaComms.array_type(x){eltype(parent(x)), 1}

"""
Single variable linear ODE
Expand Down

2 comments on commit e064dd1

@charleskawczynski
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/84035

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.6 -m "<description of version>" e064dd1439a84f06047ada5700debeaad60d6806
git push origin v0.7.6

Please sign in to comment.