Skip to content
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

Better BigFloat support #457

Merged
merged 1 commit into from
Aug 19, 2024
Merged

Conversation

ErikQQY
Copy link
Member

@ErikQQY ErikQQY commented Aug 19, 2024

Continue #438 and SciML/BoundaryValueDiffEq.jl#202

When handling with BigFloat u0, instead of specializing when creating a new array, we directly fill zeros everywhere.

@ChrisRackauckas ChrisRackauckas merged commit e457a98 into SciML:master Aug 19, 2024
8 of 22 checks passed
@ErikQQY ErikQQY deleted the qqy/better_bigfloat branch August 19, 2024 11:27
Copy link
Member

@avik-pal avik-pal Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will double the allocations once for similar and again a new zero array.

Also performance-wise this is not a good idea: (exaggerated example but still)

julia> x = rand(100000);

julia> @btime similar($x);
  108.556 ns (3 allocations: 781.31 KiB)

julia> @btime zero($x);
  96.660 μs (3 allocations: 781.31 KiB)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/SciML/SciMLStyle#always-default-to-constructs-which-initialize-data says that it is okay to use undef if we ensure that the data is initialized before being returned, so I don't think it applies in this context.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are you zeroing it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The u in solution object will be initialized right? If the user doesn't assign a value to an element of u inside the in place function that is also an undefined behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants