Skip to content

Commit 8f266e2

Browse files
authored
Merge pull request #11464 from tensor-tang/set_nthreads
initial with only 1 mkl/openblas threads for each pthreads
2 parents 0b3d7f1 + d0fb00d commit 8f266e2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

paddle/fluid/framework/init.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ limitations under the License. */
1818

1919
#include "paddle/fluid/framework/init.h"
2020
#include "paddle/fluid/framework/operator.h"
21+
#include "paddle/fluid/operators/math/blas.h"
2122
#include "paddle/fluid/platform/device_context.h"
2223
#include "paddle/fluid/platform/place.h"
2324
#include "paddle/fluid/string/piece.h"
@@ -113,6 +114,9 @@ void InitDevices(bool init_p2p, const std::vector<int> devices) {
113114
}
114115
places.emplace_back(platform::CPUPlace());
115116
platform::DeviceContextPool::Init(places);
117+
#ifndef PADDLE_WITH_MKLDNN
118+
operators::math::SetNumThreads(1);
119+
#endif
116120
}
117121

118122
void InitGLOG(const std::string &prog_name) {

0 commit comments

Comments
 (0)