Skip to content

Commit

Permalink
v0.2.0 (#11)
Browse files Browse the repository at this point in the history
* preparation for FMIBase.jl

* fixes for FMIBase
  • Loading branch information
ThummeTo committed Jun 18, 2024
1 parent 9f73d6d commit 38db752
Show file tree
Hide file tree
Showing 9 changed files with 527 additions and 539 deletions.
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name = "FMISensitivity"
uuid = "3e748fe5-cd7f-4615-8419-3159287187d2"
authors = ["TT <[email protected]>", "LM <[email protected]>"]
version = "0.1.4"
version = "0.2.0"

[deps]
FMICore = "8af89139-c281-408e-bce2-3005eb87462f"
FMIBase = "900ee838-d029-460e-b485-d98a826ceef2"
ForwardDiffChainRules = "c9556dd2-1aed-4cfe-8560-1557cf593001"
SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1"

[compat]
FMICore = "0.20.0"
FMIBase = "1.0.0"
ForwardDiffChainRules = "0.2.0"
SciMLSensitivity = "6.51.2 - 7.51"
SciMLSensitivity = "7.0 - 7.59"
julia = "1.6"
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ To keep dependencies nice and clean, the original package [*FMI.jl*](https://git
- [*FMI.jl*](https://github.com/ThummeTo/FMI.jl): High level loading, manipulating, saving or building entire FMUs from scratch
- [*FMIImport.jl*](https://github.com/ThummeTo/FMIImport.jl): Importing FMUs into Julia
- [*FMIExport.jl*](https://github.com/ThummeTo/FMIExport.jl): Exporting stand-alone FMUs from Julia Code
- [*FMIBase.jl*](https://github.com/ThummeTo/FMIBase.jl): Common concepts for import and export of FMUs
- [*FMICore.jl*](https://github.com/ThummeTo/FMICore.jl): C-code wrapper for the FMI-standard
- [*FMISensitivity.jl*](https://github.com/ThummeTo/FMISensitivity.jl): Static and dynamic sensitivities over FMUs
- [*FMIBuild.jl*](https://github.com/ThummeTo/FMIBuild.jl): Compiler/Compilation dependencies for FMIExport.jl
- [*FMIFlux.jl*](https://github.com/ThummeTo/FMIFlux.jl): Machine Learning with FMUs (differentiation over FMUs)
- [*FMIFlux.jl*](https://github.com/ThummeTo/FMIFlux.jl): Machine Learning with FMUs
- [*FMIZoo.jl*](https://github.com/ThummeTo/FMIZoo.jl): A collection of testing and example FMUs

## What Platforms are supported?
Expand Down
41 changes: 12 additions & 29 deletions src/FMISensitivity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,23 @@ import SciMLSensitivity: ForwardDiff
import SciMLSensitivity: FiniteDiff
import SciMLSensitivity: ReverseDiff
import SciMLSensitivity: Zygote
import FMICore.ChainRulesCore

import FMIBase.ChainRulesCore
using FMIBase.ChainRulesCore: ZeroTangent, NoTangent, @thunk

import ForwardDiffChainRules
import ForwardDiffChainRules: @ForwardDiff_frule
import SciMLSensitivity.ReverseDiff: @grad_from_chainrules
import FMICore.ChainRulesCore: ZeroTangent, NoTangent, @thunk
using FMICore: undual, unsense, untrack
using ForwardDiffChainRules: @ForwardDiff_frule
using SciMLSensitivity.ReverseDiff: @grad_from_chainrules

using SciMLSensitivity.LinearAlgebra
import SciMLSensitivity.SparseDiffTools

import FMICore: invalidate!, check_invalidate!

using FMICore

function isZeroTangent(d)
return false
end
function isZeroTangent(d::ZeroTangent)
return true
end
function isZeroTangent(d::AbstractArray{<:ZeroTangent})
return true
end

# additional dispatch for ReverseDiff.jl
# import SciMLSensitivity.ReverseDiff: increment_deriv!, ZeroTangent
# function ReverseDiff.increment_deriv!(::ReverseDiff.TrackedReal, ::ZeroTangent)
# return nothing
# end
# function ReverseDiff.increment_deriv!(::ReverseDiff.TrackedArray, ::ZeroTangent, ::Int64)
# return nothing
# end

include("FMI2.jl")
using FMIBase
using FMIBase.FMICore
using FMIBase: undual, unsense, untrack

include("utils.jl")
include("sense.jl")
include("hotfixes.jl")

end # module
12 changes: 12 additions & 0 deletions src/hotfixes.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (c) 2023 Tobias Thummerer, Lars Mikelsons
# Licensed under the MIT license. See LICENSE file in the project root for details.
#

import SciMLSensitivity.Zygote: grad_mut, Context
import FMIBase: FMUEvaluationOutput
#grad_mut(av::AbstractVector) = invoke(grad_mut, Tuple{Any}, av)
grad_mut(av::FMUEvaluationOutput) = invoke(grad_mut, Tuple{Any}, av)
#grad_mut(c::Zygote.Context, av::AbstractVector) = invoke(grad_mut, Tuple{Zygote.Context, Any}, c, av)
grad_mut(c::Zygote.Context, av::FMUEvaluationOutput) = invoke(grad_mut, Tuple{Zygote.Context, Any}, c, av)
#grad_mut(av::AbstractVector) = []
Loading

2 comments on commit 38db752

@ThummeTo
Copy link
Owner Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/109244

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.0 -m "<description of version>" 38db752ae93274d4a41fa4a871cc1813b033f033
git push origin v0.2.0

Please sign in to comment.