Skip to content

Commit 0263196

Browse files
committed
Refine
1 parent d231e55 commit 0263196

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

paddle/fluid/memory/allocation/allocator_strategy.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ AllocatorStrategy GetAllocatorStrategy() {
3434
static AllocatorStrategy strategy = GetStrategyFromFlag();
3535
return strategy;
3636
}
37+
38+
void UseAllocatorStrategyGFlag() {}
3739
} // namespace allocation
3840
} // namespace memory
3941
} // namespace paddle

paddle/fluid/memory/allocation/allocator_strategy.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ enum class AllocatorStrategy { kLegacy, kNaiveBestFit };
2222

2323
extern AllocatorStrategy GetAllocatorStrategy();
2424

25+
// Do nothing, just make sure linker do not prune this file.
26+
extern void UseAllocatorStrategyGFlag();
27+
2528
} // namespace allocation
2629
} // namespace memory
2730
} // namespace paddle

paddle/fluid/pybind/pybind.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ limitations under the License. */
3434
#include "paddle/fluid/framework/reader.h"
3535
#include "paddle/fluid/framework/selected_rows.h"
3636
#include "paddle/fluid/framework/version.h"
37+
#include "paddle/fluid/memory/allocation/allocator_strategy.h"
3738
#include "paddle/fluid/operators/activation_op.h"
3839
#include "paddle/fluid/operators/reader/lod_tensor_blocking_queue.h"
3940
#include "paddle/fluid/platform/enforce.h"
@@ -83,6 +84,7 @@ bool IsCompiledWithDIST() {
8384
}
8485

8586
PYBIND11_PLUGIN(core) {
87+
paddle::memory::allocation::UseAllocatorStrategyGFlag();
8688
py::module m("core", "C++ core of PaddlePaddle");
8789

8890
// using framework in this function. Since it is inside a function, it will

paddle/testing/paddle_gtest_main.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ limitations under the License. */
1616

1717
#include "gflags/gflags.h"
1818
#include "gtest/gtest.h"
19+
#include "paddle/fluid/memory/allocation/allocator_strategy.h"
1920
#include "paddle/fluid/memory/memory.h"
2021
#include "paddle/fluid/platform/init.h"
2122

2223
int main(int argc, char** argv) {
24+
paddle::memory::allocation::UseAllocatorStrategyGFlag();
2325
testing::InitGoogleTest(&argc, argv);
2426
std::vector<char*> new_argv;
2527
std::string gflags_env;

python/paddle/fluid/tests/unittests/test_data_balance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def main(self):
116116
print("WARNING: Unittest TestDataBalance skipped. \
117117
For the result is not correct when device count \
118118
is larger than batch size.")
119-
exit(0)
119+
return
120120
fetch_list = [image.name, label.name]
121121

122122
data_appeared = [False] * self.total_ins_num

0 commit comments

Comments
 (0)