Skip to content

GPU array preservation and parallelism in wrong mode #971

@gdalle

Description

@gdalle

Currently:

  • Wrong-mode pushforward or pullback runs the map on the CPU and copies back to the GPU

function _value_and_pullback_via_pushforward(
f::F,
pushforward_prep::PushforwardPrep,
backend::AbstractADType,
x::AbstractArray{<:Real},
ty::NTuple{B},
contexts::Vararg{Context, C},
) where {F, B, C}
y = f(x, map(unwrap, contexts)...)
tx = map(CartesianIndices(x)) do j
a = only(pushforward(f, pushforward_prep, backend, x, (basis(x, j),), contexts...))
map(ty) do dy
dot(a, dy)
end
end
return y, arroftup_to_tupofarr(tx)
end

  • If I try to parallelize it, I need to duplicate the prep object to avoid race conditions, which is not possible

See also:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions