Skip to content

Commit f3dd2e0

Browse files
committed
fix bad CUDA warning
1 parent 3e52100 commit f3dd2e0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/proj_lambert.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@ ProjLambert(;Ny, Nx, θpix=1, rotator=(0,90,0), T=Float32, storage=Array) =
4646

4747
@memoize function ProjLambert(Ny, Nx, θpix, rotator, ::Type{T}, storage) where {T}
4848

49-
if @isdefined(CUDA) && CUDA.runtime_version() >= v"11.5" && (Ny*Nx > 1024^2)
49+
# storage might be e.g. CuArrayAdaptor which will force T to be Float32
50+
test_arr = adapt(storage, Vector{T}())
51+
T′ = eltype(test_arr)
52+
53+
if @isdefined(CUDA) && CUDA.functional() && CUDA.runtime_version() >= v"11.5" && (Ny*Nx > 1024^2) && (test_arr isa CUDA.CuArray)
5054
@warn("For maps with >1024² pixels, CUDA Toolkit >= 11.5 is known to have FFT instabilties, please downgrade.")
5155
end
5256

53-
# storage might be e.g. CuArrayAdaptor which will force T to be Float32
54-
T′ = eltype(adapt(storage, Vector{T}()))
55-
5657
Δx = T′(deg2rad(θpix/60))
5758
Δℓx = T′(2π/(Nx*Δx))
5859
Δℓy = T′(2π/(Ny*Δx))

0 commit comments

Comments
 (0)