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

Function TEST

test/jit.cpp:37–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35using std::vector;
36
37TEST(JIT, CPP_JIT_HASH) {
38 const int num = 20;
39 const float valA = 3;
40 const float valB = 5;
41 const float valC = 2;
42 const float valD = valA + valB;
43 const float valE = valA + valC;
44 const float valF1 = valD * valE - valE;
45 const float valF2 = valD * valE - valD;
46
47 array a = constant(valA, num);
48 array b = constant(valB, num);
49 array c = constant(valC, num);
50 eval(a);
51 eval(b);
52 eval(c);
53
54 // Creating a kernel
55 {
56 array d = a + b;
57 array e = a + c;
58 array f1 = d * e - e;
59
60 float* hF1 = f1.host<float>();
61
62 for (int i = 0; i < num; i++) { ASSERT_EQ(hF1[i], valF1); }
63
64 freeHost(hF1);
65 }
66
67 // Making sure a different kernel is generated
68 {
69 array d = a + b;
70 array e = a + c;
71 array f2 = d * e - d;
72 float* hF2 = f2.host<float>();
73
74 for (int i = 0; i < num; i++) { ASSERT_EQ(hF2[i], valF2); }
75
76 freeHost(hF2);
77 }
78}
79
80TEST(JIT, CPP_JIT_Reset_Binary) {
81 array a = constant(2, 5, 5);

Callers

nothing calls this directly

Calls 15

constantFunction · 0.85
freeHostFunction · 0.85
sinFunction · 0.85
cosFunction · 0.85
randuFunction · 0.85
gforSetFunction · 0.85
seqClass · 0.85
randnFunction · 0.85
af_subFunction · 0.85
powFunction · 0.85
floorFunction · 0.85
testTwoLargeNonLinearFunction · 0.85

Tested by

no test coverage detected