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

Function test_backend

test/backend.cpp:87–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85using af::getActiveBackend;
86
87void test_backend(std::atomic<int>& counter, int ntests,
88 af::Backend default_backend, af::Backend test_backend) {
89 auto ta_backend = getActiveBackend();
90 ASSERT_EQ(default_backend, ta_backend);
91
92 // Wait until all threads reach this point
93 counter++;
94 while (counter < ntests) {}
95
96 setBackend(test_backend);
97
98 // Wait until all threads reach this point
99 counter++;
100 while (counter < 2 * ntests) {}
101
102 ta_backend = getActiveBackend();
103 ASSERT_EQ(test_backend, ta_backend);
104}
105
106TEST(Backend, Threads) {
107 using std::thread;

Callers 1

TESTFunction · 0.85

Calls 2

getActiveBackendFunction · 0.85
setBackendFunction · 0.50

Tested by

no test coverage detected