Skip to content

Switch contexts before performing memory operations on arrays - #1176

Merged
maleadt merged 5 commits into
masterfrom
tb/context_switch
Oct 2, 2021
Merged

maleadt merged 5 commits into
masterfrom
tb/context_switch

Conversation

@maleadt

@maleadt maleadt commented Oct 1, 2021

Copy link
Copy Markdown
Member

Fixes #1175, which was caused by the REPL task still being on a different device.
Note that this just switches devices to avoid illegal memory accesses, there may still be synchronization issues (i.e. you still need to synchronize the correct stream before reading from GPU memory).

Also includes specialized copy functions for unified memory, where we don't need to switch contexts, and where we can just memcpy on the CPU.

@maleadt
maleadt force-pushed the tb/context_switch branch from e65ec7d to cda026f Compare October 1, 2021 15:57
@codecov

codecov Bot commented Oct 1, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #1176 (cda026f) into master (ade0940) will increase coverage by 0.01%.
The diff coverage is 96.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1176      +/-   ##
==========================================
+ Coverage   79.77%   79.79%   +0.01%     
==========================================
  Files         119      119              
  Lines        8239     8266      +27     
==========================================
+ Hits         6573     6596      +23     
- Misses       1666     1670       +4     
Impacted Files Coverage Δ
src/array.jl 91.09% <95.74%> (+0.04%) ⬆️
src/state.jl 79.42% <100.00%> (+1.52%) ⬆️
src/pool.jl 76.61% <0.00%> (-1.21%) ⬇️
lib/cudadrv/memory.jl 83.95% <0.00%> (-0.75%) ⬇️
lib/cudadrv/context.jl 75.00% <0.00%> (+0.86%) ⬆️

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 ade0940...cda026f. Read the comment docs.

@maleadt
maleadt merged commit d175c29 into master Oct 2, 2021
@maleadt
maleadt deleted the tb/context_switch branch October 2, 2021 12:49
@maleadt maleadt added the cuda array Stuff about CuArray. label Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda array Stuff about CuArray.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switching devices doesn't switch the REPL's output task

1 participant