MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/stream_executor/host/host_stream_test.cc:26–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24namespace se = stream_executor;
25
26TEST(HostStream, EnforcesFIFOOrder) {
27 se::Platform* platform =
28 se::MultiPlatformManager::PlatformWithName("Host").ValueOrDie();
29 se::StreamExecutor* executor = platform->ExecutorForDevice(0).ValueOrDie();
30 se::Stream stream(executor);
31 stream.Init();
32
33 absl::Mutex mu;
34 int expected = 0;
35 bool ok = true;
36 for (int i = 0; i < 2000; ++i) {
37 stream.ThenDoHostCallback([i, &mu, &expected, &ok]() {
38 absl::MutexLock lock(&mu);
39 if (expected != i) {
40 ok = false;
41 }
42 ++expected;
43 });
44 }
45 TF_ASSERT_OK(stream.BlockHostUntilDone());
46 absl::MutexLock lock(&mu);
47 EXPECT_TRUE(ok);
48}

Callers

nothing calls this directly

Calls 3

ExecutorForDeviceMethod · 0.45
InitMethod · 0.45
BlockHostUntilDoneMethod · 0.45

Tested by

no test coverage detected