Skip to content

Commit 22666d1

Browse files
committed
Fix code lint
1 parent 1d3dd0a commit 22666d1

12 files changed

Lines changed: 50 additions & 38 deletions

File tree

attn.log

Whitespace-only changes.

ffn.log

Whitespace-only changes.

include/ps/af_tensor_app.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ class AFTensorWorker {
133133
req.event = GetEvent();
134134
req.event->Record();
135135

136-
PS_VLOG(3) << "ts" << start_ts << " pushpull_queue_ push " << pushpull_queue_.Size();
136+
PS_VLOG(3) << "ts" << start_ts << " pushpull_queue_ push "
137+
<< pushpull_queue_.Size();
137138
pushpull_queue_.Push(std::move(req));
138139

139140
// std::unique_lock<std::mutex> timestamp_lock(timestamp_mu_);
@@ -217,7 +218,8 @@ class AFTensorWorker {
217218
}
218219
ZBatchPushPull_(req.push, req.push_timestamps, req.pull,
219220
req.pull_timestamps);
220-
PS_VLOG(4) << "pushpull_queue_ Loop done " << req.push_timestamps[0] << " " << req.pull_timestamps[0];
221+
PS_VLOG(4) << "pushpull_queue_ Loop done " << req.push_timestamps[0]
222+
<< " " << req.pull_timestamps[0];
221223
}
222224
PS_LOG(INFO) << "Stop PushPullWorker" << gpu_;
223225
}
@@ -235,7 +237,8 @@ class AFTensorWorker {
235237
msg.meta.timestamp = ts;
236238
msg.meta.addr = reinterpret_cast<uint64_t>(tensor.data_ptr());
237239
msg.meta.val_len = tensor.numel() * tensor.itemsize();
238-
PS_VLOG(2) << "ZPush_ addr: 0x" << std::hex << msg.meta.addr << std::dec << " val_len: " << msg.meta.val_len;
240+
PS_VLOG(2) << "ZPush_ addr: 0x" << std::hex << msg.meta.addr << std::dec
241+
<< " val_len: " << msg.meta.val_len;
239242
msg.meta.key = keys[0];
240243
msg.meta.is_tensor = 1;
241244
msg.meta.dtype = static_cast<int>(tensor.scalar_type());

include/ps/internal/message.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ struct Message {
384384
meta.dst_dev_id = val.dst_device_id_;
385385
}
386386
}
387-
387+
388388
std::string DebugString() const {
389389
std::stringstream ss;
390390
ss << meta.DebugString();

include/ps/internal/threadsafe_queue.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
#include <mutex>
1010
#include <queue>
1111
#include <utility>
12+
13+
#include "dmlc/logging.h"
1214
#include "ps/base.h"
1315
#include "ps/internal/env.h"
1416
#include "ps/internal/spsc_queue.h"
15-
#include "dmlc/logging.h"
1617

1718
namespace ps {
1819

@@ -34,7 +35,7 @@ class ThreadsafeQueue {
3435
* \brief push an value into the end. threadsafe.
3536
* \param new_value the value
3637
*/
37-
inline void Push(T new_value, bool print_log=false) {
38+
inline void Push(T new_value, bool print_log = false) {
3839
if (lockless_) {
3940
// PushLockless(std::move(new_value));
4041
PushAtomic(std::move(new_value), print_log);

include/ps/internal/utils.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#define PS_INTERNAL_UTILS_H_
77

88
#include <ctype.h>
9+
#include <execinfo.h>
910
#include <pthread.h>
1011
#include <sched.h>
1112
#include <stdio.h>
@@ -19,7 +20,6 @@
1920

2021
#include "dmlc/logging.h"
2122
#include "ps/internal/env.h"
22-
#include <execinfo.h>
2323

2424
namespace ps {
2525

@@ -125,13 +125,12 @@ static inline uint64_t GetNanosecond(bool return_zero = true) {
125125

126126
static int PS_VERBOSE = ps::GetEnv("PS_VERBOSE", 0);
127127

128-
129128
/**
130129
* @brief Rename Thread
131-
*
130+
*
132131
*/
133132

134-
static inline void RenameThread(const std::string& name) {
133+
static inline void RenameThread(const std::string &name) {
135134
pthread_setname_np(pthread_self(), name.c_str());
136135
}
137136

@@ -141,7 +140,6 @@ static inline void RenameThread(const std::string& name) {
141140
* \param core_count is the number of cores the thread need.
142141
*/
143142
static inline void BindCpuCore(int offset, int core_count = 1) {
144-
145143
RenameThread("StepMesh: BindCpuCore");
146144
int gpu = -1;
147145
Environment::Get()->find("STEPMESH_GPU", &gpu, gpu);

include/ps/kv_app.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ class KVWorker : public SimpleApp {
208208
*
209209
* \param timestamp the timestamp returned by the push or pull
210210
*/
211-
void Wait(int timestamp, uint64_t timeout_ms = 10000) { obj_->WaitRequest(timestamp, timeout_ms); }
211+
void Wait(int timestamp, uint64_t timeout_ms = 10000) {
212+
obj_->WaitRequest(timestamp, timeout_ms);
213+
}
212214

213215
/**
214216
* \brief zero-copy Push

include/ps/sarray.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ class SArray {
4949
SArray() {}
5050

5151
/** \brief empty deconstrcutor */
52-
~SArray() {
53-
}
52+
~SArray() {}
5453

5554
/**
5655
* \brief Create an array with length n with initialized value
@@ -216,7 +215,8 @@ class SArray {
216215
template <typename Deleter>
217216
void reset(V* data, size_t size, Deleter del,
218217
DeviceType src_device_type = CPU, int src_device_id = 0,
219-
DeviceType dst_device_type = CPU, int dst_device_id = 0 , bool force = false) {
218+
DeviceType dst_device_type = CPU, int dst_device_id = 0,
219+
bool force = false) {
220220
size_ = size;
221221
capacity_ = size;
222222

@@ -229,16 +229,15 @@ class SArray {
229229

230230
/**
231231
* @brief force reset the data pointer
232-
*
233-
* @param data
234-
* @param size
235-
* @param src_device_type
236-
* @param src_device_id
237-
* @param dst_device_type
238-
* @param dst_device_id
232+
*
233+
* @param data
234+
* @param size
235+
* @param src_device_type
236+
* @param src_device_id
237+
* @param dst_device_type
238+
* @param dst_device_id
239239
*/
240240
void force_reset(SArray<V>& arr) {
241-
242241
this->ptr_ = arr.ptr_;
243242
this->size_ = arr.size_;
244243
this->capacity_ = arr.capacity_;

src/customer.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ void Customer::WaitRequest(int timestamp, uint64_t timeout_ms) {
6060
} else {
6161
uint64_t now = GetNanosecond(false);
6262
// 1s for timeout
63-
if(now - req->start_time > timeout_ns) {
64-
PS_LOG(FATAL) << "request timeout " << timeout_ms << "ms, handler " << timestamp << " " << (now - req->start_time)/1000 << "us";
63+
if (now - req->start_time > timeout_ns) {
64+
PS_LOG(FATAL) << "request timeout " << timeout_ms << "ms, handler "
65+
<< timestamp << " " << (now - req->start_time) / 1000
66+
<< "us";
6567
}
6668
// _mm_pause();
6769
}
@@ -116,7 +118,8 @@ void Customer::DirectProcess(Message& recv) {
116118
t->request = recv.meta.request_trace;
117119
t->response = recv.meta.response_trace;
118120
#endif // STEPMESH_ENABLE_TRACE
119-
PS_VLOG(4) << "recv response " << recv.meta.timestamp << " " << recv.meta.DebugString();
121+
PS_VLOG(4) << "recv response " << recv.meta.timestamp << " "
122+
<< recv.meta.DebugString();
120123
t->response_count.fetch_add(1, std::memory_order_release);
121124
}
122125
}

src/rdma_transport.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,11 @@ class RDMATransport : public Transport {
476476
resp->origin_addr = req->origin_addr;
477477
resp->idx = addrpool.StoreAddress(buf_ctx);
478478

479-
PS_VLOG(2) << "GDR Server Reply: meta_addr=" << std::hex << resp->meta_addr
480-
<< ", meta_rkey=" << std::hex << resp->meta_rkey
481-
<< ", data_addr=" << std::hex << resp->data_addr
482-
<< ", data_rkey=" << std::hex << resp->data_rkey;
479+
PS_VLOG(2) << "GDR Server Reply: meta_addr=" << std::hex
480+
<< resp->meta_addr << ", meta_rkey=" << std::hex
481+
<< resp->meta_rkey << ", data_addr=" << std::hex
482+
<< resp->data_addr << ", data_rkey=" << std::hex
483+
<< resp->data_rkey;
483484

484485
// Send the reply
485486
struct ibv_sge sge;
@@ -664,7 +665,9 @@ class RDMATransport : public Transport {
664665
auto data_raddr = msg.meta.addr;
665666
auto data_rkey = msg.meta.option;
666667
auto data_len = msg.meta.val_len;
667-
PS_CHECK_EQ((size_t)msg.meta.val_len, msg_buf->data[1].size()) << "val len" << (size_t)msg.meta.val_len << " data len " << msg_buf->data[1].size();
668+
PS_CHECK_EQ((size_t)msg.meta.val_len, msg_buf->data[1].size())
669+
<< "val len" << (size_t)msg.meta.val_len << " data len "
670+
<< msg_buf->data[1].size();
668671

669672
struct ibv_sge data_sge;
670673
data_sge.addr = reinterpret_cast<uint64_t>(msg_buf->data[1].data());
@@ -924,7 +927,8 @@ class IPCTransport : public RDMATransport {
924927

925928
void SendPullResponse(Message &msg, MessageBuffer *msg_buf,
926929
RemoteTuple remote_tuple, size_t lkey) {
927-
auto addr = reinterpret_cast<void *>(PS_CHECK_NOTNULL(msg_buf->data[1].data()));
930+
auto addr =
931+
reinterpret_cast<void *>(PS_CHECK_NOTNULL(msg_buf->data[1].data()));
928932
void *shm_addr =
929933
PS_CHECK_NOTNULL(GetSharedMemory(shm_prefix_, msg.meta.key));
930934

0 commit comments

Comments
 (0)