Open AlexRobson opened 1 year ago
The examples should represent best practices, the docs should be updated
FWIW i had a look at this. IIUC, when generating the training data product is used which doesn't promote, making CUDA unhappy:
span = [0, (0.0:0.1:1.0)];
map(points -> collect(points), Iterators.product(span...)) # 11-element Vector{Vector{Real}}:
Can a promotion be added here?
T = promote_type(eltype.(span)...)
map(points -> collect(T, points), Iterators.product(span...)) # 11-element Vector{Vector{Float64}}
The error emerges then with:
x = Vector{Float64}([1.0, 2.0, 3.0])
CUDA.adapt(CuArray, x) # Works
x = Vector{Real}([1.0, 2.0, 3.0])
CUDA.adapt(CuArray, x) # Fails
It looks like a couple of the tutorial examples would hit this, so plausibly easy enough to accidentally write, which is why I looked at it. That said, peering at it, I think this only appears in GridTraining which is discouraged anyway but idk if it appears elsewhere.
Minor thing, but this was playing around with the two sets of introductory code:
1) https://github.com/SciML/NeuralPDE.jl/blob/master/README.md#example-solving-2d-poisson-equation-via-physics-informed-neural-networks 2) https://docs.sciml.ai/NeuralPDE/stable/tutorials/gpu/
Essentially, naively extending the example [1] in the readme with the push to the gpu errors in CUDA unless the bcs are reexpressed. Initially confusing as I thought it was something up with my CUDA set-up.
This code should reproduce the error: