Skip to content

Float32 types are automatically converted to Float64 #3553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
TorkelE opened this issue Apr 9, 2025 · 2 comments · May be fixed by #3561
Open

Float32 types are automatically converted to Float64 #3553

TorkelE opened this issue Apr 9, 2025 · 2 comments · May be fixed by #3561
Assignees
Labels
bug Something isn't working

Comments

@TorkelE
Copy link
Member

TorkelE commented Apr 9, 2025

using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D
using OrdinaryDiffEq
@parameters p d
@variables X(t)
eqs = [D(X) ~ p - d*X]
@mtkbuild osys = ODESystem(eqs, t)
u0 = [X => 1.0f0]
ps = [p => 1.0f0, d => 2.0f0]
oprob = ODEProblem(osys, u0, 1.0, ps)
sol = solve(oprob)

typeof(oprob[X]) # Float64
eltype(sol[X]) # Float64

This one popped out in the Catalyst tests with the latest MTK release. Among other things it should be a major problem for GPU parallelisation.

@TorkelE TorkelE added the bug Something isn't working label Apr 9, 2025
@isaacsas isaacsas changed the title Float64 types are automatically converted to Float64 Float32 types are automatically converted to Float64 Apr 10, 2025
@AayushSabharwal
Copy link
Member

This is due to Initials, and it's annoyingly difficult to solve.

@AayushSabharwal
Copy link
Member

Still working on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants