"fix common test"

fix-typo
Dong Zhihong 7 years ago
parent d8aebaf50c
commit 5bcb63800e

@ -1,3 +1,17 @@
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#include <algorithm>
@ -106,5 +120,5 @@ class NCCLManager {
comm_table;
};
} // namespace operators
} // namespace platform
} // namespace paddle

@ -6,9 +6,12 @@
#include <thread>
#include <vector>
namespace paddle {
namespace platform {
TEST(WaitGroup, wait) {
WaitGroup wg;
auto run_thread = [](int idx) {
auto run_thread = [&wg](int idx) {
wg.Add(1);
std::this_thread::sleep_for(std::chrono::seconds(1));
wg.Done();
@ -20,4 +23,11 @@ TEST(WaitGroup, wait) {
ths.emplace_back(std::thread(run_thread, i));
}
wg.Wait();
for (int i = 0; i < TNUM; ++i) {
ths[i].join();
}
}
} // namespace platform
} // namespace paddle

Loading…
Cancel
Save