Updated the closures with @closure to avoid boxing#924
Open
Arushi-Gupta13 wants to merge 2 commits intoSciML:masterfrom
Open
Updated the closures with @closure to avoid boxing#924Arushi-Gupta13 wants to merge 2 commits intoSciML:masterfrom
Arushi-Gupta13 wants to merge 2 commits intoSciML:masterfrom
Conversation
| integral = NeuralPDE.get_numeric_integral(strategy, indvars, multioutput, chain, derivative) | ||
|
|
||
| _pde_loss_function = NeuralPDE.build_loss_function(eq, indvars, depvars, phi, derivative, | ||
| _pde_loss_function = @closure NeuralPDE.build_loss_function(eq, indvars, depvars, phi, derivative, |
Author
There was a problem hiding this comment.
I added @closure here under the assumption that it would be necessary for capturing variables, but I see that this isn't forming a closure.
| phi = discretization.phi | ||
|
|
||
| # Analysis | ||
| # Analysis with closure |
Author
Member
|
Can you show a concrete improvement from this? What led to it? Can you show what functions had issues with inference and a flamegraph? |
| if: build.message !~ /\[skip tests\]/ | ||
|
|
||
| - label: "Documentation" | ||
| - label: "Documentation"p |
Member
There was a problem hiding this comment.
Suggested change
| - label: "Documentation"p | |
| - label: "Documentation" |
| DomainSets = "5b8099bc-c8ec-5219-889f-1d9e522a28bf" | ||
| ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" | ||
| Functors = "d9f16b24-f501-4c13-a1f2-28368ffc5196" | ||
| Glob = "c27321d9-0574-5035-807b-f59d2c89b15c" |
Author
There was a problem hiding this comment.
it was for searching a keyword across all files, automating the search with a script.
| Reexport = "189a3867-3050-52da-a836-e630ba90ab69" | ||
| RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47" | ||
| SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" | ||
| SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" |
Author
There was a problem hiding this comment.
It was throwing KeyError: key "SparseArrays" not found error continuously, this helped.
| MiniMaxAdaptiveLoss(args...; kwargs...) = MiniMaxAdaptiveLoss{Float64}(args...; kwargs...) | ||
|
|
||
| function generate_adaptive_loss_function(pinnrep::PINNRepresentation, | ||
| @closure function generate_adaptive_loss_function(pinnrep::PINNRepresentation, |
| NonAdaptiveLoss(; kwargs...) = NonAdaptiveLoss{Float64}(; kwargs...) | ||
|
|
||
| function generate_adaptive_loss_function(::PINNRepresentation, ::NonAdaptiveLoss, _, __) | ||
| @closure function generate_adaptive_loss_function(::PINNRepresentation, ::NonAdaptiveLoss, _, __) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors the codebase to replace traditional closures with the @closures annotation. This change improves readability, reduces redundant closure definitions, and enhances performance by leveraging Julia's built-in annotation for automatic closure handling.