FluxML/Flux.jl

`gpu` should warn if cuDNN is not installed

CarloLucibello opened this issue · 3 comments

Emerged in https://discourse.julialang.org/t/scalar-indexing-gpu-problem-in-flux-jl-model/113974

In the following example one gets an error but no warnings:

using CUDA
using Flux
using Random
CUDA.allowscalar(false)
N_data = 32
img_dims = (16, 16, 3)
images = Float32.(randn((img_dims..., N_data))) |> gpu

model = Chain(
    Conv((3,3), 3 => 1, relu),      # 16×16×3 -> 14×14×1
    Flux.flatten,                   # 14×14×1 -> 196
    Dense(196 => 2)                 # 196 -> 2
)  |> gpu

model(images) # error: TaskFailedException: "Scalar indexing is disallowed."

The problem is that cuDNN is not installed so the convolution falls back to the cpu method.

I think this is a dupe of FluxML/NNlib.jl#523?

We shouldn't wait for the conv to happen, when gpu is called we should warn already.