All Projects → SciML → MuladdMacro.jl

SciML / MuladdMacro.jl

Licence: other
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

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to MuladdMacro.jl

PoissonRandom.jl
Fast Poisson Random Numbers in pure Julia for scientific machine learning (SciML)
Stars: ✭ 13 (-59.37%)
Mutual labels:  scientific-machine-learning, sciml
DiffEqUncertainty.jl
Fast uncertainty quantification for scientific machine learning (SciML) and differential equations
Stars: ✭ 61 (+90.63%)
Mutual labels:  scientific-machine-learning, sciml
AutoOptimize.jl
Automatic optimization and parallelization for Scientific Machine Learning (SciML)
Stars: ✭ 77 (+140.63%)
Mutual labels:  scientific-machine-learning, sciml
sciml.ai
The SciML Scientific Machine Learning Software Organization Website
Stars: ✭ 38 (+18.75%)
Mutual labels:  scientific-machine-learning, sciml
DiffEqOnlineServer
Backend for DiffEqOnline, a webapp for scientific machine learning (SciML)
Stars: ✭ 24 (-25%)
Mutual labels:  scientific-machine-learning, sciml
diffeqr
Solving differential equations in R using DifferentialEquations.jl and the SciML Scientific Machine Learning ecosystem
Stars: ✭ 118 (+268.75%)
Mutual labels:  scientific-machine-learning, sciml
Kinetic.jl
Universal modeling and simulation of fluid dynamics upon machine learning
Stars: ✭ 82 (+156.25%)
Mutual labels:  scientific-machine-learning, sciml
RootedTrees.jl
A collection of functionality around rooted trees to generate order conditions for Runge-Kutta methods in Julia for differential equations and scientific machine learning (SciML)
Stars: ✭ 24 (-25%)
Mutual labels:  scientific-machine-learning, sciml
MultiScaleArrays.jl
A framework for developing multi-scale arrays for use in scientific machine learning (SciML) simulations
Stars: ✭ 63 (+96.88%)
Mutual labels:  scientific-machine-learning, sciml
DiffEqCallbacks.jl
A library of useful callbacks for hybrid scientific machine learning (SciML) with augmented differential equation solvers
Stars: ✭ 43 (+34.38%)
Mutual labels:  scientific-machine-learning, sciml
CellMLToolkit.jl
CellMLToolkit.jl is a Julia library that connects CellML models to the Scientific Julia ecosystem.
Stars: ✭ 50 (+56.25%)
Mutual labels:  scientific-machine-learning, sciml
GlobalSensitivity.jl
Robust, Fast, and Parallel Global Sensitivity Analysis (GSA) in Julia
Stars: ✭ 30 (-6.25%)
Mutual labels:  scientific-machine-learning, sciml
BoundaryValueDiffEq.jl
Boundary value problem (BVP) solvers for scientific machine learning (SciML)
Stars: ✭ 23 (-28.12%)
Mutual labels:  scientific-machine-learning, sciml
SciPyDiffEq.jl
Wrappers for the SciPy differential equation solvers for the SciML Scientific Machine Learning organization
Stars: ✭ 19 (-40.62%)
Mutual labels:  scientific-machine-learning, sciml
DiffEqDevTools.jl
Benchmarking, testing, and development tools for differential equations and scientific machine learning (SciML)
Stars: ✭ 37 (+15.63%)
Mutual labels:  scientific-machine-learning, sciml
Quadrature.jl
A common interface for quadrature and numerical integration for the SciML scientific machine learning organization
Stars: ✭ 83 (+159.38%)
Mutual labels:  scientific-machine-learning, sciml
DiffEqNoiseProcess.jl
A library of noise processes for stochastic systems like stochastic differential equations (SDEs) and other systems that are present in scientific machine learning (SciML)
Stars: ✭ 34 (+6.25%)
Mutual labels:  scientific-machine-learning, sciml
SciMLBenchmarks.jl
Benchmarks for scientific machine learning (SciML) software and differential equation solvers
Stars: ✭ 195 (+509.38%)
Mutual labels:  scientific-machine-learning, sciml
HelicopterSciML.jl
Helicopter Scientific Machine Learning (SciML) Challenge Problem
Stars: ✭ 35 (+9.38%)
Mutual labels:  scientific-machine-learning, sciml
Sundials.jl
Julia interface to Sundials, including a nonlinear solver (KINSOL), ODE's (CVODE and ARKODE), and DAE's (IDA) in a SciML scientific machine learning enabled manner
Stars: ✭ 167 (+421.88%)
Mutual labels:  scientific-machine-learning, sciml

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.

Examples

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> 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].