提交 02631965 编写于 作者: Y Yu Yang

Refine

上级 d231e550
...@@ -34,6 +34,8 @@ AllocatorStrategy GetAllocatorStrategy() { ...@@ -34,6 +34,8 @@ AllocatorStrategy GetAllocatorStrategy() {
static AllocatorStrategy strategy = GetStrategyFromFlag(); static AllocatorStrategy strategy = GetStrategyFromFlag();
return strategy; return strategy;
} }
void UseAllocatorStrategyGFlag() {}
} // namespace allocation } // namespace allocation
} // namespace memory } // namespace memory
} // namespace paddle } // namespace paddle
...@@ -22,6 +22,9 @@ enum class AllocatorStrategy { kLegacy, kNaiveBestFit }; ...@@ -22,6 +22,9 @@ enum class AllocatorStrategy { kLegacy, kNaiveBestFit };
extern AllocatorStrategy GetAllocatorStrategy(); extern AllocatorStrategy GetAllocatorStrategy();
// Do nothing, just make sure linker do not prune this file.
extern void UseAllocatorStrategyGFlag();
} // namespace allocation } // namespace allocation
} // namespace memory } // namespace memory
} // namespace paddle } // namespace paddle
...@@ -34,6 +34,7 @@ limitations under the License. */ ...@@ -34,6 +34,7 @@ limitations under the License. */
#include "paddle/fluid/framework/reader.h" #include "paddle/fluid/framework/reader.h"
#include "paddle/fluid/framework/selected_rows.h" #include "paddle/fluid/framework/selected_rows.h"
#include "paddle/fluid/framework/version.h" #include "paddle/fluid/framework/version.h"
#include "paddle/fluid/memory/allocation/allocator_strategy.h"
#include "paddle/fluid/operators/activation_op.h" #include "paddle/fluid/operators/activation_op.h"
#include "paddle/fluid/operators/reader/lod_tensor_blocking_queue.h" #include "paddle/fluid/operators/reader/lod_tensor_blocking_queue.h"
#include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/enforce.h"
...@@ -83,6 +84,7 @@ bool IsCompiledWithDIST() { ...@@ -83,6 +84,7 @@ bool IsCompiledWithDIST() {
} }
PYBIND11_PLUGIN(core) { PYBIND11_PLUGIN(core) {
paddle::memory::allocation::UseAllocatorStrategyGFlag();
py::module m("core", "C++ core of PaddlePaddle"); py::module m("core", "C++ core of PaddlePaddle");
// using framework in this function. Since it is inside a function, it will // using framework in this function. Since it is inside a function, it will
......
...@@ -16,10 +16,12 @@ limitations under the License. */ ...@@ -16,10 +16,12 @@ limitations under the License. */
#include "gflags/gflags.h" #include "gflags/gflags.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "paddle/fluid/memory/allocation/allocator_strategy.h"
#include "paddle/fluid/memory/memory.h" #include "paddle/fluid/memory/memory.h"
#include "paddle/fluid/platform/init.h" #include "paddle/fluid/platform/init.h"
int main(int argc, char** argv) { int main(int argc, char** argv) {
paddle::memory::allocation::UseAllocatorStrategyGFlag();
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
std::vector<char*> new_argv; std::vector<char*> new_argv;
std::string gflags_env; std::string gflags_env;
......
...@@ -116,7 +116,7 @@ class TestDataBalance(unittest.TestCase): ...@@ -116,7 +116,7 @@ class TestDataBalance(unittest.TestCase):
print("WARNING: Unittest TestDataBalance skipped. \ print("WARNING: Unittest TestDataBalance skipped. \
For the result is not correct when device count \ For the result is not correct when device count \
is larger than batch size.") is larger than batch size.")
exit(0) return
fetch_list = [image.name, label.name] fetch_list = [image.name, label.name]
data_appeared = [False] * self.total_ins_num data_appeared = [False] * self.total_ins_num
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册