MCPcopy Create free account
hub / github.com/NVIDIA/DALI / CopyAsTensorGpuTest

Function CopyAsTensorGpuTest

dali/test/mat2tensor_test.cc:59–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57namespace {
58
59void CopyAsTensorGpuTest(const cv::Mat &mat) {
60 try {
61 auto tvpair = kernels::copy_as_tensor<mm::memory_kind::managed>(mat);
62 CUDA_CALL(cudaDeviceSynchronize());
63 auto imgptr = mat.data;
64 auto tvptr = tvpair.first.data;
65 ASSERT_EQ(mat.rows * mat.cols * mat.channels(), volume(tvpair.first.shape))
66 << "Sizes don't match";
67 for (int i = 0; i < mat.cols * mat.rows * mat.channels(); i++) {
68 EXPECT_EQ(imgptr[i], tvptr[i]) << "Test failed at i=" << i;
69 }
70 } catch (const CUDAError &e) {
71 if ((e.is_drv_api() && e.drv_error() == CUDA_ERROR_NOT_SUPPORTED) ||
72 (e.is_rt_api() && e.rt_error() == cudaErrorNotSupported)) {
73 GTEST_SKIP() << "Unified memory not supported on this platform";
74 }
75 }
76}
77
78} // namespace
79

Callers 1

TESTFunction · 0.85

Calls 6

CUDA_CALLFunction · 0.85
volumeFunction · 0.85
is_drv_apiMethod · 0.80
drv_errorMethod · 0.80
is_rt_apiMethod · 0.80
rt_errorMethod · 0.80

Tested by

no test coverage detected