File size: 373 Bytes
d1ceb73 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#pragma once
#include <c10/macros/Macros.h>
namespace c10 {
// RAII thread local guard that tracks whether code is being executed in
// `at::parallel_for` or `at::parallel_reduce` loop function.
class C10_API ParallelGuard {
public:
static bool is_enabled();
ParallelGuard(bool state);
~ParallelGuard();
private:
bool previous_state_;
};
} // namespace c10
|