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

Method GetStream

tensorflow/stream_executor/stream_executor_pimpl.cc:1025–1043  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1023}
1024
1025port::StatusOr<Stream *> StreamExecutorMemoryAllocator::GetStream(
1026 int device_ordinal) {
1027 CHECK(!AllowsAsynchronousDeallocation())
1028 << "The logic below only works for synchronous allocators";
1029 TF_ASSIGN_OR_RETURN(StreamExecutor * executor,
1030 GetStreamExecutor(device_ordinal));
1031 Stream *out = [&] {
1032 absl::MutexLock lock(&mutex_);
1033 if (!streams_.count(device_ordinal)) {
1034 auto p = streams_.emplace(std::piecewise_construct,
1035 std::forward_as_tuple(device_ordinal),
1036 std::forward_as_tuple(executor));
1037 p.first->second.Init();
1038 return &p.first->second;
1039 }
1040 return &streams_.at(device_ordinal);
1041 }();
1042 return out;
1043}
1044
1045} // namespace stream_executor

Callers

nothing calls this directly

Calls 5

TF_ASSIGN_OR_RETURNFunction · 0.50
countMethod · 0.45
emplaceMethod · 0.45
InitMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected