MuladdMacro

This package contains a macro for converting expressions to use muladd calls and fused-multiply-add (FMA) operations for high-performance in the SciML scientific machine learning ecosystem

https://github.com/sciml/muladdmacro.jl

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 15 committers (6.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.3%) to scientific vocabulary

Keywords

fma julia julia-language julialang muladd scientific-machine-learning sciml

Keywords from Contributors

matrix-exponential ode numerical sde pdes ordinary-differential-equations differential-equations stochastic-differential-equations dae neural-ode
Last synced: 9 months ago · JSON representation ·

Repository

This package contains a macro for converting expressions to use muladd calls and fused-multiply-add (FMA) operations for high-performance in the SciML scientific machine learning ecosystem

Basic Info
Statistics
  • Stars: 44
  • Watchers: 7
  • Forks: 8
  • Open Issues: 1
  • Releases: 8
Topics
fma julia julia-language julialang muladd scientific-machine-learning sciml
Created almost 9 years ago · Last pushed 10 months ago
Metadata Files
Readme License Citation

README.md

MuladdMacro.jl

Join the chat at https://julialang.zulipchat.com #sciml-bridged Global Docs

codecov Build Status

ColPrac: Contributor's Guide on Collaborative Practices for Community Packages SciML Code Style

This package provides the @muladd macro. It automatically converts expressions with multiplications and additions or subtractions to calls with muladd which then fuse via FMA when it would increase the performance of the code. The @muladd macro can be placed on code blocks and it will automatically find the appropriate expressions and nest muladd expressions when necessary. In mixed expressions summands without multiplication will be grouped together and evaluated first but otherwise the order of evaluation of multiplications and additions is not changed.

Tutorials and Documentation

For information on using the package, see the stable documentation. Use the in-development documentation for the version of the documentation, which contains the unreleased features.

Examples

```julia-repl julia> using MuladdMacro

julia> @macroexpand(@muladd k3 = f(t + c3 * dt, @. uprev + dt * (a031 * k1 + a032 * k2))) :(k3 = f((muladd)(c3, dt, t), (muladd).(dt, (muladd).(a032, k2, (*).(a031, k1)), uprev)))

julia> @macroexpand(@muladd integrator.EEst = integrator.opts.internalnorm((update - dt * (bhat1 * k1 + bhat4 * k4 + bhat5 * k5 + bhat6 * k6 + bhat7 * k7 + bhat10 * k10)) ./ @. (integrator.opts.abstol + max(abs(uprev), abs(u)) * integrator.opts.reltol))) :(integrator.EEst = integrator.opts.internalnorm((muladd)(-dt, (muladd)(bhat10, k10, (muladd)(bhat7, k7, (muladd)(bhat6, k6, (muladd)(bhat5, k5, (muladd)(bhat4, k4, bhat1 * k1))))), update) ./ (muladd).(max.(abs.(uprev), abs.(u)), integrator.opts.reltol, integrator.opts.abstol))) ```

Broadcasting

A muladd call will be broadcasted if both the * and the + or - are broadcasted. If either one is not broadcasted, then the expression will be converted to a non-dotted muladd.

Limitations

Currently, @muladd handles only explicit calls of + and *. In particular, assignments using += or literal power such as ^2 are not supported. Thus, you need to rewrite them, e.g.

```julia-repl julia> using MuladdMacro

julia> a = 1.0; b = 2.0; c = 3.0;

julia> @macroexpand @muladd a += b * c # does not work :(a += b * c)

julia> @macroexpand @muladd a = a + b * c # good alternative :(a = (muladd)(b, c, a))

julia> @macroexpand @muladd a + b^2 # does not work :(a + b ^ 2)

julia> @macroexpand @muladd a + b * b # good alternative :((muladd)(b, b, a)) ```

Credit

Most of the credit goes to @fcard and @devmotion for building the first version and greatly refining the macro. These contributions are not directly shown as this was developed in Gitter chats and in the DiffEqBase.jl repository, but these two individuals did almost all of the work.

Owner

  • Name: SciML Open Source Scientific Machine Learning
  • Login: SciML
  • Kind: organization
  • Email: contact@chrisrackauckas.com

Open source software for scientific machine learning

Citation (CITATION.bib)

