MCPcopy Create free account
hub / github.com/dmlc/xgboost / CheckDevice

Function CheckDevice

tests/cpp/plugin/test_sycl_host_device_vector.cc:48–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48void CheckDevice(HostDeviceVector<int>* v,
49 size_t size,
50 unsigned int first,
51 GPUAccess access) {
52 ASSERT_EQ(v->Size(), size);
53
54 std::vector<int> desired_data(size);
55 std::iota(desired_data.begin(), desired_data.end(), first);
56 sycl::VerifyOnDeviceData(v->Device(), v->ConstDevicePointer(), desired_data.data(), size);
57 ASSERT_TRUE(v->DeviceCanRead());
58 // ensure that the device has at most the access specified by access
59 ASSERT_EQ(v->DeviceCanWrite(), access == GPUAccess::kWrite);
60 ASSERT_EQ(v->HostCanRead(), access == GPUAccess::kRead);
61 ASSERT_FALSE(v->HostCanWrite());
62
63 sycl::VerifyOnDeviceData(v->Device(), v->DevicePointer(), desired_data.data(), size);
64 ASSERT_TRUE(v->DeviceCanRead());
65 ASSERT_TRUE(v->DeviceCanWrite());
66 ASSERT_FALSE(v->HostCanRead());
67 ASSERT_FALSE(v->HostCanWrite());
68}
69
70void CheckHost(HostDeviceVector<int> *v, GPUAccess access) {
71 const std::vector<int>& data_h = access == GPUAccess::kNone ?

Callers 2

TestHostDeviceVectorFunction · 0.70
TESTFunction · 0.70

Calls 12

VerifyOnDeviceDataFunction · 0.85
SizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
DeviceMethod · 0.45
ConstDevicePointerMethod · 0.45
dataMethod · 0.45
DeviceCanReadMethod · 0.45
DeviceCanWriteMethod · 0.45
HostCanReadMethod · 0.45
HostCanWriteMethod · 0.45
DevicePointerMethod · 0.45

Tested by

no test coverage detected