JuliaGPU / Adapt.jl

Other
86 stars 24 forks source link

Adapting closures #37

Closed maleadt closed 3 years ago

maleadt commented 3 years ago
julia> using CUDA, Adapt

julia> function foo(A)
       bar() = A
       bar
       end
foo (generic function with 1 method)

julia> f = foo(rand(2,2))
(::var"#bar#1"{Matrix{Float64}}) (generic function with 1 method)

julia> f()
2×2 Matrix{Float64}:
 0.167181  0.62589
 0.174081  0.464358

julia> g = Adapt.adapt(CuArray, f)
(::var"#bar#1"{CuArray{Float64, 2}}) (generic function with 1 method)

julia> g()
2×2 CuArray{Float64, 2}:
 0.167181  0.62589
 0.174081  0.464358
codecov[bot] commented 3 years ago

Codecov Report

Merging #37 (902ee1c) into master (f2c4e33) will increase coverage by 5.71%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #37      +/-   ##
==========================================
+ Coverage   65.71%   71.42%   +5.71%     
==========================================
  Files           3        3              
  Lines          35       42       +7     
==========================================
+ Hits           23       30       +7     
  Misses         12       12              
Impacted Files Coverage Δ
src/base.jl 72.72% <100.00%> (+47.72%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f2c4e33...902ee1c. Read the comment docs.