@article{DifferentialEquations.jl-2017,
 author = {Rackauckas, Christopher and Nie, Qing},
 doi = {10.5334/jors.151},
 journal = {The Journal of Open Research Software},
 keywords = {Applied Mathematics},
 note = {Exported from https://app.dimensions.ai on 2019/05/05},
 number = {1},
 pages = {},
 title = {DifferentialEquations.jl – A Performant and Feature-Rich Ecosystem for Solving Differential Equations in Julia},
 url = {https://app.dimensions.ai/details/publication/pub.1085583166 and http://openresearchsoftware.metajnl.com/articles/10.5334/jors.151/galley/245/download/},
 volume = {5},
 year = {2017}
}

GitHub Events

Total
  • Issues event: 1
  • Delete event: 4
  • Issue comment event: 1
  • Push event: 19
  • Pull request review event: 5
  • Pull request review comment event: 7
  • Pull request event: 11
  • Create event: 4
Last Year
  • Issues event: 1
  • Delete event: 4
  • Issue comment event: 1
  • Push event: 19
  • Pull request review event: 5
  • Pull request review comment event: 7
  • Pull request event: 11
  • Create event: 4

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 84
  • Total Committers: 15
  • Avg Commits per committer: 5.6
  • Development Distribution Score (DDS): 0.69
Past Year
  • Commits: 3
  • Committers: 3
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.667
Top Committers
Name Email Commits
Christopher Rackauckas a****s@c****m 26
David Widmann d****n 18
Arno Strouwen a****n@t****e 12
dependabot[bot] 4****] 8
Hendrik Ranocha r****a 4
Kevin k****s@g****m 3
Anant Thazhemadam 4****m 2
Chris de Graaf me@c****v 2
Krishna Bhogaonker c****q@g****m 2
github-actions[bot] 4****] 2
Anshul Singhvi a****7@s****u 1
Benoît Legat b****t@g****m 1
Julia TagBot 5****t 1
Lyndon White l****e@i****k 1
Yingbo Ma m****5@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 7
  • Total pull requests: 56
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 6 days
  • Total issue authors: 6
  • Total pull request authors: 15
  • Average comments per issue: 4.14
  • Average comments per pull request: 1.38
  • Merged pull requests: 49
  • Bot issues: 0
  • Bot pull requests: 11
Past Year
  • Issues: 0
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 hour
  • Issue authors: 0
  • Pull request authors: 3
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 1
Top Authors
Issue Authors
  • ChrisRackauckas (2)
  • ikirill (1)
  • devmotion (1)
  • jondeuce (1)
  • ArnoStrouwen (1)
  • JuliaTagBot (1)
  • JeffBezanson (1)
Pull Request Authors
  • ArnoStrouwen (17)
  • dependabot[bot] (15)
  • devmotion (12)
  • ranocha (5)
  • ChrisRackauckas (4)
  • thazhemadam (4)
  • YingboMa (3)
  • github-actions[bot] (2)
  • 00krishna (2)
  • blegat (2)
  • christopher-dG (2)
  • ksmcreynolds (1)
  • oxinabox (1)
  • asinghvi17 (1)
  • JuliaTagBot (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (15) github_actions (1)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 6,093 total
  • Total dependent packages: 23
  • Total dependent repositories: 0
  • Total versions: 6
juliahub.com: MuladdMacro

This package contains a macro for converting expressions to use muladd calls and fused-multiply-add (FMA) operations for high-performance in the SciML scientific machine learning ecosystem

  • Versions: 6
  • Dependent Packages: 23
  • Dependent Repositories: 0
  • Downloads: 6,093 Total
Rankings
Dependent packages count: 4.3%
Dependent repos count: 9.9%
Average: 11.1%
Forks count: 13.7%
Stargazers count: 16.3%
Last synced: 9 months ago

Dependencies

.github/workflows/CI.yml actions
  • actions/checkout v4 composite
  • codecov/codecov-action v3 composite
  • julia-actions/cache v1 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/CompatHelper.yml actions
.github/workflows/Docs.yml actions
  • actions/checkout v4 composite
  • codecov/codecov-action v3 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/setup-julia latest composite
.github/workflows/DocsPreviewCleanup.yml actions
  • actions/checkout v4 composite
.github/workflows/FormatCheck.yml actions
  • actions/checkout v4 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/Invalidations.yml actions
  • actions/checkout v4 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-invalidations v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/Downgrade.yml actions
  • actions/checkout v4 composite
  • cjdoris/julia-downgrade-compat-action v1 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/SpellCheck.yml actions
  • actions/checkout v4 composite
  • crate-ci/typos v1.16.23 composite