pytorch/c10/core/impl/GPUTrace.cpp
cyy 39ec5fa722 Fix header inclusions in c10 by iwyu (#100304)
This work introduces include-what-you-use  support for c10 by a CMake option defaulting to off. We also remove some unused header inclusions and  fix a trivial inclusion error.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/100304
Approved by: https://github.com/ezyang
2023-05-10 15:42:43 +00:00

21 lines
450 B
C++

#include <c10/core/impl/GPUTrace.h>
#include <c10/util/CallOnce.h>
namespace c10 {
namespace impl {
std::atomic<const PyInterpreter*> GPUTrace::gpuTraceState{nullptr};
bool GPUTrace::haveState{false};
void GPUTrace::set_trace(const PyInterpreter* trace) {
static c10::once_flag flag;
c10::call_once(flag, [&]() {
gpuTraceState.store(trace, std::memory_order_release);
haveState = true;
});
}
} // namespace impl
} // namespace c10