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

Demonstrate gpu inference fix #2076

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all 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
27 changes: 13 additions & 14 deletions test/Fields/inference_repro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@ import ClimaComms
ClimaComms.@import_required_backends
import ClimaCore: Fields, Domains, Geometry, Meshes, Spaces

macro ConstantValue(T)
quote
Base.broadcastable(x::$T) = x
Base.axes(x::$T) = ()
Base.getindex(x::$T, i...) = x
Base.getindex(x::$T, i) = x
Base.ndims(x::Type{<:$T}) = 0
end
end

struct LandParameters{FT}
ρ_cloud_ice::FT
end
Base.broadcastable(x::LandParameters) = tuple(x)
@ConstantValue LandParameters

struct vanGenuchten{FT}
α::FT
end
Base.broadcastable(x::vanGenuchten) = tuple(x)
@ConstantValue vanGenuchten

function phase_change_source(
θ_l::FT,
Expand Down Expand Up @@ -64,16 +74,5 @@ end

using Test
@testset "GPU inference failure" begin
if ClimaComms.device() isa ClimaComms.CUDADevice
@test_broken try
main(Float64)
true
catch e
@assert occursin("GPUCompiler.InvalidIRError", string(e))
@assert occursin("dynamic function invocation", e.errors[1][1])
false
end
else
main(Float64)
end
main(Float64)
end
Loading