Skip to content

Commit be0525f

Browse files
committed
fix code format
1 parent 62fb71a commit be0525f

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

paddle/framework/channel_test.cc

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ limitations under the License. */
1919

2020
#include "gtest/gtest.h"
2121

22-
2322
using paddle::framework::Channel;
2423
using paddle::framework::MakeChannel;
2524
using paddle::framework::CloseChannel;
@@ -47,12 +46,12 @@ TEST(Channel, SufficientBufferSizeDoesntBlock) {
4746
const size_t buffer_size = 10;
4847
auto ch = MakeChannel<size_t>(buffer_size);
4948
for (size_t i = 0; i < buffer_size; ++i) {
50-
ch->Send(&i); // should not block
49+
ch->Send(&i); // should not block
5150
}
5251

5352
size_t out;
5453
for (size_t i = 0; i < buffer_size; ++i) {
55-
ch->Receive(&out); // should not block
54+
ch->Receive(&out); // should not block
5655
EXPECT_EQ(out, i);
5756
}
5857
CloseChannel(ch);
@@ -63,15 +62,14 @@ TEST(Channel, ConcurrentSendNonConcurrentReceiveWithSufficientBufferSize) {
6362
auto ch = MakeChannel<size_t>(buffer_size);
6463

6564
size_t sum = 0;
66-
std::thread t([&](){
67-
// Try to write more than buffer size.
68-
for (size_t i = 0; i < 2*buffer_size; ++i) {
69-
ch->Send(&i); // should not block
70-
sum += i;
71-
}
72-
});
73-
74-
std::this_thread::sleep_for(std::chrono::milliseconds(100)); // wait 0.5 sec
65+
std::thread t([&]() {
66+
// Try to write more than buffer size.
67+
for (size_t i = 0; i < 2 * buffer_size; ++i) {
68+
ch->Send(&i); // should not block
69+
sum += i;
70+
}
71+
});
72+
std::this_thread::sleep_for(std::chrono::milliseconds(100)); // wait 0.5 sec
7573
EXPECT_EQ(sum, 45U);
7674
CloseChannel(ch);
7775
}

paddle/framework/details/buffered_channel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Buffered : public paddle::framework::Channel<T> {
4141
std::condition_variable full_cond_var_;
4242
std::deque<T> channel_;
4343

44-
Buffered(size_t cap) : cap_(cap) { PADDLE_ENFORCE_GT(cap, 0); }
44+
Buffered(size_t cap) : cap_(cap) { PADDLE_ENFORCE_GT(cap, 0); }
4545
virtual ~Buffered();
4646

4747
void NotifyAllSenders(std::unique_lock<std::mutex>*);

0 commit comments

Comments
 (0)