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

Support v3 cuda array interface. #6776

Merged
merged 7 commits into from Mar 25, 2021

Conversation

trivialfis
Copy link
Member

Close #6753 .

@codecov-io
Copy link

Codecov Report

Merging #6776 (f3fe1d9) into master (bcc0277) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6776   +/-   ##
=======================================
  Coverage   81.78%   81.78%           
=======================================
  Files          13       13           
  Lines        3848     3848           
=======================================
  Hits         3147     3147           
  Misses        701      701           

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 bcc0277...f3fe1d9. Read the comment docs.

cudaStreamCreate(&stream);

auto j_arr =Json::Load(StringView{arr_str});
j_arr["stream"] = Integer(reinterpret_cast<int64_t>(stream));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a safe cast?

Copy link
Member Author

Choose a reason for hiding this comment

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

When you start reinterpreting bits,it's hard to argue what's safe ..

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the stream a memory address, or is it something else, like a struct?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's an opaque pointer.

Copy link
Collaborator

@hcho3 hcho3 Mar 25, 2021

Choose a reason for hiding this comment

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

Got it. Then casting it to an integer should be safe.

dh::caching_device_vector<uint64_t> out(1, 0);
uint64_t dur = 1e9;
dh::LaunchKernel{1, 1, 0, stream}(SleepForTest, out.data().get(), dur);
ArrayInterface arr(arr_str);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a nice test to test whether stream has been properly synchronized.

@trivialfis trivialfis merged commit 794fd6a into dmlc:master Mar 25, 2021
@trivialfis trivialfis deleted the array-interface-cuda-stream branch March 25, 2021 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support new __cuda_array_interface__.
3 participants