JuliaDiff / JuliaDiff/AbstractDifferentiation.jl

Adding support for ADTypes.jl

Open
#88 12 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Julia
Stars
138
Forks
18
PR merge metrics
No merged PRs in 30d

Description

The SciML ecosystem has had it's own "AD-backend" types since before AbstractDifferentiation.jl was created. Those have more recently been exposed in the standalone packages ADTypes.jl.

From a user point of view that means were currently have two incompatible ways of specifying which AD to use, and in packages/algorithms/applications that rely on both SciML and non-SciML-packages we can't easily offer a way for users to select AD.

SciML is unlikely to switch to AbstractDifferentiation (SciML/ADTypes.jl#8), it would require breaking changes and some corresponding types in ADTypes.jl and AbstractDifferentiation.jl have different content (so typedefs also won't work).

Speaking from a user point again, it would be really nice though to have a consistent way of selecting AD across the ecosystem. Could we add bi-directional conversion between ADTypes.AbstractADType and AbstractDifferentiation.AbstractBackend in AbstractDifferentiation.jl?

ADTypes.jl is extremely lightweight (no dependencies and a load time of 0.7 ms) so we could make it a (non-weak) dependency of AbstractDifferentiation.jl and add a

const ADBackendLike = Union{AbstractBackend, ADTypes.AbstractADType}

In AbstractDifferentiation itself (so packages can use that as a field type for algorithm configuration, etc.) and then provide bi-directional Base.convert methods for the AD-types the do correspond (not all are supported by both "systems" at the moment) in the AbstractDifferentiation package extensions.

Would a PR in this direction be welcome?

CC @devmotion, @ChrisRackauckas, @Vaibhavdixit02

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the AbstractDifferentiation interface and its package extensions, then compare the corresponding types in ADTypes.jl. Done means adding the proposed ADBackendLike support and bidirectional Base.convert methods for compatible AD types without assuming unsupported mappings.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.