You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey folks, I am running into another problem related to integrals. I can't seem to get GPU support working correctly with them. The script I wrote runs correctly when the equations do not include an integral, but fails at compilation when they do. Here is a small example that has this problem.
using NeuralPDE, Lux, Optimization, OptimizationOptimJL, Random
using ModelingToolkit, Logging, DomainSets, OptimizationOptimisers
functiongenerate_eqs()
# Setup all parameters and operators for vlasov equation@parameters s r vᵣ
@variablesf(..) Eself(..)
Ds =Differential(s)
Dr =Differential(r)
Ii =Integral(vᵣ in DomainSets.ClosedInterval(-1.0, 1.0))
# Define equation
eqs = [
Ds(f(s, r, vᵣ)) + vᵣ*Dr(f(s, r, vᵣ)) ~0,
Eself(s, r) ~Ii(f(s, r, vᵣ)) # Commenting out this line fixes issue
]
# Boundary conditions
σr =0.1
σvᵣ =0.3
bcs = [
# Initial distributionf(0, r, vᵣ) ~exp(-r^2/2/σr^2)/sqrt(2*π)/σr *exp(-vᵣ^2/2/σvᵣ^2)/sqrt(2*π)/σvᵣ,
]
# Domains
domains = [
s ∈Interval(0.0, 1.0),
r ∈Interval(-1.0, 1.0),
vᵣ ∈Interval(-1.0, 1.0),
]
# Return as named tuple@named pde_system =PDESystem(eqs, bcs, domains, [s, r, vᵣ], [f(s, r, vᵣ), Eself(s, r)])
pde_system
endfunctionmake_discretization()
# Neural network
idim =32
chains = [
Lux.Chain(Dense(3,idim,Lux.σ),Dense(idim,idim,Lux.σ),Dense(idim,idim,Lux.σ),Dense(idim,1)), # For f
Lux.Chain(Dense(2,idim,Lux.σ),Dense(idim,idim,Lux.σ),Dense(idim,idim,Lux.σ),Dense(idim,1)) # For Eself
]
# Get initial params
names =:f, :Eself
init_params = Lux.initialparameters.(Random.default_rng(), chains)
init_params =NamedTuple{names}(init_params)
init_params = Lux.ComponentArray(init_params)
init_params =Float64.(Lux.gpu(init_params))
# Discretization
strategy =QuasiRandomTraining(128)
PhysicsInformedNN(chains, strategy, init_params=init_params)
end# Set up training for PINN
pde_system =generate_eqs()
discretization =make_discretization()
# Try to run the optimization (fails to compile GPU kernel)
prob =discretize(pde_system, discretization)
opt =Adam(0.03)
res = Optimization.solve(prob, opt, maxiters=32)
The stack trace is pretty long, but the top part is copied below and points out the issue as occurring in the methods related to numeric integration in the loss function.
Hey folks, I am running into another problem related to integrals. I can't seem to get GPU support working correctly with them. The script I wrote runs correctly when the equations do not include an integral, but fails at compilation when they do. Here is a small example that has this problem.
The stack trace is pretty long, but the top part is copied below and points out the issue as occurring in the methods related to numeric integration in the loss function.
The text was updated successfully, but these errors were encountered: