Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host-side CUTENSOR #243

Merged
merged 1 commit into from
Jul 10, 2020
Merged

Host-side CUTENSOR #243

merged 1 commit into from
Jul 10, 2020

Conversation

kshyatt
Copy link
Contributor

@kshyatt kshyatt commented Jun 22, 2020

@maleadt @vchuravy this is the PR with problems on cyclops. This should enable us to call CUTENSOR on host memory using memory pinning, and is a port of JuliaGPU/CuArrays.jl#683 (where these tests passed, and I checked that they still do on latest CuArrays).

@kshyatt kshyatt added bug Something isn't working enhancement New feature or request cuda libraries Stuff about CUDA library wrappers. tests Adds or changes tests. labels Jun 22, 2020
@maleadt
Copy link
Member

maleadt commented Jun 22, 2020

Wait, how does this work? This isn't unified memory, so does CUTENSOR just do a cuMemHostGetDevicePointer behind the scenes? Do other APIs work like that? If so, that kinda breaks the design of and protection that CuPtr gives you, because marking all those APIs PtrOrCuPtr now allows passing invalid CPU pointers again...

@kshyatt
Copy link
Contributor Author

kshyatt commented Jun 22, 2020

It just needs to be memory pinned by CUDA iirc, not a UnifiedBuffer. A HostBuffer is ok as long as it's pinned in a way that's GPU readable.

@maleadt
Copy link
Member

maleadt commented Jun 22, 2020

Also, shouldn't we be more strict with the type signatures? e.g. Union{Array, CuArray} instead of all of AbstractArray (this is something I've been doing recently with the GPUArrays stuff, mainly to avoid ambiguities though as CuArray<:AbstractArray). Just a thought.

@kshyatt
Copy link
Contributor Author

kshyatt commented Jun 22, 2020

Can do, let's see how this round of tests does.

@maleadt
Copy link
Member

maleadt commented Jun 23, 2020

CUTENSORError: operation not supported (yet) (code 15, CUTENSOR_STATUS_NOT_SUPPORTED) on 10.1 seems related?

test/cutensor.jl Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jul 9, 2020

Codecov Report

Merging #243 into master will increase coverage by 0.65%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #243      +/-   ##
==========================================
+ Coverage   80.33%   80.98%   +0.65%     
==========================================
  Files         155      155              
  Lines       10275    10408     +133     
==========================================
+ Hits         8254     8429     +175     
+ Misses       2021     1979      -42     
Impacted Files Coverage Δ
lib/cutensor/wrappers.jl 93.87% <ø> (+21.01%) ⬆️
test/cudadrv/memory.jl 100.00% <ø> (ø)
lib/cudadrv/memory.jl 84.73% <100.00%> (+0.58%) ⬆️
test/cutensor.jl 99.13% <100.00%> (+0.33%) ⬆️

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 027c0dc...fcf0bc5. Read the comment docs.

@maleadt
Copy link
Member

maleadt commented Jul 9, 2020

Why would these synchronizations matter? Memory copies should be synchronizing already.

@kshyatt
Copy link
Contributor Author

kshyatt commented Jul 10, 2020

We discussed this in private, but for the record it's because this is host-side memory.

@kshyatt
Copy link
Contributor Author

kshyatt commented Jul 10, 2020

I'm losing my mind at the fact that tests are passing

@kshyatt
Copy link
Contributor Author

kshyatt commented Jul 10, 2020

Anyway @maleadt do you mind reviewing this? Now that tests pass can we merge?

Copy link
Member

@maleadt maleadt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Some minor nits.

.gitlab-ci.yml Outdated Show resolved Hide resolved
lib/cudadrv/memory.jl Show resolved Hide resolved
lib/cutensor/libcutensor.jl Show resolved Hide resolved
test/cudadrv/memory.jl Outdated Show resolved Hide resolved
test/cutensor.jl Outdated Show resolved Hide resolved
test/cutensor.jl Show resolved Hide resolved
test/cutensor.jl Show resolved Hide resolved
@kshyatt kshyatt merged commit 0091275 into master Jul 10, 2020
@kshyatt kshyatt deleted the ksh/hosttensor branch July 10, 2020 15:22
@maleadt
Copy link
Member

maleadt commented Jul 10, 2020

🎉

@kshyatt
Copy link
Contributor Author

kshyatt commented Jul 10, 2020

finally done! 🚀

maleadt added a commit that referenced this pull request Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cuda libraries Stuff about CUDA library wrappers. enhancement New feature or request tests Adds or changes tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants