MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / writeTest

Function writeTest

test/write.cpp:44–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42
43template<typename T>
44void writeTest(dim4 dims) {
45 SUPPORTED_TYPE_CHECK(T);
46
47 array A = randu(dims, (af_dtype)dtype_traits<T>::af_type);
48 array B = randu(dims, (af_dtype)dtype_traits<T>::af_type);
49
50 array A_copy = A.copy();
51 array B_copy = B.copy();
52
53 T *a_host = A.host<T>();
54 T *b_dev = B.device<T>();
55
56 A.write(b_dev, dims.elements() * sizeof(T), afDevice);
57 B.write(a_host, dims.elements() * sizeof(T), afHost);
58
59 ASSERT_ARRAYS_EQ(B_copy, A);
60 ASSERT_ARRAYS_EQ(A_copy, B);
61
62 freeHost(a_host);
63}
64
65TYPED_TEST(Write, Vector0) { writeTest<TypeParam>(dim4(10)); }
66

Callers

nothing calls this directly

Calls 5

randuFunction · 0.85
freeHostFunction · 0.85
writeMethod · 0.80
copyMethod · 0.45
elementsMethod · 0.45

Tested by

no test coverage detected