Relax set_num_threads restriction in parallel native case (#27947)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27947

Don't throw exception if the requested size is the same as the currently
used one

Test Plan:
ATEN_THREADING=NATIVE python setup.py develop --cmake

Imported from OSS

Differential Revision: D17919416

fbshipit-source-id: 411f7c9bd6a46e7a003b43a200c2ce3b76453a2e
This commit is contained in:
Ilia Cherniavskii
2019-10-16 21:51:45 -07:00
committed by Facebook Github Bot
parent 2265cddbd2
commit 19956b200d
4 changed files with 22 additions and 15 deletions
+2 -2
View File
@@ -8,7 +8,7 @@
TEST(TorchIncludeTest, GetSetNumThreads) {
torch::init_num_threads();
torch::set_num_threads(2);
ASSERT_EQ(torch::get_num_threads(), 2);
torch::set_num_interop_threads(2);
ASSERT_EQ(torch::get_num_interop_threads(), 2);
torch::get_num_threads();
torch::get_num_interop_threads();
}