diff --git a/paddle/operators/nccl/nccl_gpu_common.h b/paddle/operators/nccl/nccl_gpu_common.h index 96b3bb801af6ffc0ebe18485dec8700f3757d814..4a375fcc36a1f07287332aed985de132f94d5929 100644 --- a/paddle/operators/nccl/nccl_gpu_common.h +++ b/paddle/operators/nccl/nccl_gpu_common.h @@ -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 @@ -106,5 +120,5 @@ class NCCLManager { comm_table; }; -} // namespace operators +} // namespace platform } // namespace paddle diff --git a/paddle/operators/nccl/nccl_gpu_common_test.cc b/paddle/operators/nccl/nccl_gpu_common_test.cc index 9b46ea31ba1ae8411a766b7eb25009b38b3e4b0a..6f6a4ac886ddc9b45de38b06b0968fa07f45815d 100644 --- a/paddle/operators/nccl/nccl_gpu_common_test.cc +++ b/paddle/operators/nccl/nccl_gpu_common_test.cc @@ -6,9 +6,12 @@ #include #include +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