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

Function TEST

test/threading.cpp:60–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60TEST(Threading, SimultaneousRead) {
61 setDevice(0);
62
63 array A = constant(1.0, 100, 100);
64 array B = constant(1.0, 100, 100);
65
66 vector<std::thread> tests;
67
68 int thread_count = 8;
69 int iteration_count = 30;
70 for (int t = 0; t < thread_count; ++t) {
71 ArithOp op;
72 float outValue;
73
74 switch (t % 4) {
75 case 0:
76 op = ADD;
77 outValue = 2.0f;
78 break;
79 case 1:
80 op = SUB;
81 outValue = 0.0f;
82 break;
83 case 2:
84 op = DIV;
85 outValue = 1.0f;
86 break;
87 case 3:
88 op = MUL;
89 outValue = 1.0f;
90 break;
91 }
92
93 tests.emplace_back(calc, op, A, B, outValue, iteration_count);
94 }
95
96 for (int t = 0; t < thread_count; ++t)
97 if (tests[t].joinable()) tests[t].join();
98}
99
100std::condition_variable cv;
101std::mutex cvMutex;

Callers 1

threading.cppFile · 0.70

Calls 14

constantFunction · 0.85
readImageTestsFunction · 0.85
loadImageFunction · 0.85
cleanSlateFunction · 0.85
deviceMemInfoFunction · 0.85
INSTANTIATE_TEST_TPFunction · 0.85
noDoubleTestsFunction · 0.85
randuFunction · 0.85
beginFunction · 0.85
setDeviceFunction · 0.50
getDeviceCountFunction · 0.50
af_get_device_countFunction · 0.50

Tested by

no test coverage detected