Implement host span. (#5459)

This commit is contained in:
Jiaming Yuan
2020-04-03 10:37:51 +08:00
committed by GitHub
parent 459b175dc6
commit 86beb68ce8
2 changed files with 12 additions and 0 deletions

View File

@@ -165,6 +165,15 @@ TEST(HostDeviceVector, Span) {
auto const_span = vec.ConstDeviceSpan();
ASSERT_EQ(vec.Size(), const_span.size());
ASSERT_EQ(vec.ConstDevicePointer(), const_span.data());
auto h_span = vec.ConstHostSpan();
ASSERT_TRUE(vec.HostCanRead());
ASSERT_FALSE(vec.HostCanWrite());
ASSERT_EQ(h_span.size(), vec.Size());
ASSERT_EQ(h_span.data(), vec.ConstHostPointer());
h_span = vec.HostSpan();
ASSERT_TRUE(vec.HostCanWrite());
}
TEST(HostDeviceVector, MGPU_Basic) {