-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
48e6333
commit b688515
Showing
12 changed files
with
33 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 6 additions & 10 deletions
16
torch_xla/csrc/runtime/thread_pool.cc → torch_xla/csrc/thread_pool.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,21 @@ | ||
#include "torch_xla/csrc/runtime/thread_pool.h" | ||
#include "torch_xla/csrc/thread_pool.h" | ||
|
||
#include <condition_variable> | ||
#include <deque> | ||
#include <exception> | ||
#include <mutex> | ||
#include <functional> | ||
|
||
#include "torch_xla/csrc/runtime/metrics.h" | ||
#include "torch_xla/csrc/runtime/tf_logging.h" | ||
#include "torch_xla/csrc/runtime/sys_util.h" | ||
#include "tsl/platform/env.h" | ||
#include "tsl/platform/threadpool.h" | ||
|
||
namespace torch_xla { | ||
namespace runtime { | ||
namespace thread { | ||
|
||
void Schedule(std::function<void()> fn) { | ||
static size_t num_threads = sys_util::GetEnvInt( | ||
static size_t num_threads = torch_xla::runtime::sys_util::GetEnvInt( | ||
"XLA_THREAD_POOL_SIZE", std::thread::hardware_concurrency()); | ||
static tsl::thread::ThreadPool pool(tsl::Env::Default(), "pytorchxla", | ||
num_threads); | ||
pool.Schedule(std::move(fn)); | ||
} | ||
|
||
} // namespace runtime | ||
} // namespace thread | ||
} // namespace torch_xla |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters