提交 8d021419 编写于 作者: L liaogang

fix unit test bug when only one gpu

上级 c7ece60e
...@@ -62,7 +62,11 @@ TEST(checkGradient, multiGpu) { ...@@ -62,7 +62,11 @@ TEST(checkGradient, multiGpu) {
} }
} }
TEST(checkGradient, parallel) { checkGradientTest(configFile4, true, true); } TEST(checkGradient, parallel) {
if (hl_get_device_count() >= 2) {
checkGradientTest(configFile4, true, true);
}
}
TEST(checkGradient, multiParallel) { TEST(checkGradient, multiParallel) {
FLAGS_allow_only_one_model_on_one_gpu = false; FLAGS_allow_only_one_model_on_one_gpu = false;
...@@ -90,7 +94,7 @@ TEST(checkGradient, multi) { ...@@ -90,7 +94,7 @@ TEST(checkGradient, multi) {
TEST(checkGradient, hsigmoid) { checkGradientTest(configFile2, false, false); } TEST(checkGradient, hsigmoid) { checkGradientTest(configFile2, false, false); }
TEST(checkGradient, chunk) { TEST(checkGradient, chunk) {
EXPECT_EQ(0, system("python2 trainer/tests/gen_proto_data.py")); EXPECT_EQ(0, system("python trainer/tests/gen_proto_data.py"));
checkGradientTest(configFile3, false, false); checkGradientTest(configFile3, false, false);
#ifndef PADDLE_ONLY_CPU #ifndef PADDLE_ONLY_CPU
checkGradientTest(configFile3, true, true); checkGradientTest(configFile3, true, true);
......
...@@ -82,7 +82,11 @@ TEST(trainerOnePass, gpu2) { trainerOnePassTest(configFile1, true, false, 2); } ...@@ -82,7 +82,11 @@ TEST(trainerOnePass, gpu2) { trainerOnePassTest(configFile1, true, false, 2); }
TEST(trainerOnePass, gpu4) { trainerOnePassTest(configFile1, true, false, 4); } TEST(trainerOnePass, gpu4) { trainerOnePassTest(configFile1, true, false, 4); }
TEST(trainerOnePass, parallel) { trainerOnePassTest(configFile2, true, true); } TEST(trainerOnePass, parallel) {
if (hl_get_device_count() >= 2) {
trainerOnePassTest(configFile2, true, true);
}
}
#endif #endif
// 2. test average_window. // 2. test average_window.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册