8000 Threads support · Issue #570 · chalk-lab/Mooncake.jl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Threads support #570
Open
Open
@mhauru

Description

@mhauru
julia> module MWE

       using DifferentiationInterface, Mooncake

       function f(x)
           arr = Vector{Float64}(undef, Threads.nthreads())
           Threads.@threads for i in eachindex(arr)
               arr[i] = x
           end
           return sum(arr)
       end

       value_and_gradient(f, AutoMooncake(; config=nothing), 2.0)
       end
WARNING: replacing module MWE.

ERROR: No rrule!! available for foreigncall with primal argument types Tuple{Val{:jl_enter_threaded_region}, Val{Nothing}, Tuple{}, Val{0}, Val{:ccall}}. This problem has most likely arisen because there is a ccall somewhere in the function you are trying to differentiate, for which an rrule!! has not been explicitly written.You have three options: write an rrule!! for this foreigncall, write an rrule!! for a Julia function that calls this foreigncall, or re-write your code to avoid this foreigncall entirely. If you believe that this error has arisen for some other reason than the above, or the above does not help you to workaround this problem, please open an issue.

How difficult would it be to add support for this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0