Lux and Flux GPU function definitions overlap

I am running the NeuralODE example for GPUs. Here is the code:

using DifferentialEquations, Flux, DiffEqFlux, SciMLSensitivity

using Random
rng = Random.default_rng()

model_gpu = Chain(Dense(2, 50, tanh), Dense(50, 2)) |> gpu
p, re = Flux.destructure(model_gpu)
dudt!(u, p, t) = re(p)(u)

# Simulation interval and intermediary points
tspan = (0f0, 10f0)
tsteps = 0f0:1f-1:10f0

u0 = Float32[2.0; 0.0] |> gpu
prob_gpu = ODEProblem(dudt!, u0, tspan, p)

# Runs on a GPU
sol_gpu = solve(prob_gpu, Tsit5(), saveat = tsteps)

I get an error stating that both DiffEqFlux and Lux export gpu. So a choice must be made. Are the tow gpu implementations identical? If not, which to choose. I notice a download of relatively large libraries.

WARNING: both DiffEqFlux and Lux export "gpu"; uses of it in module Main must be qualified
ERROR: UndefVarError: gpu not defined

The demo can be found at https://diffeqflux.sciml.ai/stable/examples/GPUs/ .

Thanks!

I have a suggestion, @ChrisRackauckas : why not have a discussion for the various tutorials through a link to allow people to comment on specific tutorials? Or would you rather all comments come to this forum?

They export the same gpu function. What does ]st give you on Julia v1.8? Are you on the latest packages?

Here you go: Julia 1.8.2:

Status `~/src/2022/ge_sciML_julia_examples/new_demos/DiffEqFlux/Project.toml`
  [052768ef] CUDA v3.12.0
  [b0b7db55] ComponentArrays v0.13.4
  [aae7a2af] DiffEqFlux v1.52.0
  [0c46a032] DifferentialEquations v7.6.0
  [587475ba] Flux v0.13.6
  [b2108857] Lux v0.4.31
  [7f7a1694] Optimization v3.9.2
  [253f991c] OptimizationFlux v0.1.1
  [36348300] OptimizationOptimJL v0.1.3
  [1dea7af3] OrdinaryDiffEq v6.29.3
  [91a5bcdd] Plots v1.35.5
  [1ed8b502] SciMLSensitivity v7.10.2
  [e88e6eb3] Zygote v0.6.49
  [9a3f8284] Random

When rerunning, I now get the error: gpu not found)

Here is the source code (to make sure you see what I see):
I now longer get the error message I sent before saying that gpu appeared in two libraries. Note that earlier I was using Lux, now I am not. I also exited VSCode and reentered it, after closing my workspace. That probably deleted all my variables.

What is the best way to clear all the variables in a workspace, but leave the workspace open? LIke removing all the output in Jupyter? Surely there must be a way to do this. Otherwise, caching will complicate the debugging process. Thanks!

using DifferentialEquations, Flux, DiffEqFlux, SciMLSensitivity

using Random
rng = Random.default_rng()

model_gpu = Chain(Dense(2, 50, tanh), Dense(50, 2)) |> gpu
p, re = Flux.destructure(model_gpu)
dudt!(u, p, t) = re(p)(u)

# Simulation interval and intermediary points
tspan = (0f0, 10f0)
tsteps = 0f0:1f-1:10f0

u0 = Float32[2.0; 0.0] |> Flux.gpu
prob_gpu = ODEProblem(dudt!, u0, tspan, p)

# Runs on a GPU
sol_gpu = solve(prob_gpu, Tsit5(), saveat = tsteps)

@avikpal what’s going on here?

Hi,

I created a MWE, with the following source in a clean project with only a single file. Thus the project file only contains the four modules below.

using DifferentialEquations, Flux, DiffEqFlux, SciMLSensitivity

gpu

and the gpu was found. Everything worked fine. gpu is defined.
Therefore, my problem was due to the interaction with other components, and figuring this out would take too much of my time for now.

Is there an easy way to wipe the workspace of all variables without having to rebuild the Manifest? Thanks.