Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[MXNET-1440] julia: porting current_context #17142

Merged
merged 9 commits into from
Dec 24, 2019
Merged

Conversation

iblislin
Copy link
Member

@iblislin iblislin commented Dec 21, 2019

  • And introduce three new macros for changing default context
    • @context
    • @gpu
    • @cpu
julia> mx.@gpu mx.zeros(2, 3)
2×3 NDArray{Float32,2} @ gpu0:
 0.0f0  0.0f0  0.0f0
 0.0f0  0.0f0  0.0f0

julia> mx.current_context()
cpu0

julia> mx.@context mx.GPU 42 begin
         mx.current_context()
       end
gpu42

TODO

  • test cases
  • update docs

- And introduce a new macro for changing default context
  `@with_context`
@iblislin iblislin added the Julia label Dec 21, 2019
@iblislin iblislin marked this pull request as ready for review December 22, 2019 07:51
@iblislin iblislin merged commit efc4ad8 into master Dec 24, 2019
@iblislin iblislin deleted the ib/jl-ctx-current branch December 28, 2019 09:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant